-
Notifications
You must be signed in to change notification settings - Fork 31
393 lines (362 loc) · 13.1 KB
/
main.yml
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
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: stable
- run: cargo fmt --all -- --check
check_cross:
name: Check Cross-Compilation
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [stable, beta]
include:
- build: stable
os: ubuntu-latest
rust: stable
- build: beta
os: ubuntu-latest
rust: beta
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- name: Install musl-tools
run: |
set -ex
sudo apt-get update
sudo apt-get install -y musl-tools
# Disable x86_64-pc-windows-msvc, x86_64-pc-windows-gnu,
# i686-pc-windows-msvc, and i686-pc-windows-gnu for now, since async-std
# doesn't currently support cross-compiling to Windows.
#
# Also disable x86_64-fuchsia and wasm32-unknown-emscripten, since
# async-std doesn't currently cross-compile on them.
- run: >
rustup target add
x86_64-unknown-linux-musl
x86_64-unknown-linux-gnux32
x86_64-linux-android
x86_64-apple-darwin
x86_64-unknown-freebsd
x86_64-unknown-netbsd
i686-unknown-linux-gnu
i686-unknown-linux-musl
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=x86_64-unknown-linux-musl
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=x86_64-unknown-linux-gnux32
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=x86_64-linux-android
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=x86_64-apple-darwin
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=x86_64-unknown-freebsd
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=x86_64-unknown-netbsd
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=i686-unknown-linux-gnu
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=i686-unknown-linux-musl
check_cross_windows:
name: Check Cross-Compilation on Windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [stable, beta]
include:
- build: stable
os: windows-latest
rust: stable
- build: beta
os: windows-latest
rust: beta
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- run: >
rustup target add
x86_64-pc-windows-gnu
i686-pc-windows-msvc
i686-pc-windows-gnu
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=x86_64-pc-windows-gnu
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=i686-pc-windows-msvc
- run: cargo check --workspace --bins --examples --tests --features=fs_utf8 --release -vv --target=i686-pc-windows-gnu
check_cross_nightly:
name: Check Cross-Compilation on Rust nightly
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [nightly]
include:
- build: nightly
os: ubuntu-latest
rust: nightly
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- name: Install musl-tools
run: |
set -ex
sudo apt-get update
sudo apt-get install -y musl-tools
# Disable x86_64-pc-windows-msvc, x86_64-pc-windows-gnu,
# i686-pc-windows-msvc, i686-pc-windows-gnu for now, and
# aarch64-pc-windows-msvc, since async-std doesn't currently support
# cross-compiling to Windows.
#
# Also disable x86_64-fuchsia and wasm32-unknown-emscripten, since
# async-std doesn't currently cross-compile on them.
- run: >
rustup target add
x86_64-unknown-linux-musl
x86_64-unknown-linux-gnux32
x86_64-linux-android
x86_64-apple-darwin
x86_64-unknown-freebsd
x86_64-unknown-netbsd
i686-unknown-linux-gnu
i686-unknown-linux-musl
aarch64-apple-darwin
riscv64gc-unknown-linux-gnu
arm-unknown-linux-gnueabihf
aarch64-linux-android
wasm32-wasi
- run: cargo check --workspace --all-targets --all-features --release -vv
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-unknown-linux-musl
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-unknown-linux-gnux32
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-linux-android
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-apple-darwin
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-unknown-freebsd
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-unknown-netbsd
- run: cargo check --workspace --all-targets --all-features --release -vv --target=i686-unknown-linux-gnu
- run: cargo check --workspace --all-targets --all-features --release -vv --target=i686-unknown-linux-musl
- run: cargo check --workspace --all-targets --all-features --release -vv --target=aarch64-apple-darwin
- run: cargo check --workspace --all-targets --all-features --release -vv --target=riscv64gc-unknown-linux-gnu
- run: cargo check --workspace --all-targets --all-features --release -vv --target=arm-unknown-linux-gnueabihf
- run: cargo check --workspace --all-targets --all-features --release -vv --target=aarch64-linux-android
- run: cd cap-std && cargo check --features=fs_utf8 --release -vv --target=wasm32-wasi
check_cross_nightly_windows:
name: Check Cross-Compilation on Rust nightly on Windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [nightly]
include:
- build: nightly
os: windows-latest
rust: nightly
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- run: >
rustup target add
x86_64-pc-windows-gnu
i686-pc-windows-msvc
i686-pc-windows-gnu
aarch64-pc-windows-msvc
- run: cargo check --workspace --all-targets --all-features --release -vv
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-pc-windows-gnu
- run: cargo check --workspace --all-targets --all-features --release -vv --target=i686-pc-windows-msvc
- run: cargo check --workspace --all-targets --all-features --release -vv --target=i686-pc-windows-gnu
- run: cargo check --workspace --all-targets --all-features --release -vv --target=aarch64-pc-windows-msvc
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [stable, windows-latest, windows-2019, macos-latest, macos-12, beta, ubuntu-20.04, aarch64-ubuntu]
include:
- build: stable
os: ubuntu-latest
rust: stable
- build: windows-latest
os: windows-latest
rust: stable
- build: windows-2019
os: windows-2019
rust: stable
- build: macos-latest
os: macos-latest
rust: stable
- build: macos-12
os: macos-12
rust: stable
- build: beta
os: ubuntu-latest
rust: beta
- build: ubuntu-20.04
os: ubuntu-20.04
rust: stable
- build: aarch64-ubuntu
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
gcc_package: gcc-aarch64-linux-gnu
gcc: aarch64-linux-gnu-gcc
qemu: qemu-aarch64 -L /usr/aarch64-linux-gnu
qemu_target: aarch64-linux-user
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- name: Install cross-compilation tools
run: |
set -ex
sudo apt-get update
sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build
# Download and build qemu from source since the most recent release is
# way faster at arm emulation than the current version github actions'
# ubuntu image uses. Disable as much as we can to get it to build
# quickly.
curl https://download.qemu.org/qemu-6.1.0.tar.xz | tar xJf -
cd qemu-6.1.0
./configure --target-list=${{ matrix.qemu_target }} --prefix=$HOME/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs
make -j$(nproc) install
# Configure Cargo for cross compilation and tell it how it can run
# cross executables
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
echo CARGO_TARGET_${upcase}_RUNNER=$HOME/qemu/bin/${{ matrix.qemu }} >> $GITHUB_ENV
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV
if: matrix.qemu != '' && matrix.os == 'ubuntu-latest'
- name: Native testing
run: cargo test --features fs_utf8 --workspace
env:
RUST_BACKTRACE: 1
if: matrix.target == ''
- name: Cross testing
run: |
rustup target add ${{ matrix.target }}
cargo test --features fs_utf8 --workspace --target=${{ matrix.target }}
env:
RUST_BACKTRACE: 1
if: matrix.target != ''
test_nightly:
name: Test with Rust nightly
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [ubuntu, windows]
include:
- build: ubuntu
os: ubuntu-latest
rust: nightly
- build: windows
os: windows-latest
rust: nightly
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- run: cargo test --all-features --workspace
test_musl:
name: Test on Musl
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [ubuntu]
include:
- build: ubuntu
os: ubuntu-latest
rust: stable
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- name: Install musl-tools
run: |
set -ex
sudo apt-get update
sudo apt-get install -y musl-tools
- run: rustup target add x86_64-unknown-linux-musl
- run: cargo test --target x86_64-unknown-linux-musl --features fs_utf8 --workspace
test_linux_raw:
name: Test linux-raw support
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [ubuntu, ubuntu-20.04]
include:
- build: ubuntu
os: ubuntu-latest
rust: nightly
- build: ubuntu-20.04
os: ubuntu-20.04
rust: nightly
env:
RUSTFLAGS: --cfg linux_raw
RUSTDOCFLAGS: --cfg linux_raw
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- run: cargo test --all-features --workspace
test_msrv:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [msrv]
include:
- build: msrv
os: ubuntu-latest
rust: 1.63
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
# Don't use --all-features because some of the features have dependencies
# that don't work on newer Rust versions.
- run: cargo test --workspace --features=fs_utf8,arf_strings
env:
RUST_BACKTRACE: 1
fuzz_targets:
name: Fuzz Targets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: nightly
- run: cargo install cargo-fuzz --vers "^0.11"
- run: cargo fetch
working-directory: ./fuzz
- run: cargo fuzz build --dev