2929 - name : Check style
3030 run : ./ci/style.sh
3131
32+ clippy :
33+ name : Clippy on ${{ matrix.os }}
34+ strategy :
35+ matrix :
36+ os : [ubuntu-24.04, macos-14, windows-2022]
37+ runs-on : ${{ matrix.os }}
38+ timeout-minutes : 10
39+ steps :
40+ - uses : actions/checkout@v4
41+ - run : rustup update stable --no-self-update
42+ - uses : Swatinem/rust-cache@v2
43+ # Here we use the latest stable Rust toolchain already installed by GitHub
44+ # Ideally we should run it for every target, but we cannot rely on unstable toolchains
45+ # due to Clippy not being consistent between them.
46+ - run : cargo clippy --workspace --exclude libc-test --exclude ctest-test --all-targets -- -D warnings
47+
3248 # This runs `cargo build --target ...` for all T1 and T2 targets`
3349 verify_build :
3450 name : Verify build
7692 - target : i686-unknown-linux-gnu
7793 docker : true
7894 os : ubuntu-24.04
95+ - target : i686-unknown-linux-gnu
96+ docker : true
97+ os : ubuntu-24.04
98+ artifact-tag : offset-bits64
99+ env :
100+ RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS : 64
79101 - target : x86_64-unknown-linux-gnu
80102 docker : true
81103 os : ubuntu-24.04
@@ -107,6 +129,13 @@ jobs:
107129 with :
108130 key : ${{ matrix.target }}
109131
132+ - name : Add matrix env variables to the environment
133+ if : matrix.env
134+ run : |
135+ echo '${{ toJson(matrix.env) }}' |
136+ jq -r 'to_entries | map("\(.key)=\(.value|tostring)") | .[]' >>$GITHUB_ENV
137+ shell : bash
138+
110139 - name : Run natively
111140 if : " !matrix.docker"
112141 run : ./ci/run.sh ${{ matrix.target }}
@@ -115,11 +144,13 @@ jobs:
115144 run : ./ci/run-docker.sh ${{ matrix.target }}
116145
117146 - name : Create CI artifacts
147+ id : create_artifacts
118148 if : always()
119149 run : ./ci/create-artifacts.py
120150 - uses : actions/upload-artifact@v4
151+ if : always() && steps.create_artifacts.outcome == 'success'
121152 with :
122- name : ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}
153+ name : ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}${{ matrix.artifact-tag && format('-{0}', matrix.artifact-tag) }}
123154 path : ${{ env.ARCHIVE_PATH }}
124155 retention-days : 5
125156
@@ -139,15 +170,11 @@ jobs:
139170 - aarch64-unknown-linux-gnu
140171 - aarch64-unknown-linux-musl
141172 - arm-linux-androideabi
142- - arm-unknown-linux-gnueabihf
143173 - arm-unknown-linux-musleabihf
144174 - i686-linux-android
145175 - i686-unknown-linux-musl
146176 - loongarch64-unknown-linux-gnu
147177 - loongarch64-unknown-linux-musl
148- # FIXME(ppc): SIGILL running tests, see
149- # https://github.com/rust-lang/libc/pull/4254#issuecomment-2636288713
150- # - powerpc-unknown-linux-gnu
151178 - powerpc64-unknown-linux-gnu
152179 - powerpc64le-unknown-linux-gnu
153180 - riscv64gc-unknown-linux-gnu
@@ -162,6 +189,19 @@ jobs:
162189 # FIXME: It seems some items in `src/unix/mod.rs`
163190 # aren't defined on redox actually.
164191 # - x86_64-unknown-redox
192+ include :
193+ - target : arm-unknown-linux-gnueabihf
194+ - target : arm-unknown-linux-gnueabihf
195+ env :
196+ RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS : 64
197+ artifact-tag : offset-bits64
198+ # FIXME(ppc): SIGILL running tests, see
199+ # https://github.com/rust-lang/libc/pull/4254#issuecomment-2636288713
200+ # - target: powerpc-unknown-linux-gnu
201+ # - target: powerpc-unknown-linux-gnu
202+ # env:
203+ # RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS: 64
204+ # artifact-tag: offset-bits64
165205 timeout-minutes : 25
166206 env :
167207 TARGET : ${{ matrix.target }}
@@ -173,15 +213,24 @@ jobs:
173213 with :
174214 key : ${{ matrix.target }}
175215
216+ - name : Add matrix env variables to the environment
217+ if : matrix.env
218+ run : |
219+ echo '${{ toJson(matrix.env) }}' |
220+ jq -r 'to_entries | map("\(.key)=\(.value|tostring)") | .[]' >>$GITHUB_ENV
221+ shell : bash
222+
176223 - name : Execute run-docker.sh
177224 run : ./ci/run-docker.sh ${{ matrix.target }}
178225
179226 - name : Create CI artifacts
227+ id : create_artifacts
180228 if : always()
181229 run : ./ci/create-artifacts.py
182230 - uses : actions/upload-artifact@v4
231+ if : always() && steps.create_artifacts.outcome == 'success'
183232 with :
184- name : ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}
233+ name : ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}${{ matrix.artifact-tag && format('-{0}', matrix.artifact-tag) }}
185234 path : ${{ env.ARCHIVE_PATH }}
186235 retention-days : 5
187236
@@ -222,14 +271,25 @@ jobs:
222271 steps :
223272 - uses : actions/checkout@master
224273 - run : |
225- msrv="$(perl -ne 'print if s/rust-version\s*=\s*"(.*)"/\1/g' ctest/Cargo.toml )"
274+ msrv="$(cargo metadata --format-version 1 | jq -r --arg CRATE_NAME ctest '.packages | map(select(.name == $CRATE_NAME)) | first | .rust_version' )"
226275 echo "MSRV: $msrv"
227276 echo "MSRV=$msrv" >> "$GITHUB_ENV"
228277 - name : Install Rust
229278 run : rustup update "$MSRV" --no-self-update && rustup default "$MSRV"
230279 - uses : Swatinem/rust-cache@v2
231280 - run : cargo build -p ctest
232281
282+ docs :
283+ name : Ensure docs build
284+ runs-on : ubuntu-24.04
285+ timeout-minutes : 10
286+ steps :
287+ - uses : actions/checkout@master
288+ - name : Install Rust
289+ run : rustup update nightly --no-self-update && rustup default nightly
290+ - uses : Swatinem/rust-cache@v2
291+ - run : cargo doc --workspace --no-deps
292+
233293 # One job that "summarizes" the success state of this pipeline. This can then be added to branch
234294 # protection, rather than having to add each job separately.
235295 success :
@@ -242,7 +302,9 @@ jobs:
242302 - test_tier2_vm
243303 - verify_build
244304 - ctest_msrv
245- # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
305+ - docs
306+ - clippy
307+ # GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
246308 # failed" as success. So we have to do some contortions to ensure the job fails if any of its
247309 # dependencies fails.
248310 if : always() # make sure this is never "skipped"
0 commit comments