Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 112 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ permissions:

jobs:
detect_changes:
timeout-minutes: 5
runs-on: 'ubuntu-latest'
outputs:
rust_tests: ${{ steps.jobs.outputs.rust_tests }}
rust_unit_tests: ${{ steps.jobs.outputs.rust_unit_tests }}
rust_integration_tests: ${{ steps.jobs.outputs.rust_integration_tests }}
ciphernode_e2e: ${{ steps.jobs.outputs.ciphernode_e2e }}
crisp: ${{ steps.jobs.outputs.crisp }}
templates: ${{ steps.jobs.outputs.templates }}
Expand All @@ -47,6 +49,7 @@ jobs:
build_circuits: ${{ steps.jobs.outputs.build_circuits }}
integration_prebuild: ${{ steps.jobs.outputs.integration_prebuild }}
zk_prover_integration: ${{ steps.jobs.outputs.zk_prover_integration }}
build_enclave_cli: ${{ steps.jobs.outputs.build_enclave_cli }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
Expand Down Expand Up @@ -96,11 +99,12 @@ jobs:

any() { for v in "$@"; do [ "$v" = "true" ] && echo "true" && return; done; echo "false"; }

echo "rust_tests=$(any $FORCE $RUST $CONTRACTS $CIRCUITS $CI)" >> $GITHUB_OUTPUT
echo "rust_unit_tests=$(any $FORCE $RUST $CONTRACTS $CIRCUITS $CI)" >> $GITHUB_OUTPUT
echo "rust_integration_tests=$(any $FORCE $RUST $CONTRACTS $CIRCUITS $CI)" >> $GITHUB_OUTPUT
echo "ciphernode_e2e=$(any $FORCE $RUST $CONTRACTS $CIRCUITS $INTEGRATION $CI)" >> $GITHUB_OUTPUT
echo "build_sdk=$(any $FORCE $RUST $CONTRACTS $SDK $INTEGRATION $CIRCUITS $CI $TEMPLATES)" >> $GITHUB_OUTPUT
echo "crisp=$(any $FORCE $CRISP $CONTRACTS $CIRCUITS $RUST $CI)" >> $GITHUB_OUTPUT
echo "templates=$(any $FORCE $TEMPLATES $RUST $CONTRACTS $SDK $CI)" >> $GITHUB_OUTPUT
echo "templates=$(any $FORCE $TEMPLATES $CI)" >> $GITHUB_OUTPUT
Comment thread
ctrlc03 marked this conversation as resolved.
echo "zk=$(any $FORCE $RUST $CIRCUITS $CI)" >> $GITHUB_OUTPUT
echo "contracts=$(any $FORCE $CONTRACTS $CI)" >> $GITHUB_OUTPUT
echo "docker_support=$(any $FORCE $DOCKER $CI)" >> $GITHUB_OUTPUT
Expand All @@ -111,13 +115,13 @@ jobs:
echo "build_circuits=$(any $FORCE $RUST $CIRCUITS $CI)" >> $GITHUB_OUTPUT
echo "integration_prebuild=$(any $FORCE $RUST $CONTRACTS $CIRCUITS $INTEGRATION $CI)" >> $GITHUB_OUTPUT
echo "zk_prover_integration=$(any $FORCE $RUST $CIRCUITS $CI)" >> $GITHUB_OUTPUT
echo "build_enclave_cli=$(any $FORCE $RUST $CONTRACTS $CIRCUITS $INTEGRATION $TEMPLATES $CRISP $CI)" >> $GITHUB_OUTPUT

rust_tests:
rust_unit_tests:
needs: [detect_changes]
if: needs.detect_changes.outputs.rust_tests == 'true'
runs-on:
group: enclave-ci
labels: [enclave-ci-runner]
if: needs.detect_changes.outputs.rust_unit_tests == 'true'
timeout-minutes: 20
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -158,12 +162,53 @@ jobs:
- name: Run Unit Tests
run: 'cargo test --lib && cargo test --doc'

rust_integration_tests:
needs: [detect_changes]
if: needs.detect_changes.outputs.rust_integration_tests == 'true'
timeout-minutes: 45
runs-on:
group: enclave-ci
labels: [enclave-ci-runner]
steps:
- uses: actions/checkout@v6

- name: Cache Rust dependencies
uses: ./.github/actions/cache-dependencies

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install solc
run: |
sudo add-apt-repository ppa:ethereum/ethereum \
&& sudo apt-get update -y \
&& sudo apt-get install -y solc

- name: pnpm-setup
uses: pnpm/action-setup@v4

- name: 'Setup node'
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml

- name: 'Install the dependencies'
run: 'pnpm install --frozen-lockfile'

- name: Run Integration Tests
run: 'cargo test --test integration -- --nocapture'

zk_prover_integration:
needs: [detect_changes]
if: needs.detect_changes.outputs.zk_prover_integration == 'true'
timeout-minutes: 30
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand All @@ -176,6 +221,12 @@ jobs:
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Install solc
run: |
sudo add-apt-repository ppa:ethereum/ethereum \
&& sudo apt-get update -y \
&& sudo apt-get install -y solc

- name: pnpm-setup
uses: pnpm/action-setup@v4

Expand All @@ -189,12 +240,19 @@ jobs:
- name: 'Install the dependencies'
run: 'pnpm install --frozen-lockfile'

- name: Cache Barretenberg binary
uses: actions/cache@v4
with:
path: ~/.bb
key: bb-${{ env.BB_VERSION }}-${{ runner.arch }}

- name: Run ZK Prover Integration Tests (with network downloads)
run: 'cargo test -p e3-zk-prover --features integration-tests --test integration_tests -- --nocapture'

build_e3_support_risc0:
needs: [detect_changes]
if: needs.detect_changes.outputs.docker_support == 'true'
timeout-minutes: 30
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -234,6 +292,7 @@ jobs:
build_ciphernode_image:
needs: [detect_changes]
if: needs.detect_changes.outputs.docker_ciphernode == 'true'
timeout-minutes: 30
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -276,6 +335,7 @@ jobs:
test_contracts:
needs: [detect_changes]
if: needs.detect_changes.outputs.contracts == 'true'
timeout-minutes: 15
runs-on: 'ubuntu-latest'
steps:
- name: 'Check out the repo'
Expand Down Expand Up @@ -313,6 +373,7 @@ jobs:
test_net:
needs: [detect_changes]
if: needs.detect_changes.outputs.net == 'true'
timeout-minutes: 15
runs-on: 'ubuntu-latest'
steps:
- name: 'Check out the repo'
Expand All @@ -328,6 +389,7 @@ jobs:
integration_prebuild:
needs: [detect_changes]
if: needs.detect_changes.outputs.integration_prebuild == 'true'
timeout-minutes: 30
runs-on: 'ubuntu-latest'
steps:
- name: 'Check out the repo'
Expand Down Expand Up @@ -386,6 +448,7 @@ jobs:
ciphernode_integration_test:
needs: [detect_changes, integration_prebuild, build_enclave_cli, build_sdk]
if: needs.detect_changes.outputs.ciphernode_e2e == 'true'
timeout-minutes: 45
runs-on:
group: enclave-ci
labels: [enclave-ci-runner]
Expand Down Expand Up @@ -452,8 +515,10 @@ jobs:
echo "## Test results for ${{ matrix.test-suite }}" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

# Always runs — shared artifact dependency for many downstream jobs
build_enclave_cli:
needs: [detect_changes]
if: needs.detect_changes.outputs.build_enclave_cli == 'true'
timeout-minutes: 20
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -487,6 +552,7 @@ jobs:
crisp_unit:
needs: [detect_changes, build_crisp_sdk]
if: needs.detect_changes.outputs.crisp == 'true'
timeout-minutes: 30
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -561,6 +627,7 @@ jobs:
crisp_e2e:
needs: [detect_changes, build_enclave_cli, build_crisp_sdk]
if: needs.detect_changes.outputs.crisp == 'true'
timeout-minutes: 45
runs-on:
group: enclave-ci
labels: [enclave-ci-runner]
Expand Down Expand Up @@ -675,6 +742,7 @@ jobs:
build_circuits:
needs: [detect_changes]
if: needs.detect_changes.outputs.build_circuits == 'true'
timeout-minutes: 30
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand All @@ -686,14 +754,24 @@ jobs:
with:
toolchain: ${{ env.NOIR_TOOLCHAIN }}

- name: Cache Barretenberg binary
id: cache-bb
uses: actions/cache@v4
with:
path: /usr/local/bin/bb
key: bb-bin-${{ env.BB_VERSION }}-amd64-linux

- name: Install Barretenberg (bb)
if: steps.cache-bb.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://github.com/AztecProtocol/aztec-packages/releases/download/v${{ env.BB_VERSION }}/barretenberg-amd64-linux.tar.gz" -o bb.tar.gz
mkdir -p bb_extract && tar -xzf bb.tar.gz -C bb_extract
BB_BIN=$(find bb_extract -name bb -type f | head -n 1)
sudo mv "$BB_BIN" /usr/local/bin/bb
chmod +x /usr/local/bin/bb
bb --version

- name: Verify bb
run: bb --version
Comment thread
ctrlc03 marked this conversation as resolved.

- name: Check formatting
run: ./scripts/lint-circuits.sh
Expand Down Expand Up @@ -733,6 +811,7 @@ jobs:
zk_prover_e2e:
needs: [detect_changes, build_circuits]
if: needs.detect_changes.outputs.zk == 'true'
timeout-minutes: 30
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand All @@ -745,14 +824,30 @@ jobs:
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Cache Barretenberg binary
id: cache-bb
uses: actions/cache@v4
with:
path: /usr/local/bin/bb
key: bb-bin-${{ env.BB_VERSION }}-amd64-linux

- name: Install solc
run: |
sudo add-apt-repository ppa:ethereum/ethereum \
&& sudo apt-get update -y \
&& sudo apt-get install -y solc

- name: Install Barretenberg (bb)
if: steps.cache-bb.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://github.com/AztecProtocol/aztec-packages/releases/download/v${{ env.BB_VERSION }}/barretenberg-amd64-linux.tar.gz" -o bb.tar.gz
mkdir -p bb_extract && tar -xzf bb.tar.gz -C bb_extract
BB_BIN=$(find bb_extract -name bb -type f | head -n 1)
sudo mv "$BB_BIN" /usr/local/bin/bb
chmod +x /usr/local/bin/bb
bb --version

- name: Verify bb
run: bb --version

- name: Download compiled circuit artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -797,6 +892,7 @@ jobs:
build_e3_support_dev:
needs: [detect_changes]
if: needs.detect_changes.outputs.build_e3_support_dev == 'true'
timeout-minutes: 20
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -828,6 +924,7 @@ jobs:
build_sdk:
needs: [detect_changes]
if: needs.detect_changes.outputs.build_sdk == 'true'
timeout-minutes: 30
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -886,6 +983,7 @@ jobs:
build_crisp_sdk:
needs: [detect_changes]
if: needs.detect_changes.outputs.crisp == 'true'
timeout-minutes: 20
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -935,6 +1033,7 @@ jobs:
template_integration:
needs: [detect_changes, build_enclave_cli, build_e3_support_dev, build_sdk]
if: needs.detect_changes.outputs.templates == 'true'
timeout-minutes: 30
runs-on:
Comment thread
ctrlc03 marked this conversation as resolved.
group: enclave-ci
labels: [enclave-ci-runner]
Expand Down Expand Up @@ -1010,6 +1109,7 @@ jobs:
test_enclave_init:
needs: [detect_changes, build_enclave_cli, build_e3_support_dev]
if: needs.detect_changes.outputs.init == 'true'
timeout-minutes: 10
runs-on: 'ubuntu-latest'
steps:
- name: Install pnpm
Expand Down Expand Up @@ -1046,6 +1146,7 @@ jobs:
enclave init mycitest --verbose --template=${{ github.server_url }}/${{ github.repository }}.git#${BRANCH}:templates/default

contrib-readme-job:
timeout-minutes: 10
runs-on: 'ubuntu-latest'
name: Populate Contributors List
# Only run on main branch to avoid branch conflicts
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions crates/test-helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,58 @@ use rand_chacha::ChaCha20Rng;
use std::sync::Arc;
pub use utils::*;

use std::path::PathBuf;

/// Find the bb binary on the system.
pub async fn find_bb() -> Option<PathBuf> {
// Check PATH first via `which`
if let Ok(output) = tokio::process::Command::new("which")
.arg("bb")
.output()
.await
{
if output.status.success() {
let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
if !path.is_empty() {
return Some(PathBuf::from(path));
}
}
}
// Check common install locations
if let Ok(home) = std::env::var("HOME") {
for path in [
format!("{}/.bb/bb", home),
format!("{}/.nargo/bin/bb", home),
format!("{}/.enclave/noir/bin/bb", home),
] {
if std::path::Path::new(&path).exists() {
return Some(PathBuf::from(path));
}
}
}
None
}

/// Check if anvil is available on the system.
pub async fn find_anvil() -> bool {
if let Ok(output) = tokio::process::Command::new("which")
.arg("anvil")
.output()
.await
{
if output.status.success() {
return true;
}
}
if let Ok(home) = std::env::var("HOME") {
let path = format!("{}/.foundry/bin/anvil", home);
if std::path::Path::new(&path).exists() {
return true;
}
}
false
}

pub fn create_shared_rng_from_u64(value: u64) -> Arc<std::sync::Mutex<ChaCha20Rng>> {
Arc::new(std::sync::Mutex::new(ChaCha20Rng::seed_from_u64(value)))
}
Expand Down
Loading
Loading