diff options
Diffstat (limited to 'embassy-mcxa/.github/workflows/check.yml')
| -rw-r--r-- | embassy-mcxa/.github/workflows/check.yml | 215 |
1 files changed, 215 insertions, 0 deletions
diff --git a/embassy-mcxa/.github/workflows/check.yml b/embassy-mcxa/.github/workflows/check.yml new file mode 100644 index 000000000..ad9f44428 --- /dev/null +++ b/embassy-mcxa/.github/workflows/check.yml | |||
| @@ -0,0 +1,215 @@ | |||
| 1 | # This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs | ||
| 2 | # several checks: | ||
| 3 | # - fmt: checks that the code is formatted according to rustfmt | ||
| 4 | # - clippy: checks that the code does not contain any clippy warnings | ||
| 5 | # - doc: checks that the code can be documented without errors | ||
| 6 | # - hack: check combinations of feature flags | ||
| 7 | # - msrv: check that the msrv specified in the crate is correct | ||
| 8 | permissions: | ||
| 9 | contents: read | ||
| 10 | |||
| 11 | # This configuration allows maintainers of this repo to create a branch and pull request based on | ||
| 12 | # the new branch. Restricting the push trigger to the main branch ensures that the PR only gets | ||
| 13 | # built once. | ||
| 14 | on: | ||
| 15 | |||
| 16 | push: | ||
| 17 | branches: [main, main-nextgen] | ||
| 18 | pull_request: | ||
| 19 | |||
| 20 | # If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that | ||
| 21 | # we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5 | ||
| 22 | concurrency: | ||
| 23 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| 24 | cancel-in-progress: true | ||
| 25 | |||
| 26 | name: check | ||
| 27 | |||
| 28 | jobs: | ||
| 29 | |||
| 30 | fmt: | ||
| 31 | runs-on: ubuntu-latest | ||
| 32 | name: nightly / fmt | ||
| 33 | |||
| 34 | strategy: | ||
| 35 | fail-fast: false | ||
| 36 | matrix: | ||
| 37 | workdir: [ ".", "examples",] | ||
| 38 | |||
| 39 | steps: | ||
| 40 | - uses: actions/checkout@v6 | ||
| 41 | with: | ||
| 42 | submodules: true | ||
| 43 | |||
| 44 | - name: Install nightly | ||
| 45 | uses: dtolnay/rust-toolchain@nightly | ||
| 46 | with: | ||
| 47 | components: rustfmt | ||
| 48 | targets: thumbv8m.main-none-eabihf | ||
| 49 | |||
| 50 | - name: cargo fmt --check | ||
| 51 | run: cargo fmt --check | ||
| 52 | working-directory: ${{ matrix.workdir }} | ||
| 53 | |||
| 54 | clippy-examples: | ||
| 55 | runs-on: ubuntu-latest | ||
| 56 | name: ${{ matrix.toolchain }} / clippy | ||
| 57 | |||
| 58 | permissions: | ||
| 59 | contents: read | ||
| 60 | checks: write | ||
| 61 | |||
| 62 | strategy: | ||
| 63 | fail-fast: false | ||
| 64 | matrix: | ||
| 65 | # Get early warning of new lints which are regularly introduced in beta channels. | ||
| 66 | toolchain: [stable] | ||
| 67 | workdir: ["examples"] | ||
| 68 | |||
| 69 | steps: | ||
| 70 | - uses: actions/checkout@v6 | ||
| 71 | with: | ||
| 72 | submodules: true | ||
| 73 | |||
| 74 | - name: Install ${{ matrix.toolchain }} | ||
| 75 | uses: dtolnay/rust-toolchain@master | ||
| 76 | with: | ||
| 77 | toolchain: ${{ matrix.toolchain }} | ||
| 78 | components: clippy | ||
| 79 | targets: thumbv8m.main-none-eabihf | ||
| 80 | |||
| 81 | - name: cargo clippy | ||
| 82 | working-directory: ${{ matrix.workdir }} | ||
| 83 | run: | | ||
| 84 | cargo clippy --locked -- -Dwarnings -D clippy::suspicious -D clippy::correctness -D clippy::perf -D clippy::style | ||
| 85 | |||
| 86 | # Enable once we have a released crate | ||
| 87 | # semver: | ||
| 88 | # runs-on: ubuntu-latest | ||
| 89 | # name: semver | ||
| 90 | # steps: | ||
| 91 | # - uses: actions/checkout@v6 | ||
| 92 | # with: | ||
| 93 | # submodules: true | ||
| 94 | # - name: Install stable | ||
| 95 | # uses: dtolnay/rust-toolchain@stable | ||
| 96 | # with: | ||
| 97 | # components: rustfmt | ||
| 98 | # - name: cargo-semver-checks | ||
| 99 | # uses: obi1kenobi/cargo-semver-checks-action@v2 | ||
| 100 | |||
| 101 | doc: | ||
| 102 | # run docs generation on nightly rather than stable. This enables features like | ||
| 103 | # https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html which allows an | ||
| 104 | # API be documented as only available in some specific platforms. | ||
| 105 | runs-on: ubuntu-latest | ||
| 106 | name: nightly / doc | ||
| 107 | |||
| 108 | steps: | ||
| 109 | - uses: actions/checkout@v6 | ||
| 110 | with: | ||
| 111 | submodules: true | ||
| 112 | |||
| 113 | - name: Install nightly | ||
| 114 | uses: dtolnay/rust-toolchain@nightly | ||
| 115 | with: | ||
| 116 | targets: thumbv8m.main-none-eabihf | ||
| 117 | |||
| 118 | - name: cargo doc | ||
| 119 | run: | | ||
| 120 | cargo doc --no-deps --all-features --locked | ||
| 121 | env: | ||
| 122 | RUSTDOCFLAGS: --cfg docsrs | ||
| 123 | |||
| 124 | hack: | ||
| 125 | # cargo-hack checks combinations of feature flags to ensure that features are all additive | ||
| 126 | # which is required for feature unification | ||
| 127 | runs-on: ubuntu-latest | ||
| 128 | name: ubuntu / stable / features | ||
| 129 | |||
| 130 | strategy: | ||
| 131 | fail-fast: false | ||
| 132 | |||
| 133 | steps: | ||
| 134 | - uses: actions/checkout@v6 | ||
| 135 | with: | ||
| 136 | submodules: true | ||
| 137 | |||
| 138 | - name: Install stable | ||
| 139 | uses: dtolnay/rust-toolchain@stable | ||
| 140 | with: | ||
| 141 | toolchain: stable | ||
| 142 | components: clippy | ||
| 143 | targets: thumbv8m.main-none-eabihf | ||
| 144 | |||
| 145 | - name: cargo install cargo-hack | ||
| 146 | uses: taiki-e/install-action@cargo-hack | ||
| 147 | |||
| 148 | - name: cargo hack | ||
| 149 | run: cargo hack --feature-powerset check | ||
| 150 | |||
| 151 | deny: | ||
| 152 | # cargo-deny checks licenses, advisories, sources, and bans for | ||
| 153 | # our dependencies. | ||
| 154 | runs-on: ubuntu-latest | ||
| 155 | name: ubuntu / stable / deny | ||
| 156 | |||
| 157 | steps: | ||
| 158 | - uses: actions/checkout@v6 | ||
| 159 | with: | ||
| 160 | submodules: true | ||
| 161 | |||
| 162 | - name: Install stable | ||
| 163 | uses: dtolnay/rust-toolchain@stable | ||
| 164 | with: | ||
| 165 | targets: thumbv8m.main-none-eabihf | ||
| 166 | |||
| 167 | - name: cargo install cargo-deny | ||
| 168 | uses: EmbarkStudios/cargo-deny-action@v2 | ||
| 169 | with: | ||
| 170 | log-level: warn | ||
| 171 | manifest-path: ./Cargo.toml | ||
| 172 | command: check | ||
| 173 | arguments: --all-features --locked | ||
| 174 | |||
| 175 | msrv: | ||
| 176 | # check that we can build using the minimal rust version that is specified by this crate | ||
| 177 | runs-on: ubuntu-latest | ||
| 178 | # we use a matrix here just because env can't be used in job names | ||
| 179 | # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability | ||
| 180 | strategy: | ||
| 181 | fail-fast: false | ||
| 182 | matrix: | ||
| 183 | msrv: ["1.91"] # We're relying on namespaced-features, which | ||
| 184 | # was released in 1.60 | ||
| 185 | # | ||
| 186 | # We also depend on `fixed' which requires rust | ||
| 187 | # 1.71 | ||
| 188 | # | ||
| 189 | # Additionally, we depend on embedded-hal-async | ||
| 190 | # which requires 1.75 | ||
| 191 | # | ||
| 192 | # embassy-time requires 1.79 due to | ||
| 193 | # collapse_debuginfo | ||
| 194 | # | ||
| 195 | # embassy upstream switched to rust 1.85 | ||
| 196 | # | ||
| 197 | # unsigned_is_multiple_of requires 1.90, else we get clippy warnings | ||
| 198 | # | ||
| 199 | # [email protected] requires rustc 1.91 | ||
| 200 | |||
| 201 | name: ubuntu / ${{ matrix.msrv }} | ||
| 202 | steps: | ||
| 203 | - uses: actions/checkout@v6 | ||
| 204 | with: | ||
| 205 | submodules: true | ||
| 206 | |||
| 207 | - name: Install ${{ matrix.msrv }} | ||
| 208 | uses: dtolnay/rust-toolchain@master | ||
| 209 | with: | ||
| 210 | toolchain: ${{ matrix.msrv }} | ||
| 211 | targets: thumbv8m.main-none-eabihf | ||
| 212 | |||
| 213 | - name: cargo +${{ matrix.msrv }} check | ||
| 214 | run: | | ||
| 215 | cargo check --all-features --locked | ||
