-
Notifications
You must be signed in to change notification settings - Fork 192
337 lines (322 loc) · 11 KB
/
tests.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
name: Tests
on:
push:
branches: master
pull_request:
branches: master
schedule:
- cron: "0 12 * * 1"
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"
jobs:
check-doc:
name: Docs, deadlinks, minimal dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly # Needed for -Z minimal-versions and doc_cfg
override: true
- uses: Swatinem/rust-cache@v1
- name: Install precompiled cargo-deadlinks
run: |
export URL=$(curl -s https://api.github.com/repos/deadlinks/cargo-deadlinks/releases/latest | jq -r '.assets[] | select(.name | contains("cargo-deadlinks-linux")) | .browser_download_url')
wget -O /tmp/cargo-deadlinks $URL
chmod +x /tmp/cargo-deadlinks
mv /tmp/cargo-deadlinks ~/.cargo/bin
- name: Generate Docs
env:
RUSTDOCFLAGS: --cfg docsrs
run: cargo deadlinks -- --features=custom,std
- run: |
cargo generate-lockfile -Z minimal-versions
cargo test --features=custom,std
main-tests:
name: Main tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
toolchain: [nightly, beta, stable, 1.34]
# Only Test macOS on stable to reduce macOS CI jobs
include:
- os: macos-latest
toolchain: stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- uses: Swatinem/rust-cache@v1
- run: cargo test
- run: cargo test --features=std
- run: cargo test --features=custom # custom should do nothing here
- if: ${{ matrix.toolchain == 'nightly' }}
run: cargo build --benches
linux-tests:
name: Additional Linux targets
runs-on: ubuntu-latest
strategy:
matrix:
target: [
x86_64-unknown-linux-musl,
i686-unknown-linux-gnu,
i686-unknown-linux-musl,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install multilib
# update is needed to fix the 404 error on install, see:
# https://github.com/actions/virtual-environments/issues/675
run: |
sudo apt-get update
sudo apt-get install gcc-multilib
- run: cargo test --target=${{ matrix.target }} --features=std
# We can only Build/Link on these targets for now.
# TODO: Run the iOS binaries in the simulator
# TODO: build/run aarch64-apple-darwin binaries on a x86_64 Mac
apple-tests:
name: Additional Apple targets
runs-on: macos-latest
strategy:
matrix:
target: [
aarch64-apple-ios,
x86_64-apple-ios,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Build Tests
run: cargo test --no-run --target=${{ matrix.target }} --features=std
windows-tests:
name: Additional Windows targets
runs-on: windows-latest
strategy:
matrix:
toolchain: [
stable-x86_64-gnu,
stable-i686-gnu,
stable-i686-msvc,
]
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- uses: Swatinem/rust-cache@v1
- run: cargo test --features=std
cross-tests:
name: Cross Test
runs-on: ubuntu-latest
strategy:
matrix:
target: [
aarch64-unknown-linux-gnu,
aarch64-linux-android,
mips-unknown-linux-gnu,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install precompiled cross
run: |
export URL=$(curl -s https://api.github.com/repos/rust-embedded/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url')
wget -O /tmp/binaries.tar.gz $URL
tar -C /tmp -xzf /tmp/binaries.tar.gz
mv /tmp/cross ~/.cargo/bin
- name: Test
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std
cross-link:
name: Cross Build/Link
runs-on: ubuntu-latest
strategy:
matrix:
target: [
sparcv9-sun-solaris,
x86_64-unknown-netbsd,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install precompiled cross
run: |
export URL=$(curl -s https://api.github.com/repos/rust-embedded/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url')
wget -O /tmp/binaries.tar.gz $URL
tar -C /tmp -xzf /tmp/binaries.tar.gz
mv /tmp/cross ~/.cargo/bin
- name: Build Tests
run: cross test --no-run --target=${{ matrix.target }} --features=std
web-tests:
name: Web tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install precompiled wasm-bindgen-test-runner
run: |
export VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select ( .name == "wasm-bindgen" ) | .version')
wget -O /tmp/binaries.tar.gz https://github.com/rustwasm/wasm-bindgen/releases/download/$VERSION/wasm-bindgen-$VERSION-x86_64-unknown-linux-musl.tar.gz
tar -C /tmp -xzf /tmp/binaries.tar.gz --strip-components=1
mv /tmp/wasm-bindgen-test-runner ~/.cargo/bin
- name: Test (Node)
run: cargo test --target=wasm32-unknown-unknown --features=js
- name: Test (Firefox)
env:
GECKODRIVER: /usr/bin/geckodriver
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
- name: Test (Chrome)
env:
CHROMEDRIVER: /usr/bin/chromedriver
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
- name: Test (custom getrandom)
run: cargo test --target=wasm32-unknown-unknown --features=custom
wasi-tests:
name: WASI test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-wasi
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install precompiled wasmtime
run: |
export URL=$(curl -s https://api.github.com/repos/bytecodealliance/wasmtime/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-linux.tar.xz")) | .browser_download_url')
wget -O /tmp/binaries.tar.xz $URL
tar -C /tmp -xf /tmp/binaries.tar.xz --strip-components=1
mv /tmp/wasmtime ~/.cargo/bin
- run: cargo test --target wasm32-wasi
emscripten-tests:
name: Emscripten tests
runs-on: ubuntu-latest
env:
EMSDK_VERSION: 1.39.20 # Last emsdk compatible with Rust's LLVM 11
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- run: rustup target add wasm32-unknown-emscripten
- run: rustup target add asmjs-unknown-emscripten
- uses: Swatinem/rust-cache@v1
- name: Cache emsdk
id: cache-emsdk
uses: actions/cache@v2
with:
path: ~/emsdk
key: ${{ runner.os }}-${{ env.EMSDK_VERSION }}-emsdk
- name: Install emsdk
if: steps.cache-emsdk.outputs.cache-hit != 'true'
run: |
git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
cd ~/emsdk
./emsdk install $EMSDK_VERSION
./emsdk activate $EMSDK_VERSION
- run: echo "$HOME/emsdk/upstream/emscripten" >> $GITHUB_PATH
- name: wasm test
run: cargo test --target=wasm32-unknown-emscripten --features=std
- name: asm.js test
run: | # Debug info breaks on asm.js
RUSTFLAGS="$RUSTFLAGS -C debuginfo=0"
cargo test --target=asmjs-unknown-emscripten --features=std
build:
name: Build only
runs-on: ubuntu-latest
strategy:
matrix:
target: [
x86_64-unknown-freebsd,
x86_64-fuchsia,
x86_64-unknown-redox,
x86_64-fortanix-unknown-sgx,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: nightly # Required to build libc for Redox
override: true
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo build --target=${{ matrix.target }} --features=std
build-std:
name: Build-only (build-std)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly # Required to build libcore
components: rust-src
override: true
- uses: Swatinem/rust-cache@v1
- name: UEFI (RDRAND)
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-uefi
- name: Hermit (RDRAND)
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-hermit
- name: L4Re (RDRAND)
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-l4re-uclibc
- name: VxWorks
run: cargo build -Z build-std=core --target=x86_64-wrs-vxworks
- name: SOLID
run: cargo build -Z build-std=core --target=aarch64-kmc-solid_asp3
clippy-fmt:
name: Clippy + rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
# https://github.com/rust-lang/rust-clippy/pull/6379 added MSRV
# support, so we need to use nightly until this is on stable.
toolchain: nightly
components: rustfmt, clippy
override: true
- uses: Swatinem/rust-cache@v1
- name: clippy
run: cargo clippy --all --features=custom,std
- name: fmt
run: cargo fmt --all -- --check