Skip to content

Commit 43149ab

Browse files
committed
Update CI
- Cleanup `tests.yml` - Add better binary downloads - Add minimal dependancies check - Add tests for `custom` feature - Build/Link for iOS - Run cross tests on aarch64 linux and Android - Link on Solaris and Netbsd - Test wasm code on Node, Chrome, Firefox - Test WASI - No need for RDRAND feature on VxWorks Signed-off-by: Joe Richey <[email protected]>
1 parent 6e8f91f commit 43149ab

File tree

1 file changed

+147
-50
lines changed

1 file changed

+147
-50
lines changed

.github/workflows/tests.yml

+147-50
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,25 @@ env:
1414

1515
jobs:
1616
check-doc:
17-
name: Doc deadlinks
17+
name: Docs, deadlinks, minimal dependencies
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v2
21-
- name: Install toolchain
22-
uses: actions-rs/toolchain@v1
21+
- uses: actions-rs/toolchain@v1
2322
with:
2423
profile: minimal
25-
toolchain: nightly
24+
toolchain: nightly # Needed for -Z minimal-versions
2625
override: true
27-
- run: cargo install cargo-deadlinks
28-
- run: cargo deadlinks -- --features custom
26+
- name: Install deadlinks
27+
run: |
28+
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')
29+
wget -O /tmp/cargo-deadlinks $URL
30+
chmod +x /tmp/cargo-deadlinks
31+
mv /tmp/cargo-deadlinks ~/.cargo/bin
32+
- run: cargo deadlinks -- --features=custom,std
33+
- run: |
34+
cargo generate-lockfile -Z minimal-versions
35+
cargo test --features=custom,std
2936
3037
main-tests:
3138
name: Main tests
@@ -36,14 +43,14 @@ jobs:
3643
toolchain: [nightly, beta, stable, 1.34]
3744
steps:
3845
- uses: actions/checkout@v2
39-
- name: Install toolchain
40-
uses: actions-rs/toolchain@v1
46+
- uses: actions-rs/toolchain@v1
4147
with:
4248
profile: minimal
4349
toolchain: ${{ matrix.toolchain }}
4450
override: true
4551
- run: cargo test
46-
- run: cargo test --features std
52+
- run: cargo test --features=std
53+
- run: cargo test --features=custom
4754
- if: ${{ matrix.toolchain == 'nightly' }}
4855
run: cargo build --benches
4956

@@ -59,18 +66,40 @@ jobs:
5966
]
6067
steps:
6168
- uses: actions/checkout@v2
62-
- name: Install toolchain
63-
uses: actions-rs/toolchain@v1
69+
- uses: actions-rs/toolchain@v1
6470
with:
6571
profile: minimal
6672
target: ${{ matrix.target }}
6773
toolchain: stable
68-
override: true
69-
# update is needed to fix the 404 error on install, see:
70-
# https://github.com/actions/virtual-environments/issues/675
71-
- run: sudo apt-get update
72-
- run: sudo apt-get install gcc-multilib
73-
- run: cargo test --target ${{ matrix.target }}
74+
- name: Install multilib
75+
# update is needed to fix the 404 error on install, see:
76+
# https://github.com/actions/virtual-environments/issues/675
77+
run: |
78+
sudo apt-get update
79+
sudo apt-get install gcc-multilib
80+
- run: cargo test --target=${{ matrix.target }} --features=std
81+
82+
# We can only Build/Link on these targets for now.
83+
# TODO: Run the iOS binaries in the simulator
84+
# TODO: build/run aarch64-apple-darwin binaries on a x86_64 Mac
85+
apple-tests:
86+
name: Additional Apple targets
87+
runs-on: macos-latest
88+
strategy:
89+
matrix:
90+
target: [
91+
aarch64-apple-ios,
92+
x86_64-apple-ios,
93+
]
94+
steps:
95+
- uses: actions/checkout@v2
96+
- uses: actions-rs/toolchain@v1
97+
with:
98+
profile: minimal
99+
target: ${{ matrix.target }}
100+
toolchain: stable
101+
- name: Build Tests
102+
run: cargo test --no-run --target=${{ matrix.target }} --features=std
74103

75104
windows-tests:
76105
name: Additional Windows targets
@@ -90,81 +119,149 @@ jobs:
90119
profile: minimal
91120
toolchain: ${{ matrix.toolchain }}
92121
override: true
93-
- run: cargo test
122+
- run: cargo test --features=std
94123

124+
# TODO: Add emscripten when it's working with Cross
95125
cross-tests:
96-
name: Cross tests
97-
runs-on: ${{ matrix.os }}
126+
name: Cross Test
127+
runs-on: ubuntu-latest
98128
strategy:
99129
matrix:
100-
include:
101-
- os: ubuntu-latest
102-
target: mips-unknown-linux-gnu
103-
toolchain: stable
130+
target: [
131+
aarch64-unknown-linux-gnu,
132+
aarch64-linux-android,
133+
mips-unknown-linux-gnu,
134+
]
104135
steps:
105136
- uses: actions/checkout@v2
106-
- name: Install toolchain
107-
uses: actions-rs/toolchain@v1
137+
- uses: actions-rs/toolchain@v1
108138
with:
109139
profile: minimal
110140
target: ${{ matrix.target }}
111-
toolchain: ${{ matrix.toolchain }}
112-
override: true
113-
- name: Cache cargo plugins
114-
uses: actions/cache@v1
115-
with:
116-
path: ~/.cargo/bin/
117-
key: ${{ runner.os }}-cargo-plugins
141+
toolchain: stable
118142
- name: Install cross
119-
run: cargo install cross || true
143+
run: |
144+
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')
145+
wget -O /tmp/binaries.tar.gz $URL
146+
tar -C /tmp -xzf /tmp/binaries.tar.gz
147+
mv /tmp/cross ~/.cargo/bin
120148
- name: Test
121-
run: cross test --no-fail-fast --target ${{ matrix.target }}
149+
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std
122150

123-
build:
124-
name: Build-only
151+
cross-link:
152+
name: Cross Build/Link
125153
runs-on: ubuntu-latest
126154
strategy:
127155
matrix:
128156
target: [
129157
x86_64-sun-solaris,
158+
x86_64-unknown-netbsd,
159+
]
160+
steps:
161+
- uses: actions/checkout@v2
162+
- uses: actions-rs/toolchain@v1
163+
with:
164+
profile: minimal
165+
target: ${{ matrix.target }}
166+
toolchain: stable
167+
- name: Install cross
168+
run: |
169+
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')
170+
wget -O /tmp/binaries.tar.gz $URL
171+
tar -C /tmp -xzf /tmp/binaries.tar.gz
172+
mv /tmp/cross ~/.cargo/bin
173+
- name: Build Tests
174+
run: cross test --no-run --target=${{ matrix.target }} --features=std
175+
176+
web-tests:
177+
name: Web tests
178+
runs-on: ubuntu-latest
179+
steps:
180+
- uses: actions/checkout@v2
181+
- uses: actions-rs/toolchain@v1
182+
with:
183+
profile: minimal
184+
target: wasm32-unknown-unknown
185+
toolchain: stable
186+
- name: Install wasm-bindgen-test-runner
187+
run: |
188+
export VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select ( .name == "wasm-bindgen" ) | .version')
189+
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
190+
tar -C /tmp -xzf /tmp/binaries.tar.gz --strip-components=1
191+
mv /tmp/wasm-bindgen-test-runner ~/.cargo/bin
192+
- name: Test (Node)
193+
run: cargo test --target=wasm32-unknown-unknown --features=js
194+
- name: Test (Firefox)
195+
env:
196+
GECKODRIVER: /usr/bin/geckodriver
197+
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
198+
- name: Test (Chrome)
199+
env:
200+
CHROMEDRIVER: /usr/bin/chromedriver
201+
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
202+
- name: Build Tests (with custom, without JS)
203+
run: cargo test --no-run --target=wasm32-unknown-unknown --features=custom
204+
205+
wasi-tests:
206+
name: WASI test
207+
runs-on: ubuntu-latest
208+
steps:
209+
- uses: actions/checkout@v2
210+
- uses: actions-rs/toolchain@v1
211+
with:
212+
profile: minimal
213+
target: wasm32-wasi
214+
toolchain: stable
215+
- name: Install wasmtime
216+
run: |
217+
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')
218+
wget -O /tmp/binaries.tar.xz $URL
219+
tar -C /tmp -xf /tmp/binaries.tar.xz --strip-components=1
220+
mv /tmp/wasmtime ~/.cargo/bin
221+
- run: cargo test --target wasm32-wasi
222+
223+
build:
224+
name: Build only
225+
runs-on: ubuntu-latest
226+
strategy:
227+
matrix:
228+
target: [
130229
x86_64-unknown-freebsd,
131230
x86_64-fuchsia,
132-
x86_64-unknown-netbsd,
133231
x86_64-unknown-redox,
134232
x86_64-fortanix-unknown-sgx,
135233
]
136234
steps:
137235
- uses: actions/checkout@v2
138-
- name: Install toolchain
139-
uses: actions-rs/toolchain@v1
236+
- uses: actions-rs/toolchain@v1
140237
with:
141238
profile: minimal
142239
target: ${{ matrix.target }}
143-
toolchain: nightly
240+
toolchain: nightly # Required to build libc for Redox
144241
override: true
145242
- name: Build
146-
run: cargo build --target ${{ matrix.target }}
243+
run: cargo build --target=${{ matrix.target }} --features=std
147244

148-
build-rdrand:
149-
name: Build-only RDRAND
245+
build-std:
246+
name: Build-only (build-std)
150247
runs-on: ubuntu-latest
151248
steps:
152249
- uses: actions/checkout@v2
153250
- name: Install toolchain
154251
uses: actions-rs/toolchain@v1
155252
with:
156253
profile: minimal
157-
toolchain: nightly
254+
toolchain: nightly # Required to build libcore
158255
components: rust-src
159256
override: true
160-
- name: UEFI
257+
- name: UEFI (RDRAND)
161258
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-uefi
162-
- name: Hermit
259+
- name: Hermit (RDRAND)
163260
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-hermit
164-
- name: L4Re
261+
- name: L4Re (RDRAND)
165262
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-l4re-uclibc
166263
- name: VxWorks
167-
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-wrs-vxworks
264+
run: cargo build -Z build-std=core --target=x86_64-wrs-vxworks
168265

169266
clippy-fmt:
170267
name: Clippy + rustfmt
@@ -180,6 +277,6 @@ jobs:
180277
components: rustfmt, clippy
181278
override: true
182279
- name: clippy
183-
run: cargo clippy --all
280+
run: cargo clippy --all --features=custom,std
184281
- name: fmt
185282
run: cargo fmt --all -- --check

0 commit comments

Comments
 (0)