From 18aa84b427c85ad9364763552b208321eabdae01 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Wed, 18 Dec 2024 21:55:36 -0700 Subject: [PATCH] Add CI workflow for verifying `no_std` builds of `pczt` and `zcash_keys`. --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 416f563f6..0855ade90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -288,6 +288,46 @@ jobs: working-directory: ./ci-build run: cargo build --verbose --target ${{ matrix.target }} + build-nostd: + name: Build target ${{ matrix.target }} + runs-on: ubuntu-latest + strategy: + matrix: + target: + - thumbv7em-none-eabihf + steps: + - uses: actions/checkout@v4 + with: + path: crates + # We use a synthetic crate to ensure no dev-dependencies are enabled, which can + # be incompatible with some of these targets. + - name: Create synthetic crate for testing + run: cargo init --lib ci-build + - name: Copy Rust version into synthetic crate + run: cp crates/rust-toolchain.toml ci-build/ + - name: Copy patch directives into synthetic crate + run: | + echo "[patch.crates-io]" >> ./ci-build/Cargo.toml + cat ./crates/Cargo.toml | sed "0,/.\+\(patch.crates.\+\)/d" >> ./ci-build/Cargo.toml + - name: Add no_std pragma to lib.rs + run: | + echo "#![no_std]" > ./ci-build/src/lib.rs + - name: Add zcash_keys as a dependency of the synthetic crate + working-directory: ./ci-build + run: cargo add --no-default-features --path ../crates/zcash_keys + - name: Add pczt as a dependency of the synthetic crate + working-directory: ./ci-build + run: cargo add --no-default-features --path ../crates/pczt + - name: Add lazy_static with the spin_no_std feature + working-directory: ./ci-build + run: cargo add lazy_static --features "spin_no_std" + - name: Add target + working-directory: ./ci-build + run: rustup target add ${{ matrix.target }} + - name: Build for target + working-directory: ./ci-build + run: cargo build --verbose --target ${{ matrix.target }} + bitrot: name: Bitrot check runs-on: ubuntu-latest