Repository navigation
436 lines (407 loc) · 16.8 KB
/
Copy pathci.yml
File metadata and controls
436 lines (407 loc) · 16.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
name: CI
on:
push:
branches: ['main']
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '.cargo/**'
- 'rust-toolchain.toml'
- '.github/workflows/ci.yml'
pull_request:
branches: ['**']
merge_group:
types: [checks_requested]
# Scheduled run ensures that we don't go too long without a cache when things outside our control
# change. e.g. the MacOS ImageVersion.
schedule:
- cron: '23 18 * * *'
workflow_dispatch:
permissions:
packages: read
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: '-D warnings'
jobs:
test-nightly:
name: Test Linux (${{ matrix.container }})
strategy:
matrix:
include:
- runs-on: ubuntu-24.04
container: ci-ubuntu-cross-amd64
cross: all
features: coff
test-timeout: 60 # Wine can take a while to initialise
- runs-on: ubuntu-24.04
container: ci-arch-cross-amd64
cross: aarch64,riscv64
- runs-on: ubuntu-24.04-arm
container: ci-ubuntu-arm64
- runs-on: ubuntu-24.04
container: ci-alpine-amd64
- runs-on: ubuntu-24.04
container: ci-opensuse-amd64
- runs-on: ubuntu-24.04-arm
container: ci-opensuse-arm64
fail-fast: false
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 10
container:
# Note: when updating this image hash, update the other occurrences in this file too.
image: ghcr.io/wild-linker/wild/${{ matrix.container }}:sha-73d1e446536b3ab6dbdff2d21887f2bd3f977258
steps:
# https://github.com/actions/runner/issues/3210
- run: echo "$PATH" >> "$GITHUB_PATH"
if: ${{ contains(matrix.container, 'opensuse') }}
- run: echo "WILD_TEST_CONFIG=test-config-ci.toml" >> $GITHUB_ENV
- run: echo "WILD_TEST_CROSS=${{ matrix.cross }}" >> $GITHUB_ENV
if: ${{ contains(matrix.container, '-cross') }}
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- uses: wild-linker/action@latest
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
key: ${{ runner.os }}-${{ matrix.container }}-${{ matrix.runs-on }}
- run: cargo build --profile ci --workspace --no-default-features
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
- run: WILD_TEST_CROSS=$WILD_TEST_CROSS cargo test --profile ci --workspace --features '${{ matrix.features }}' -- --skip wasm/
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
env:
WILD_TEST_TIMEOUT: ${{ matrix.test-timeout || 10 }}
external-tests:
name: Test Linux (external tests)
runs-on: ubuntu-24.04
timeout-minutes: 10
container:
image: "ghcr.io/wild-linker/wild/ci-ubuntu-cross-amd64:sha-73d1e446536b3ab6dbdff2d21887f2bd3f977258"
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
submodules: recursive
- run: rm rust-toolchain.toml
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: echo "WILD_TEST_CONFIG=test-config-ci.toml" >> $GITHUB_ENV
- name: Check regressions
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
run: WILD_TEST_CROSS=all cargo test --features external_tests external_test_suites -- --skip expect_failure
- name: Check tests that should fail still fail
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
run: WILD_TEST_CROSS=all cargo test --features external_tests expect_failure
linux-cross-build:
name: Build Linux (${{ matrix.arch }})
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- arch: RISC-V
target: riscv64gc-unknown-linux-gnu
config: .cargo/config.toml.cross-riscv
- arch: LoongArch64
target: loongarch64-unknown-linux-gnu
config: .cargo/config.toml.cross-loongarch64
- arch: PPC64LE
target: powerpc64le-unknown-linux-gnu
config: .cargo/config.toml.cross-ppc64le
container:
image: ghcr.io/wild-linker/wild/ci-ubuntu-cross-amd64:sha-73d1e446536b3ab6dbdff2d21887f2bd3f977258
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- uses: dtolnay/rust-toolchain@1.99.1
id: rust-toolchain
with:
targets: ${{ matrix.target }}
- run: cp -f ${{ matrix.config }} .cargo/config.toml
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
key: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
wasip1-build:
name: Build wasip1
runs-on: ubuntu-24.04
timeout-minutes: 10
container:
image: ghcr.io/wild-linker/wild/ci-ubuntu-wasm-amd64:sha-73d1e446536b3ab6dbdff2d21887f2bd3f977258
steps:
- name: Setup Wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: '48.0.0'
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- uses: dtolnay/rust-toolchain@1.99.1
id: rust-toolchain
with:
targets: wasm32-wasip1
- run: cp -f .cargo/config.toml.cross-wasm32p1 .cargo/config.toml
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build and run the WASI linker
run: |
cargo build --target wasm32-wasip1
wild=$(realpath target/wasm32-wasip1/debug/wild.wasm)
wasmtime run "$wild" --version
smoke=$(mktemp -d)
clang -c wild/tests/sources/elf/chroot/entry.s -o "$smoke/entry.o"
cd "$smoke"
wasmtime run --dir=. "$wild" -m elf_x86_64 --no-threads -static -o smoke entry.o
chmod +x smoke
status=0
./smoke || status=$?
test "$status" -eq 42
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
# -p libwild prevents integration tests from running. they depend on
# spawning processes, which isn't supported on wasi.
- run: cargo test --profile ci -p libwild --target wasm32-wasip1
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
wasm-test:
name: Test Wasm
runs-on: ubuntu-24.04
timeout-minutes: 10
container:
image: ghcr.io/wild-linker/wild/ci-ubuntu-wasm-amd64:sha-73d1e446536b3ab6dbdff2d21887f2bd3f977258
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- uses: dtolnay/rust-toolchain@1.99.1
id: rust-toolchain
with:
targets: wasm32-wasip1
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: taiki-e/install-action@v2.90.5
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
with:
tool: wasm-tools
- name: Setup Wasmtime
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: '48.0.0'
- run: cargo test --features wasm -- wasm
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
macho-test:
name: Test Mach-O (AArch64)
runs-on: macos-latest
timeout-minutes: 10
env:
WILD_TEST_IGNORE_FORMAT: "1" # Checked by other jobs
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- uses: dtolnay/rust-toolchain@1.99.1
id: rust-toolchain
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
env-vars: ImageVersion
- run: brew install lld
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
- run: clang --version
- run: echo "WILD_TEST_CONFIG=test-config-ci.toml" >> $GITHUB_ENV
- run: cargo build --profile ci --workspace --no-default-features
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
- run: cargo test --profile ci --workspace --features macho -- --skip wasm/
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
windows-build:
name: Build Windows (x86_64)
runs-on: windows-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- uses: dtolnay/rust-toolchain@1.99.1
id: rust-toolchain
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo build --profile ci --workspace --no-default-features
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
minimal-versions:
runs-on: ubuntu-24.04
timeout-minutes: 10
container:
image: ghcr.io/wild-linker/wild/ci-ubuntu-amd64:sha-73d1e446536b3ab6dbdff2d21887f2bd3f977258
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- uses: dtolnay/rust-toolchain@1.99.1
id: rust-toolchain
- uses: taiki-e/install-action@v2.90.5
with:
tool: cargo-hack,cargo-minimal-versions,taplo
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo minimal-versions --direct test --profile ci -- --skip wasm/
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
clippy:
name: Clippy
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
# This is where we check that we're not using features from a more recent rust version. When
# updating this, please also update workspace.package.rust-version in `Cargo.toml`.
- uses: dtolnay/rust-toolchain@1.99.1
id: rust-toolchain
with:
components: clippy
- uses: wild-linker/action@latest
- uses: Swatinem/rust-cache@v2
id: rust-cache
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo clippy --all-targets --workspace --target x86_64-unknown-linux-gnu
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
- run: cargo clippy --all-targets --workspace --target x86_64-unknown-linux-gnu --no-default-features
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || steps.rust-cache.outputs.cache-hit != 'true'
cargo-deny:
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
name: Cargo deny
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
dependency_cooldown:
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
name: Dependency cooldown
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
- run: cp -f .cargo/config.toml.publish-age .cargo/config.toml
- name: Check for eligible dependency updates
run: cargo +nightly update
rustfmt:
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
name: Check formatting
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: rm rust-toolchain.toml
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
yamlfmt:
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
name: yamlfmt
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-go@v7
with:
go-version: '1.26.0'
cache: false
- run: go install github.com/google/yamlfmt/cmd/yamlfmt@v0.21.0
- run: echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- run: yamlfmt -lint .
spelling:
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
name: Spell Check with Typos
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Spell Check Repo
uses: crate-ci/typos@v1.52.2
nix-checks:
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
include:
- check: wild
targets: .#checks.x86_64-linux.wild
- check: adapters
targets: .#checks.x86_64-linux.adapterGcc .#checks.x86_64-linux.adapter-llvm
runs-on: ubuntu-24.04
timeout-minutes: 15
name: Nix/${{ matrix.check }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v35
- name: Restore Nix store
uses: nix-community/cache-nix-action/restore@v7
id: cache
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', 'Cargo.lock', '**/Cargo.toml', '**/*.nix', '.cargo/config.toml', '.github/workflows/nix.yml') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
- name: Run ${{ matrix.check }}
run: |
read -r -a targets <<< "$NIX_TARGETS"
nix build "${targets[@]}" -L --show-trace
env:
NIX_TARGETS: ${{ matrix.targets }}
reuse-check:
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0
submodules: recursive
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v6