From da932b9c3544061834b5feb137907c5ebee3b132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 16 Oct 2024 03:52:28 +0300 Subject: [PATCH] ci: add cross-based nopanic job --- .github/workflows/nopanic.yaml | 115 ++++++++++++++++++++------------- 1 file changed, 69 insertions(+), 46 deletions(-) diff --git a/.github/workflows/nopanic.yaml b/.github/workflows/nopanic.yaml index a5bd6e02..3cc21814 100644 --- a/.github/workflows/nopanic.yaml +++ b/.github/workflows/nopanic.yaml @@ -21,59 +21,82 @@ jobs: name: Linux runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - # We need Nightly for the rust-std component for wasm32-wasip2 - toolchain: nightly-2024-10-14 - targets: wasm32-wasip1, wasm32-wasip2 - - - name: Build (linux_android_with_fallback.rs) - run: cargo build --release - - name: Check (linux_android_with_fallback.rs) - run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + # We need Nightly for the rust-std component for wasm32-wasip2 + toolchain: nightly-2024-10-14 + targets: wasm32-wasip1, wasm32-wasip2 + + - name: Build (linux_android_with_fallback.rs) + run: cargo build --release + - name: Check (linux_android_with_fallback.rs) + run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] - - name: Build (linux_android.rs) - env: - RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom" - run: cargo build --release - - name: Check (linux_android.rs) - run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] + - name: Build (linux_android.rs) + env: + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom" + run: cargo build --release + - name: Check (linux_android.rs) + run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] - - name: Build (rdrand.rs) - env: - RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand" - run: cargo build --release - - name: Check (rdrand.rs) - run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] + - name: Build (rdrand.rs) + env: + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand" + run: cargo build --release + - name: Check (rdrand.rs) + run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] - - name: Build (custom.rs) - env: - RUSTFLAGS: -Dwarnings --cfg getrandom_backend="custom" - run: cargo build --release - - name: Check (custom.rs) - run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] + - name: Build (custom.rs) + env: + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="custom" + run: cargo build --release + - name: Check (custom.rs) + run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] - - name: Build (wasi.rs, preview 1) - run: cargo build --release --target wasm32-wasip1 - - name: Check (wasi.rs, preview 1) - run: ret=$(grep panic target/wasm32-wasip1/release/getrandom_wrapper.wasm; echo $?); [ $ret -eq 1 ] + - name: Build (wasi.rs, preview 1) + run: cargo build --release --target wasm32-wasip1 + - name: Check (wasi.rs, preview 1) + run: ret=$(grep panic target/wasm32-wasip1/release/getrandom_wrapper.wasm; echo $?); [ $ret -eq 1 ] - - name: Build (wasi.rs, preview 2) - run: cargo build --release --target wasm32-wasip2 - - name: Check (wasi.rs, preview 2) - run: ret=$(grep panic target/wasm32-wasip2/release/getrandom_wrapper.wasm; echo $?); [ $ret -eq 1 ] + - name: Build (wasi.rs, preview 2) + run: cargo build --release --target wasm32-wasip2 + - name: Check (wasi.rs, preview 2) + run: ret=$(grep panic target/wasm32-wasip2/release/getrandom_wrapper.wasm; echo $?); [ $ret -eq 1 ] + + cross: + name: Linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + # We need Nightly for the rust-std component for wasm32-wasip2 + toolchain: nightly-2024-10-14 + - name: Install precompiled cross + run: | + VERSION=v0.2.5 + URL=https://github.com/cross-rs/cross/releases/download/${VERSION}/cross-x86_64-unknown-linux-gnu.tar.gz + wget -O - $URL | tar -xz -C ~/.cargo/bin + cross --version + + - name: Build (rndr.rs) + env: + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rndr" + run: cross build --release --target=aarch64-unknown-linux-gnu + - run: ls target/ + - run: ls target/release macos: name: macOS runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - - - name: Build (getentropy.rs) - run: cargo build --release - - name: Check (getentropy.rs) - run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ] + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Build (getentropy.rs) + run: cargo build --release + - name: Check (getentropy.rs) + run: ret=$(grep panic target/release/libgetrandom_wrapper.so; echo $?); [ $ret -eq 1 ]