Status update 2026-04-04 #1737
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: rust-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # Not needed in CI, should make things a bit faster | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_TERM_COLOR: always | |
| # Build smaller artifacts to avoid running out of space in CI and make it a bit faster | |
| RUSTFLAGS: -C strip=symbols | |
| # Needed for things like file system access | |
| MIRIFLAGS: -Zmiri-disable-isolation | |
| RUST_BACKTRACE: full | |
| jobs: | |
| cargo-fmt: | |
| runs-on: ubuntu-24.04 | |
| # Gives the slow cargo test jobs a head start | |
| needs: cargo-test-slow-head-start | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 | |
| - name: Configure cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # 5.0.3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: cargo fmt | |
| run: cargo fmt --all -- --check | |
| # Artificial job that gives windows test jobs head start by making other jobs start a bit later, so Windows jobs | |
| # schedule earlier than the rest and will not delay the rest of the queue as much as they would otherwise | |
| cargo-test-slow-head-start: | |
| runs-on: ubuntu-slim | |
| steps: | |
| - name: Artificial delay | |
| run: sleep 5 | |
| cargo-clippy: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| - macos-26 | |
| - windows-11-arm | |
| - windows-2025 | |
| type: | |
| - together | |
| - individually | |
| - features | |
| target: | |
| - "" | |
| include: | |
| - os: ubuntu-24.04 | |
| type: together | |
| target: "riscv64a23-unknown-linux-gnu" | |
| - os: ubuntu-24.04 | |
| type: features | |
| target: "riscv64a23-unknown-linux-gnu" | |
| - os: ubuntu-24.04 | |
| type: individually | |
| target: "riscv64a23-unknown-linux-gnu" | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| command: >- | |
| cargo -Zgitoxide -Zgit clippy | |
| ${{ matrix.target != '' && format('-Zjson-target-spec --target {0}', matrix.target) || '' }} | |
| # Gives the slow cargo test jobs a head start | |
| needs: cargo-test-slow-head-start | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 | |
| - name: Install protoc (libp2p) | |
| uses: taiki-e/install-action@d858f8113943481093e02986a7586a4819a3bfd6 # 2.71.2 | |
| with: | |
| tool: protoc | |
| - name: RISC-V support | |
| run: | | |
| echo "command=${{ env.command }} -Zbuild-std" >> $GITHUB_ENV | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C linker=riscv64-linux-gnu-gcc" >> $GITHUB_ENV | |
| # TODO: Temporary workaround for https://github.com/rust-lang/cc-rs/issues/1654 | |
| echo "CC_riscv64_unknown_none_abundance=riscv64-linux-gnu-gcc" >> $GITHUB_ENV | |
| echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends --yes g++-riscv64-linux-gnu | |
| if: contains(matrix.target, 'riscv64') | |
| # Needed for hwloc | |
| - name: Install automake and glibtoolize (macOS) | |
| run: brew install automake libtool | |
| if: runner.os == 'macOS' | |
| - name: Configure cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # 5.0.3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1 | |
| if: runner.os == 'Linux' && matrix.target == '' | |
| # Use Mold linker for shorter build times | |
| - name: Use Mold linker on Linux | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C link-arg=-fuse-ld=mold" >> $GITHUB_ENV | |
| if: runner.os == 'Linux' && matrix.target == '' | |
| # Use LLD linker for shorter build times | |
| - name: Use LLD linker on Windows | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C linker=rust-lld" >> $GITHUB_ENV | |
| if: runner.os == 'Windows' | |
| - name: cargo clippy | |
| run: | | |
| ${{ env.command }} --locked --all-targets -- -D warnings | |
| if: matrix.type == 'together' | |
| - name: cargo clippy (each crate individually) | |
| shell: bash | |
| run: | | |
| for crate_path in crates/{contracts/{core,example,system},execution,farmer,node,shared}/*; do | |
| if [ ! -f "$crate_path/Cargo.toml" ]; then | |
| continue | |
| fi | |
| crate="$(basename -- $crate_path)" | |
| echo "Checking \`$crate\` individually" | |
| ${{ env.command }} --all-targets --package $crate -- -D warnings | |
| done | |
| if: matrix.type == 'individually' | |
| - name: cargo clippy (various features) | |
| shell: bash | |
| run: | | |
| for feature in alloc parallel scale-codec serde; do | |
| echo "Check clippy with feature: $feature" | |
| for crate_path in crates/{execution,farmer,node,shared}/*; do | |
| # Not all crates have this feature | |
| if ! grep --no-messages --quiet "^$feature = \[" "$crate_path/Cargo.toml"; then | |
| continue | |
| fi | |
| crate="$(basename -- $crate_path)" | |
| echo "Checking \`$feature\` in \`$crate\`" | |
| ${{ env.command }} --all-targets --package $crate --features $crate/$feature -- -D warnings | |
| done | |
| done | |
| # Ensure `clippy` is happy with `guest` feature | |
| echo "Checking \`guest\` in contracts" | |
| for contract_path in crates/contracts/{example,system}/*; do | |
| contract="$(basename -- $contract_path)" | |
| echo "Checking \`guest\` in \`$contract\`" | |
| ${{ env.command }} --all-targets --package $contract --features $contract/guest -- -D warnings | |
| done | |
| for crate_path in crates/contracts/core/*; do | |
| # Not all crates have this feature | |
| if ! grep --no-messages --quiet "^guest = \[" "$crate_path/Cargo.toml"; then | |
| continue | |
| fi | |
| crate="$(basename -- $crate_path)" | |
| echo "Checking \`guest\` in \`$crate\`" | |
| ${{ env.command }} --all-targets --package $crate --features $crate/guest -- -D warnings | |
| done | |
| echo "Checking \`executor\` in \`ab-contracts-common\`" | |
| ${{ env.command }} --all-targets --package ab-contracts-common --features ab-contracts-common/executor -- -D warnings | |
| echo "Checking \`payload-builder\` in \`ab-system-contract-simple-wallet-base\`" | |
| ${{ env.command }} --all-targets --package ab-system-contract-simple-wallet-base --features ab-system-contract-simple-wallet-base/payload-builder -- -D warnings | |
| if: matrix.type == 'features' | |
| cargo-test: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| - macos-26 | |
| - windows-11-arm | |
| - windows-2025 | |
| miri: | |
| - true | |
| - false | |
| target: | |
| - "" | |
| type: | |
| # `together` variant is running in a separate job, see `cargo-test-slow` | |
| # - together | |
| - features | |
| # Only a few select targets are explicitly included with `guest-feature` below | |
| # - guest-feature | |
| # Test a few RISC-V targets (both Linux and one used for contracts) using Miri | |
| include: | |
| - os: ubuntu-24.04 | |
| miri: true | |
| type: guest-feature | |
| target: "" | |
| - os: ubuntu-24.04 | |
| miri: false | |
| type: guest-feature | |
| target: "" | |
| - os: ubuntu-24.04 | |
| miri: true | |
| type: features | |
| target: "riscv64a23-unknown-linux-gnu" | |
| - os: ubuntu-24.04 | |
| miri: true | |
| type: guest-feature | |
| target: "riscv64a23-unknown-linux-gnu" | |
| # TODO: Tests will need custom allocator to work under this target | |
| # - os: ubuntu-24.04 | |
| # miri: true | |
| # type: guest-feature | |
| # target: "crates/contracts/core/ab-contracts-tooling/src/riscv64-unknown-none-abundance.json" | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| # Gives the slow cargo test jobs a head start | |
| needs: cargo-test-slow-head-start | |
| env: | |
| command: >- | |
| ${{ matrix.miri == true && 'miri nextest run' || 'nextest run' }} | |
| ${{ matrix.target != '' && format('-Zjson-target-spec --target {0}', matrix.target) || '' }} | |
| steps: &test-steps | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 | |
| - name: Install cargo-nextest and protoc (libp2p) | |
| uses: taiki-e/install-action@d858f8113943481093e02986a7586a4819a3bfd6 # 2.71.2 | |
| with: | |
| tool: cargo-nextest,protoc | |
| - name: RISC-V support | |
| run: | | |
| echo "command=${{ env.command }} -Zbuild-std" >> $GITHUB_ENV | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C linker=riscv64-linux-gnu-gcc" >> $GITHUB_ENV | |
| # TODO: Temporary workaround for https://github.com/rust-lang/cc-rs/issues/1654 | |
| echo "CC_riscv64_unknown_none_abundance=riscv64-linux-gnu-gcc" >> $GITHUB_ENV | |
| echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends --yes g++-riscv64-linux-gnu | |
| if: contains(matrix.target, 'riscv64') | |
| # Needed for hwloc | |
| - name: Install automake and glibtoolize (macOS) | |
| run: brew install automake libtool | |
| if: runner.os == 'macOS' | |
| - name: Configure cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # 5.0.3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1 | |
| if: runner.os == 'Linux' && matrix.target == '' | |
| # Use Mold linker for shorter build times | |
| - name: Use Mold linker on Linux | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C link-arg=-fuse-ld=mold" >> $GITHUB_ENV | |
| if: runner.os == 'Linux' && matrix.target == '' | |
| # Use LLD linker for shorter build times | |
| - name: Use LLD linker on Windows | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C linker=rust-lld" >> $GITHUB_ENV | |
| if: runner.os == 'Windows' | |
| # TODO: This is a workaround for https://github.com/rust-lang/miri/issues/3172#issuecomment-2986871634 | |
| - name: Miri aarch64 workaround | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} --cfg chacha20_backend=\"soft\"" >> $GITHUB_ENV | |
| if: matrix.miri == true && runner.arch == 'ARM64' | |
| - name: Install Vulkan runtime (Linux) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends --yes mesa-vulkan-drivers | |
| if: matrix.miri == false && runner.os == 'Linux' && matrix.type == 'together' | |
| - name: Install Vulkan runtime (Windows) | |
| run: | | |
| & { | |
| # See https://vulkan.lunarg.com/sdk/home for updates | |
| $sdkVersion = "1.4.328.1" | |
| if ("${{ runner.arch }}" -eq "ARM64") { | |
| $arch = "ARM64" | |
| $urlPath = "warm" | |
| $expectedHash = "1f675a1b317a32d451ebf45d77483889d85a5fa972bd01dd1c1ee173278c63c9" | |
| } else { | |
| $arch = "X64" | |
| $urlPath = "windows" | |
| $expectedHash = "293efbb2c11e60429df7770f40e3c5c811a7fa42af81de0cc41e8718ddb2b373" | |
| } | |
| $url = "https://sdk.lunarg.com/sdk/download/$sdkVersion/$urlPath/VulkanRT-$arch-$sdkVersion-Components.zip" | |
| Invoke-WebRequest -Uri $url -OutFile VulkanRT.zip | |
| $actualHash = (Get-FileHash VulkanRT.zip -Algorithm SHA256).Hash.ToLower() | |
| if ($actualHash -ne $expectedHash.ToLower()) { | |
| throw "SHA256 mismatch: expected $expectedHash, got $actualHash" | |
| } | |
| 7z e VulkanRT.zip -o"${{ runner.temp }}\vulkan" -r "vulkan-1.*" | |
| Remove-Item VulkanRT.zip | |
| $vulkanPath = "${{ runner.temp }}\vulkan" | |
| "$vulkanPath" >> $env:GITHUB_PATH | |
| } | |
| & { | |
| # See https://github.com/mmozeiko/build-mesa/releases for updates | |
| $version = "25.3.1" | |
| if ("${{ runner.arch }}" -eq "ARM64") { | |
| $arch = "arm64" | |
| $archJson = "aarch64" | |
| $expectedHash = "b58fca49de23c9c60656017d0302e27f2d91658c7f1e33c891cd8d4c4507e6b5" | |
| } else { | |
| $arch = "x64" | |
| $archJson = "x86_64" | |
| $expectedHash = "32e0719760c8d72e18834ca98ff25854fcec2173a5da9018b230e4c90677ae90" | |
| } | |
| $url = "https://github.com/mmozeiko/build-mesa/releases/download/$version/mesa-lavapipe-$arch-$version.7z" | |
| Invoke-WebRequest -Uri $url -OutFile mesa-lavapipe.7z | |
| $actualHash = (Get-FileHash mesa-lavapipe.7z -Algorithm SHA256).Hash.ToLower() | |
| if ($actualHash -ne $expectedHash.ToLower()) { | |
| throw "SHA256 mismatch: expected $expectedHash, got $actualHash" | |
| } | |
| 7z x mesa-lavapipe.7z -o"${{ runner.temp }}\mesa" | |
| Remove-Item mesa-lavapipe.7z | |
| $mesaPath = "${{ runner.temp }}\mesa" | |
| "$mesaPath" >> $env:GITHUB_PATH | |
| $icdPath = "$mesaPath\lvp_icd.$archJson.json" | |
| New-Item -Path "HKLM:\SOFTWARE\Khronos\Vulkan\Drivers" -Force| Out-Null | |
| Set-ItemProperty -Path "HKLM:\SOFTWARE\Khronos\Vulkan\Drivers" -Name $icdPath -Value 0 -Type DWord | |
| } | |
| if: matrix.miri == false && runner.os == 'Windows' && matrix.type == 'together' | |
| - name: cargo ${{ env.command }} | |
| run: | | |
| cargo -Zgitoxide -Zgit ${{ env.command }} --locked ${{ env.EXTRA_OPTIONS }} | |
| if: matrix.type == 'together' | |
| - name: cargo test (various features) | |
| shell: bash | |
| run: | | |
| for feature in alloc parallel scale-codec serde; do | |
| for crate_path in crates/{execution,farmer,node,shared}/*; do | |
| # Not all crates have this feature | |
| if ! grep --no-messages --quiet "^$feature = \[" "$crate_path/Cargo.toml"; then | |
| continue | |
| fi | |
| crate="$(basename -- $crate_path)" | |
| echo "Testing \`$feature\` in \`$crate\`" | |
| cargo -Zgitoxide -Zgit ${{ env.command }} --no-tests pass --package $crate --features $crate/$feature | |
| done | |
| done | |
| echo "Checking \`executor\` in \`ab-contracts-common\`" | |
| cargo -Zgitoxide -Zgit ${{ env.command }} --package ab-contracts-common --features ab-contracts-common/executor | |
| echo "Testing \`payload-builder\` in \`ab-system-contract-simple-wallet-base\`" | |
| cargo -Zgitoxide -Zgit ${{ env.command }} --package ab-system-contract-simple-wallet-base --features ab-system-contract-simple-wallet-base/payload-builder | |
| if: matrix.type == 'features' | |
| - name: cargo ${{ env.command }} (guest feature) | |
| shell: bash | |
| run: | | |
| # Ensure tests pass with `guest` feature | |
| for contract_path in crates/contracts/{example,system}/*; do | |
| contract="$(basename -- $contract_path)" | |
| echo "Testing \`guest\` in \`$contract\`" | |
| cargo -Zgitoxide -Zgit ${{ env.command }} --no-tests pass --package $contract --features $contract/guest | |
| done | |
| for create_path in crates/contracts/core/*; do | |
| # Not all crates have this feature | |
| if ! grep --no-messages --quiet "^guest = \[" "$crate_path/Cargo.toml"; then | |
| continue | |
| fi | |
| crate="$(basename -- $create_path)" | |
| echo "Testing \`guest\` in \`$crate\`" | |
| cargo -Zgitoxide -Zgit ${{ env.command }} --no-tests pass --package $crate --features $crate/guest | |
| done | |
| if: matrix.type == 'guest-feature' && runner.os == 'Linux' | |
| # This is a hack to start slower jobs before the rest, see `cargo-test` job for full definition | |
| cargo-test-slow: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| - macos-26 | |
| - windows-11-arm | |
| - windows-2025 | |
| miri: | |
| - true | |
| - false | |
| target: | |
| - "" | |
| type: | |
| - together | |
| # - features | |
| # - guest-feature | |
| include: | |
| - os: ubuntu-24.04 | |
| miri: true | |
| type: together | |
| target: "riscv64a23-unknown-linux-gnu" | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| command: >- | |
| ${{ matrix.miri == true && 'miri nextest run' || 'nextest run' }} | |
| ${{ matrix.target != '' && format('-Zjson-target-spec --target {0}', matrix.target) || '' }} | |
| steps: *test-steps | |
| no-panic: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| - macos-26 | |
| - windows-11-arm | |
| - windows-2025 | |
| type: | |
| - default | |
| - features | |
| # Only one target is explicitly included with `guest-feature` below | |
| # - guest-feature | |
| target: | |
| - "" | |
| include: | |
| - os: ubuntu-24.04 | |
| type: default | |
| target: "riscv64a23-unknown-linux-gnu" | |
| - os: ubuntu-24.04 | |
| type: features | |
| target: "riscv64a23-unknown-linux-gnu" | |
| # TODO: Tests will need custom allocator to work under this target | |
| # - os: ubuntu-24.04 | |
| # type: guest-feature | |
| # target: "crates/contracts/core/ab-contracts-tooling/src/riscv64-unknown-none-abundance.json" | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| command: >- | |
| cargo -Zgitoxide -Zgit build | |
| ${{ matrix.target != '' && format('-Zjson-target-spec --target {0}', matrix.target) || '' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 | |
| - name: RISC-V support | |
| run: | | |
| echo "command=${{ env.command }} -Zbuild-std" >> $GITHUB_ENV | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C linker=riscv64-linux-gnu-gcc" >> $GITHUB_ENV | |
| # TODO: Temporary workaround for https://github.com/rust-lang/cc-rs/issues/1654 | |
| echo "CC_riscv64_unknown_none_abundance=riscv64-linux-gnu-gcc" >> $GITHUB_ENV | |
| echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends --yes g++-riscv64-linux-gnu | |
| if: contains(matrix.target, 'riscv64') | |
| - name: Configure cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # 5.0.3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1 | |
| if: runner.os == 'Linux' && matrix.target == '' | |
| # Use Mold linker for shorter build times | |
| - name: Use Mold linker on Linux | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C link-arg=-fuse-ld=mold" >> $GITHUB_ENV | |
| if: runner.os == 'Linux' && matrix.target == '' | |
| # Use LLD linker for shorter build times | |
| - name: Use LLD linker on Windows | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C linker=rust-lld" >> $GITHUB_ENV | |
| if: runner.os == 'Windows' | |
| # Increase the inlining threshold to make sure the compiler can see that some functions do not panic. | |
| # Native CPU and LTO to allow the compiler to apply more optimizations and prove lack of panics in more cases. | |
| - name: Set up RUSTFLAGS | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -Cllvm-args=--inline-threshold=7000 -C embed-bitcode -C lto -Z dylib-lto ${{ matrix.target == '' && '-C target-cpu=native' || '' }}" >> $GITHUB_ENV | |
| - name: Ensure no panics in annotated code | |
| shell: bash | |
| run: | | |
| # TODO: This doesn't seem to work for now: https://users.rust-lang.org/t/compiler-optimizations-are-different-for-crate-itself-vs-dependency/130187?u=nazar-pc | |
| # So we end up building individual crates instead, which is unfortunate | |
| # ${{ env.command }} --release --all-targets --features no-panic | |
| # Ensure no panics in various crates | |
| for crate_path in crates/{contracts/{core,example,system},execution,farmer,node,shared}/*; do | |
| # Not all crates have this feature yet | |
| if ! grep --no-messages --quiet '^no-panic = \[' "$crate_path/Cargo.toml"; then | |
| continue | |
| fi | |
| crate="$(basename -- $crate_path)" | |
| echo "Checking \`$crate\`" | |
| ${{ env.command }} --release --all-targets --features no-panic --package $crate | |
| done | |
| if: matrix.type == 'default' | |
| - name: Ensure no panics in annotated code (various features) | |
| shell: bash | |
| run: | | |
| # Ensure no panics with `alloc` feature | |
| for crate_path in crates/{execution,farmer,node,shared}/*; do | |
| # Not all crates have this feature yet | |
| if ! grep --no-messages --quiet '^no-panic = \[' "$crate_path/Cargo.toml" || \ | |
| ! grep --no-messages --quiet '^alloc = \[' "$crate_path/Cargo.toml"; then | |
| continue | |
| fi | |
| crate="$(basename -- $crate_path)" | |
| echo "Checking \`alloc\` in \`$crate\`" | |
| ${{ env.command }} --release --all-targets --features no-panic --package $crate --features $crate/alloc | |
| done | |
| echo "Checking \`executor\` in \`ab-contracts-common\`" | |
| ${{ env.command }} --release --all-targets --features no-panic --package ab-contracts-common --features ab-contracts-common/executor | |
| echo "Checking \`payload-builder\` in \`ab-system-contract-simple-wallet-base\`" | |
| ${{ env.command }} --release --all-targets --features no-panic --package ab-system-contract-simple-wallet-base --features ab-system-contract-simple-wallet-base/payload-builder | |
| if: matrix.type == 'features' | |
| - name: Ensure no panics in annotated code (guest feature) | |
| run: | | |
| # Ensure no panics with `guest` feature | |
| for contract_path in crates/contracts/{example,system}/*; do | |
| # Not all contracts have this feature yet | |
| if ! grep --no-messages --quiet '^no-panic = \[' "$contract_path/Cargo.toml"; then | |
| continue | |
| fi | |
| contract="$(basename -- $contract_path)" | |
| echo "Checking \`guest\` in \`$contract\`" | |
| ${{ env.command }} --release --all-targets --features no-panic --package $contract --features $contract/guest | |
| done | |
| for contract_path in crates/contracts/core/*; do | |
| # Not all contracts have this feature yet | |
| if ! grep --no-messages --quiet '^no-panic = \[' "$crate_path/Cargo.toml" || \ | |
| ! grep --no-messages --quiet '^guest = \[' "$crate_path/Cargo.toml"; then | |
| continue | |
| fi | |
| contract="$(basename -- $contract_path)" | |
| echo "Checking \`guest\` in \`$contract\`" | |
| ${{ env.command }} --release --all-targets --features no-panic --package $contract --features $contract/guest | |
| done | |
| if: matrix.type == 'guest-feature' && runner.os == 'Linux' | |
| contracts: | |
| runs-on: ubuntu-24.04 | |
| # Gives the slow cargo test jobs a head start | |
| needs: cargo-test-slow-head-start | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 | |
| - name: Configure cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # 5.0.3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| # TODO: Run clippy and `no-panic` on custom target for contracts too | |
| - name: Ensure contracts compile for a custom target | |
| run: | | |
| for contract_path in crates/contracts/{example,system}/*; do | |
| contract="$(basename -- $contract_path)" | |
| echo "Checking \`$contract\` (release profile)" | |
| cargo run --bin cargo-ab-contract -- build --package $contract | |
| echo "Checking \`$contract\` (contract profile)" | |
| cargo run --bin cargo-ab-contract -- build --package $contract --profile contract | |
| done | |
| act4: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # 4.0.0 | |
| - name: Prepare | |
| run: | | |
| mkdir /tmp/empty | |
| # TODO: Use official image once it is available: https://github.com/riscv/riscv-arch-test/pull/1161 | |
| - name: Build act4-build image | |
| id: build | |
| uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # 7.0.0 | |
| with: | |
| context: /tmp/empty | |
| file: crates/execution/ab-riscv-act4-runner/res/Dockerfile | |
| cache-from: type=gha,scope=act4-build | |
| cache-to: type=gha,mode=min,scope=act4-build | |
| load: true | |
| - name: ACT4 tests | |
| working-directory: crates/execution/ab-riscv-act4-runner | |
| run: | | |
| echo "Clone ACT4 repo" | |
| git clone --depth 1 --branch cert-docs-2026-04-01-17-37-00ca3c9 \ | |
| https://github.com/riscv/riscv-arch-test \ | |
| res/riscv-arch-test | |
| echo "Building ELFs" | |
| docker run --privileged \ | |
| -v ./res/riscv-arch-test:/mnt \ | |
| -v ./res/abundance:/mnt/config/abundance:ro \ | |
| -e CONFIG_FILES="config/abundance/abundance-rv32i-max/test_config.yaml config/abundance/abundance-rv64i-max/test_config.yaml" \ | |
| ${{ steps.build.outputs.imageid }} \ | |
| make | |
| echo "Running RV32 tests" | |
| cargo run -- rv32 res/riscv-arch-test/work/abundance-rv32i-max | |
| echo "Running RV64 tests" | |
| cargo run -- rv64 res/riscv-arch-test/work/abundance-rv64i-max | |
| rust-all: | |
| # Hack for buggy GitHub Actions behavior with skipped checks: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks | |
| if: ${{ always() }} | |
| runs-on: ubuntu-slim | |
| needs: | |
| - cargo-clippy | |
| - cargo-fmt | |
| - cargo-test | |
| - cargo-test-slow | |
| - contracts | |
| - no-panic | |
| - act4 | |
| steps: | |
| - name: Check job statuses | |
| # Another hack is to actually check the status of the dependencies or else it'll fall through | |
| run: | | |
| echo "Checking statuses..." | |
| [[ "${{ needs.cargo-clippy.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-fmt.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-test.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-test-slow.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.contracts.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.no-panic.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.act4.result }}" == "success" ]] || exit 1 |