From 6a53aabcf6ecdf252e3249ecd90c7edec0c515cc Mon Sep 17 00:00:00 2001 From: eureka-cpu Date: Wed, 11 Dec 2024 12:26:44 -0800 Subject: [PATCH] add integration test feature flag, add integration test CI action --- .github/docker/Dockerfile.build | 3 +-- .github/workflows/build-ci-image.yaml | 2 +- .github/workflows/integration-tests.yml | 30 +++++++++++++++++++++++++ CHANGELOG.md | 3 +++ cli/Cargo.toml | 1 + cli/src/main.rs | 2 +- 6 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/integration-tests.yml diff --git a/.github/docker/Dockerfile.build b/.github/docker/Dockerfile.build index 78589b3..71f07fd 100644 --- a/.github/docker/Dockerfile.build +++ b/.github/docker/Dockerfile.build @@ -57,5 +57,4 @@ RUN /go/bin/yamlfmt -lint .github/workflows/*.yaml .github/workflows/*.yml .gith RUN cargo check RUN cargo +nightly fmt --all -- --check -# Build the bonsol cli target prior to running integration tests that require it. -RUN cargo build --bin bonsol && cargo test +RUN cargo test diff --git a/.github/workflows/build-ci-image.yaml b/.github/workflows/build-ci-image.yaml index 960ffa7..7f040f2 100644 --- a/.github/workflows/build-ci-image.yaml +++ b/.github/workflows/build-ci-image.yaml @@ -9,7 +9,7 @@ on: - "*" jobs: build: - runs-on: ubuntu-latest-m + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 0000000..c42afd4 --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,30 @@ +name: Integration Tests +on: + pull_request: + branches: + - '**' + +concurrency: + cancel-in-progress: true + +permissions: read-all + +jobs: + integration-tests: + name: Setup Toolchain and Test + runs-on: ubuntu-latest + permissions: + contents: "read" + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix With Bonsol Binary Cache + uses: DeterminateSystems/nix-installer-action@main + with: + extra-conf: | + extra-substituters = https://bonsol.cachix.org + extra-trusted-public-keys = bonsol.cachix.org-1:yz7vi1rCPW1BpqoszdJvf08HZxQ/5gPTPxft4NnT74A= + + - name: Run Integration Tests + run: nix develop --command cargo test --features integration -- --nocapture diff --git a/CHANGELOG.md b/CHANGELOG.md index bc54d5c..b6848b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed * `bonsol` cli option requirements and error messages updated for added clarity +### Added +* `bonsol estimate` for estimating execution cost of bonsol programs. + ### Fixed * **Breaking**: `execute_v1` interface instruction now uses the new `InputRef` to improve CU usage. * Adds a callback struct to use the input_hash and committed_outputs from the callback program ergonomically. diff --git a/cli/Cargo.toml b/cli/Cargo.toml index d7dbc33..c1bba3a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -11,6 +11,7 @@ path = "src/main.rs" [features] mac = ["risc0-zkvm/metal"] linux = ["risc0-zkvm/cuda"] +integration = [] [dependencies] anyhow = "1.0.86" diff --git a/cli/src/main.rs b/cli/src/main.rs index c0e1052..11cdea1 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -23,7 +23,7 @@ mod execute; mod init; mod prove; -#[cfg(test)] +#[cfg(all(test, feature = "integration"))] mod tests; pub mod command;