29
29
- name : Check style
30
30
run : ./ci/style.sh
31
31
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
+
32
48
# This runs `cargo build --target ...` for all T1 and T2 targets`
33
49
verify_build :
34
50
name : Verify build
76
92
- target : i686-unknown-linux-gnu
77
93
docker : true
78
94
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
79
101
- target : x86_64-unknown-linux-gnu
80
102
docker : true
81
103
os : ubuntu-24.04
@@ -107,6 +129,13 @@ jobs:
107
129
with :
108
130
key : ${{ matrix.target }}
109
131
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
+
110
139
- name : Run natively
111
140
if : " !matrix.docker"
112
141
run : ./ci/run.sh ${{ matrix.target }}
@@ -115,11 +144,13 @@ jobs:
115
144
run : ./ci/run-docker.sh ${{ matrix.target }}
116
145
117
146
- name : Create CI artifacts
147
+ id : create_artifacts
118
148
if : always()
119
149
run : ./ci/create-artifacts.py
120
150
- uses : actions/upload-artifact@v4
151
+ if : always() && steps.create_artifacts.outcome == 'success'
121
152
with :
122
- name : ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}
153
+ name : ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}${{ matrix.artifact-tag && format('-{0}', matrix.artifact-tag) }}
123
154
path : ${{ env.ARCHIVE_PATH }}
124
155
retention-days : 5
125
156
@@ -139,15 +170,11 @@ jobs:
139
170
- aarch64-unknown-linux-gnu
140
171
- aarch64-unknown-linux-musl
141
172
- arm-linux-androideabi
142
- - arm-unknown-linux-gnueabihf
143
173
- arm-unknown-linux-musleabihf
144
174
- i686-linux-android
145
175
- i686-unknown-linux-musl
146
176
- loongarch64-unknown-linux-gnu
147
177
- 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
151
178
- powerpc64-unknown-linux-gnu
152
179
- powerpc64le-unknown-linux-gnu
153
180
- riscv64gc-unknown-linux-gnu
@@ -162,6 +189,19 @@ jobs:
162
189
# FIXME: It seems some items in `src/unix/mod.rs`
163
190
# aren't defined on redox actually.
164
191
# - 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
165
205
timeout-minutes : 25
166
206
env :
167
207
TARGET : ${{ matrix.target }}
@@ -173,15 +213,24 @@ jobs:
173
213
with :
174
214
key : ${{ matrix.target }}
175
215
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
+
176
223
- name : Execute run-docker.sh
177
224
run : ./ci/run-docker.sh ${{ matrix.target }}
178
225
179
226
- name : Create CI artifacts
227
+ id : create_artifacts
180
228
if : always()
181
229
run : ./ci/create-artifacts.py
182
230
- uses : actions/upload-artifact@v4
231
+ if : always() && steps.create_artifacts.outcome == 'success'
183
232
with :
184
- name : ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}
233
+ name : ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}${{ matrix.artifact-tag && format('-{0}', matrix.artifact-tag) }}
185
234
path : ${{ env.ARCHIVE_PATH }}
186
235
retention-days : 5
187
236
@@ -222,14 +271,25 @@ jobs:
222
271
steps :
223
272
- uses : actions/checkout@master
224
273
- 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' )"
226
275
echo "MSRV: $msrv"
227
276
echo "MSRV=$msrv" >> "$GITHUB_ENV"
228
277
- name : Install Rust
229
278
run : rustup update "$MSRV" --no-self-update && rustup default "$MSRV"
230
279
- uses : Swatinem/rust-cache@v2
231
280
- run : cargo build -p ctest
232
281
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
+
233
293
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
234
294
# protection, rather than having to add each job separately.
235
295
success :
@@ -242,7 +302,9 @@ jobs:
242
302
- test_tier2_vm
243
303
- verify_build
244
304
- 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
246
308
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
247
309
# dependencies fails.
248
310
if : always() # make sure this is never "skipped"
0 commit comments