Skip to content

Commit 1c029c8

Browse files
authored
ci: add cross-based nopanic job (#518)
Add cross-based no-panic checks for rndr, netbsd, getrandom, and solaris backends. Temporarily disable solaris and netbsd checks because they trigger the grep check.
1 parent 5d007eb commit 1c029c8

File tree

2 files changed

+88
-51
lines changed

2 files changed

+88
-51
lines changed

.github/workflows/nopanic.yaml

+86-51
Original file line numberDiff line numberDiff line change
@@ -21,59 +21,94 @@ jobs:
2121
name: Linux
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v4
25-
- uses: dtolnay/rust-toolchain@master
26-
with:
27-
# We need Nightly for the rust-std component for wasm32-wasip2
28-
toolchain: nightly-2024-10-14
29-
targets: wasm32-wasip1, wasm32-wasip2
30-
31-
- name: Build (linux_android_with_fallback.rs)
32-
run: cargo build --release
33-
- name: Check (linux_android_with_fallback.rs)
34-
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
35-
36-
- name: Build (linux_android.rs)
37-
env:
38-
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom"
39-
run: cargo build --release
40-
- name: Check (linux_android.rs)
41-
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
42-
43-
- name: Build (rdrand.rs)
44-
env:
45-
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand"
46-
run: cargo build --release
47-
- name: Check (rdrand.rs)
48-
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
49-
50-
- name: Build (custom.rs)
51-
env:
52-
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="custom"
53-
run: cargo build --release
54-
- name: Check (custom.rs)
55-
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
56-
57-
- name: Build (wasi.rs, preview 1)
58-
run: cargo build --release --target wasm32-wasip1
59-
- name: Check (wasi.rs, preview 1)
60-
run: ret=$(grep panic target/wasm32-wasip1/release/getrandom_wrapper.wasm; echo $?); [ $ret -eq 1 ]
61-
62-
- name: Build (wasi.rs, preview 2)
63-
run: cargo build --release --target wasm32-wasip2
64-
- name: Check (wasi.rs, preview 2)
65-
run: ret=$(grep panic target/wasm32-wasip2/release/getrandom_wrapper.wasm; echo $?); [ $ret -eq 1 ]
24+
- uses: actions/checkout@v4
25+
- uses: dtolnay/rust-toolchain@master
26+
with:
27+
# We need Nightly for the rust-std component for wasm32-wasip2
28+
toolchain: nightly-2024-10-14
29+
targets: wasm32-wasip1, wasm32-wasip2
30+
31+
- name: Build (linux_android_with_fallback.rs)
32+
run: cargo build --release
33+
- name: Check (linux_android_with_fallback.rs)
34+
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
35+
36+
- name: Build (linux_android.rs)
37+
env:
38+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom"
39+
run: cargo build --release
40+
- name: Check (linux_android.rs)
41+
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
42+
43+
- name: Build (rdrand.rs)
44+
env:
45+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand"
46+
run: cargo build --release
47+
- name: Check (rdrand.rs)
48+
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
49+
50+
- name: Build (custom.rs)
51+
env:
52+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="custom"
53+
run: cargo build --release
54+
- name: Check (custom.rs)
55+
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
56+
57+
- name: Build (wasi.rs, preview 1)
58+
run: cargo build --release --target wasm32-wasip1
59+
- name: Check (wasi.rs, preview 1)
60+
run: ret=$(grep panic target/wasm32-wasip1/release/getrandom_wrapper.wasm; echo $?); [ $ret -eq 1 ]
61+
62+
- name: Build (wasi.rs, preview 2)
63+
run: cargo build --release --target wasm32-wasip2
64+
- name: Check (wasi.rs, preview 2)
65+
run: ret=$(grep panic target/wasm32-wasip2/release/getrandom_wrapper.wasm; echo $?); [ $ret -eq 1 ]
66+
67+
cross:
68+
name: Cross
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v4
72+
- uses: dtolnay/rust-toolchain@master
73+
with:
74+
toolchain: stable
75+
components: rust-src
76+
targets: aarch64-unknown-linux-gnu,x86_64-unknown-netbsd,x86_64-unknown-freebsd,x86_64-pc-solaris
77+
- name: Install cross
78+
run: cargo install cross --git https://github.com/cross-rs/cross
79+
80+
- name: Build (rndr.rs)
81+
env:
82+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rndr"
83+
run: cross build --release --target=aarch64-unknown-linux-gnu
84+
- name: Check (rndr.rs)
85+
run: ret=$(grep panic target/aarch64-unknown-linux-gnu/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
86+
87+
- name: Build (getrandom.rs)
88+
run: cross build --release --target=x86_64-unknown-freebsd
89+
- name: Check (getrandom.rs)
90+
run: ret=$(grep panic target/x86_64-unknown-freebsd/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
91+
92+
# - name: Build (netbsd.rs)
93+
# run: cross build --release --target=x86_64-unknown-netbsd
94+
# - name: Check (netbsd.rs)
95+
# run: ret=$(grep panic target/x86_64-unknown-netbsd/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
96+
97+
# - name: Build (solaris.rs)
98+
# run: cross build --release --target=x86_64-pc-solaris
99+
# - name: Check (solaris.rs)
100+
# run: ret=$(grep panic target/x86_64-pc-solaris/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
66101

67102
macos:
68103
name: macOS
69104
runs-on: ubuntu-latest
70105
steps:
71-
- uses: actions/checkout@v4
72-
- uses: dtolnay/rust-toolchain@master
73-
with:
74-
toolchain: stable
75-
76-
- name: Build (getentropy.rs)
77-
run: cargo build --release
78-
- name: Check (getentropy.rs)
79-
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]
106+
- uses: actions/checkout@v4
107+
- uses: dtolnay/rust-toolchain@master
108+
with:
109+
toolchain: stable
110+
111+
- name: Build (getentropy.rs)
112+
run: cargo build --release
113+
- name: Check (getentropy.rs)
114+
run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]

nopanic_check/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ version = "0.1.0"
55
edition = "2021"
66
publish = false
77

8+
[workspace]
9+
810
[lib]
911
name = "getrandom_wrapper"
1012
crate-type = ["cdylib"]

0 commit comments

Comments
 (0)