• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2
3permissions:
4  contents: read
5
6on:
7  pull_request:
8  push:
9    branches:
10      - main
11      - dev
12      - staging
13      - v[0-9]+.[0-9]+
14  schedule:
15    - cron: '0 1 * * *'
16  workflow_dispatch:
17
18env:
19  CARGO_INCREMENTAL: 0
20  CARGO_NET_RETRY: 10
21  CARGO_TERM_COLOR: always
22  RUST_BACKTRACE: full
23  RUSTDOCFLAGS: -D warnings
24  RUSTFLAGS: -D warnings
25  RUSTUP_MAX_RETRIES: 10
26
27defaults:
28  run:
29    shell: bash
30
31jobs:
32  test:
33    strategy:
34      fail-fast: false
35      matrix:
36        rust:
37          - 1.37
38          - stable
39          - beta
40          - nightly
41    runs-on: ubuntu-latest
42    steps:
43      - uses: actions/checkout@v3
44        with:
45          persist-credentials: false
46      - uses: taiki-e/github-actions/install-rust@main
47        with:
48          toolchain: ${{ matrix.rust }}
49          component: rustfmt,rust-src
50          target: thumbv7m-none-eabi
51      - uses: dtolnay/install@cargo-expand
52        if: startsWith(matrix.rust, 'nightly')
53      - run: cargo test --all --all-features
54      - run: cargo build --manifest-path tests/no-std/Cargo.toml --target thumbv7m-none-eabi
55
56  msrv:
57    runs-on: ubuntu-latest
58    steps:
59      - uses: actions/checkout@v3
60        with:
61          persist-credentials: false
62      - uses: taiki-e/install-action@cargo-hack
63      - run: cargo hack build --workspace --ignore-private --no-dev-deps --version-range .. --version-step 2
64
65  miri:
66    runs-on: ubuntu-latest
67    steps:
68      - uses: actions/checkout@v3
69        with:
70          persist-credentials: false
71      - uses: taiki-e/github-actions/install-rust@main
72        with:
73          component: miri
74      - run: cargo miri test --workspace --all-features
75        env:
76          MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check
77          RUSTFLAGS: ${{ env.RUSTFLAGS }} -Z randomize-layout
78
79  tidy:
80    runs-on: ubuntu-latest
81    steps:
82      - uses: actions/checkout@v3
83        with:
84          persist-credentials: false
85      - uses: taiki-e/github-actions/install-rust@main
86        with:
87          component: clippy,rustfmt
88      - uses: taiki-e/install-action@cargo-hack
89      - uses: taiki-e/install-action@cargo-minimal-versions
90      - uses: taiki-e/install-action@shellcheck
91      - run: cargo fmt --all --check
92        if: always()
93      - run: cargo clippy --workspace --all-features --all-targets
94        if: always()
95      - run: cargo minimal-versions build --workspace --all-features --ignore-private
96        if: always()
97      - run: shellcheck $(git ls-files '*.sh')
98        if: always()
99
100  docs:
101    runs-on: ubuntu-latest
102    steps:
103      - uses: actions/checkout@v3
104        with:
105          persist-credentials: false
106      - uses: taiki-e/github-actions/install-rust@main
107      - run: cargo doc --workspace --all-features
108
109  # This job doesn't actually test anything, but they're used to tell bors the
110  # build completed, as there is no practical way to detect when a workflow is
111  # successful listening to webhooks only.
112  #
113  # ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
114
115  ci-success:
116    name: ci
117    if: github.event_name == 'push' && success()
118    needs:
119      - test
120      - msrv
121      - miri
122      - tidy
123      - docs
124    runs-on: ubuntu-latest
125    steps:
126      - name: Mark the job as a success
127        run: exit 0
128