Skip to content

Commit 4aace46

Browse files
committed
Update 0.1 branch to use Github actions
Also update the badges in the README Signed-off-by: Joe Richey <[email protected]>
1 parent bd14b7a commit 4aace46

File tree

5 files changed

+296
-292
lines changed

5 files changed

+296
-292
lines changed

.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
msrv = "1.32"

.github/workflows/tests.yml

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: 0.1
6+
pull_request:
7+
branches: 0.1
8+
schedule:
9+
- cron: "0 12 * * 1"
10+
11+
env:
12+
CARGO_INCREMENTAL: 0
13+
RUSTFLAGS: "-Dwarnings"
14+
15+
jobs:
16+
check-doc:
17+
name: Docs, deadlinks, minimal dependencies
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- uses: actions-rs/toolchain@v1
22+
with:
23+
profile: minimal
24+
toolchain: nightly # Needed for -Z minimal-versions
25+
override: true
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=log,std
33+
- run: |
34+
cargo generate-lockfile -Z minimal-versions
35+
cargo test --features=log,std
36+
37+
main-tests:
38+
name: Main tests
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest, macos-latest, windows-latest]
43+
toolchain: [nightly, beta, stable, 1.34]
44+
steps:
45+
- uses: actions/checkout@v2
46+
- uses: actions-rs/toolchain@v1
47+
with:
48+
profile: minimal
49+
toolchain: ${{ matrix.toolchain }}
50+
override: true
51+
- run: cargo test
52+
- run: cargo test --features=std
53+
- run: cargo test --features=log
54+
- if: ${{ matrix.toolchain == 'nightly' }}
55+
run: cargo build --benches
56+
57+
linux-tests:
58+
name: Additional Linux targets
59+
runs-on: ubuntu-latest
60+
strategy:
61+
matrix:
62+
target: [
63+
x86_64-unknown-linux-musl,
64+
i686-unknown-linux-gnu,
65+
i686-unknown-linux-musl,
66+
]
67+
steps:
68+
- uses: actions/checkout@v2
69+
- uses: actions-rs/toolchain@v1
70+
with:
71+
profile: minimal
72+
target: ${{ matrix.target }}
73+
toolchain: stable
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
103+
104+
windows-tests:
105+
name: Additional Windows targets
106+
runs-on: windows-latest
107+
strategy:
108+
matrix:
109+
toolchain: [
110+
stable-x86_64-gnu,
111+
stable-i686-gnu,
112+
stable-i686-msvc,
113+
]
114+
steps:
115+
- uses: actions/checkout@v2
116+
- name: Install toolchain
117+
uses: actions-rs/toolchain@v1
118+
with:
119+
profile: minimal
120+
toolchain: ${{ matrix.toolchain }}
121+
override: true
122+
- run: cargo test --features=std
123+
124+
# TODO: Add emscripten when it's working with Cross
125+
cross-tests:
126+
name: Cross Test
127+
runs-on: ubuntu-latest
128+
strategy:
129+
matrix:
130+
target: [
131+
aarch64-unknown-linux-gnu,
132+
aarch64-linux-android,
133+
mips-unknown-linux-gnu,
134+
]
135+
steps:
136+
- uses: actions/checkout@v2
137+
- uses: actions-rs/toolchain@v1
138+
with:
139+
profile: minimal
140+
target: ${{ matrix.target }}
141+
toolchain: stable
142+
- name: Install cross
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
148+
- name: Test
149+
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std
150+
151+
cross-link:
152+
name: Cross Build/Link
153+
runs-on: ubuntu-latest
154+
strategy:
155+
matrix:
156+
target: [
157+
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=wasm-bindgen
194+
- name: Test (Firefox)
195+
env:
196+
GECKODRIVER: /usr/bin/geckodriver
197+
run: cargo test --target=wasm32-unknown-unknown --features=test-in-browser
198+
- name: Test (Chrome)
199+
env:
200+
CHROMEDRIVER: /usr/bin/chromedriver
201+
run: cargo test --target=wasm32-unknown-unknown --features=test-in-browser
202+
- name: Build Tests (with dummy, without JS)
203+
run: cargo test --no-run --target=wasm32-unknown-unknown --features=dummy
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: [
229+
x86_64-unknown-freebsd,
230+
x86_64-fuchsia,
231+
x86_64-unknown-redox,
232+
x86_64-fortanix-unknown-sgx,
233+
]
234+
steps:
235+
- uses: actions/checkout@v2
236+
- uses: actions-rs/toolchain@v1
237+
with:
238+
profile: minimal
239+
target: ${{ matrix.target }}
240+
toolchain: nightly # Required to build libc for Redox
241+
override: true
242+
- name: Build
243+
run: cargo build --target=${{ matrix.target }} --features=std
244+
245+
build-std:
246+
name: Build-only (build-std)
247+
runs-on: ubuntu-latest
248+
steps:
249+
- uses: actions/checkout@v2
250+
- name: Install toolchain
251+
uses: actions-rs/toolchain@v1
252+
with:
253+
profile: minimal
254+
toolchain: nightly # Required to build libcore
255+
components: rust-src
256+
override: true
257+
- name: UEFI (RDRAND)
258+
run: cargo build -Z build-std=core --target=x86_64-unknown-uefi
259+
- name: Hermit (RDRAND)
260+
run: cargo build -Z build-std=core --target=x86_64-unknown-hermit
261+
- name: L4Re (RDRAND)
262+
run: cargo build -Z build-std=core --target=x86_64-unknown-l4re-uclibc
263+
- name: VxWorks
264+
run: cargo build -Z build-std=core --target=x86_64-wrs-vxworks
265+
266+
clippy-fmt:
267+
name: Clippy + rustfmt
268+
runs-on: ubuntu-latest
269+
steps:
270+
- uses: actions/checkout@v1
271+
- uses: actions-rs/toolchain@v1
272+
with:
273+
profile: minimal
274+
# https://github.com/rust-lang/rust-clippy/pull/6379 added MSRV
275+
# support, so we need to use nightly until this is on stable.
276+
toolchain: nightly
277+
components: rustfmt, clippy
278+
override: true
279+
- name: clippy
280+
run: cargo clippy --all --features=std
281+
- name: fmt
282+
run: cargo fmt --all -- --check

0 commit comments

Comments
 (0)