diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 00eb7d4b5bc..4de55ad3f79 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -8,6 +8,9 @@ on: schedule: - cron: "0 2 * * *" # Run nightly at 2 AM UTC +env: + CI: true + jobs: build-nargo: runs-on: ubuntu-latest @@ -211,36 +214,9 @@ jobs: with: version: nightly - - name: Run Anvil - run: | - anvil > /dev/null 2>&1 & - sleep 10 - - - name: Create new Foundry project - run: forge init --no-git --no-commit --force foundry-project - - - name: Run codegen-verifier for 1_mul - working-directory: tooling/nargo_cli/tests/execution_success/1_mul - run: nargo codegen-verifier - - - name: Run codegen-verifier for main - working-directory: compiler/integration-tests/test/circuits/main - run: nargo codegen-verifier - - - name: Copy compiled contracts - run: | - cp tooling/nargo_cli/tests/execution_success/1_mul/contract/1_mul/plonk_vk.sol foundry-project/src/1_mul.sol - cp compiler/integration-tests/test/circuits/main/contract/main/plonk_vk.sol foundry-project/src/main.sol - - - name: Forge build - working-directory: foundry-project - run: forge build - - - name: Forge deploy - working-directory: foundry-project - run: | - forge create --rpc-url http://127.0.0.1:8545 --mnemonic "test test test test test test test test test test test junk" src/1_mul.sol:UltraVerifier --json > mul_output.json - forge create --rpc-url http://127.0.0.1:8545 --mnemonic "test test test test test test test test test test test junk" src/main.sol:UltraVerifier --json > main_output.json + - name: Deploy verifier contracts to Anvil + working-directory: compiler/integration-tests + run: bash ./scripts/setup-project.sh - name: Setup `integration-tests` run: | diff --git a/compiler/integration-tests/.gitignore b/compiler/integration-tests/.gitignore new file mode 100644 index 00000000000..3ae88ef1783 --- /dev/null +++ b/compiler/integration-tests/.gitignore @@ -0,0 +1 @@ +foundry-project diff --git a/compiler/integration-tests/scripts/codegen-verifiers.sh b/compiler/integration-tests/scripts/codegen-verifiers.sh new file mode 100644 index 00000000000..8fd3cb7eccc --- /dev/null +++ b/compiler/integration-tests/scripts/codegen-verifiers.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +self_path=$(dirname "$(readlink -f "$0")") + +repo_root=$self_path/../../.. + +# Run codegen-verifier for 1_mul +mul_dir=$repo_root/tooling/nargo_cli/tests/execution_success/1_mul +nargo --program-dir $mul_dir codegen-verifier + +# Run codegen-verifier for main +main_dir=$repo_root/compiler/integration-tests/test/circuits/main +nargo --program-dir $main_dir codegen-verifier + +# Copy compiled contracts from the root of compiler/integration-tests +src_dir=$self_path/../foundry-project/src +cp $mul_dir/contract/1_mul/plonk_vk.sol $src_dir/1_mul.sol +cp $main_dir/contract/main/plonk_vk.sol $src_dir/main.sol diff --git a/compiler/integration-tests/scripts/deploy-verifiers.sh b/compiler/integration-tests/scripts/deploy-verifiers.sh new file mode 100644 index 00000000000..b39d26f86aa --- /dev/null +++ b/compiler/integration-tests/scripts/deploy-verifiers.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +self_path=$(dirname "$(readlink -f "$0")") +cd $self_path/../foundry-project + +forge build + +CI=${CI:-false} +if [[ $CI = true ]]; then + anvil > /dev/null 2>&1 & +else + anvil & + pid=$! +fi + +sleep 10 + +forge create --rpc-url http://127.0.0.1:8545 --mnemonic "test test test test test test test test test test test junk" src/1_mul.sol:UltraVerifier --json > mul_output.json +forge create --rpc-url http://127.0.0.1:8545 --mnemonic "test test test test test test test test test test test junk" src/main.sol:UltraVerifier --json > main_output.json + +if [[ $CI = false ]]; then + wait $pid +fi diff --git a/compiler/integration-tests/scripts/forge-init.sh b/compiler/integration-tests/scripts/forge-init.sh new file mode 100644 index 00000000000..e2b86611e92 --- /dev/null +++ b/compiler/integration-tests/scripts/forge-init.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +self_path=$(dirname "$(readlink -f "$0")") + +project_path=$self_path/../foundry-project + +# Create forge project +forge init --no-git --no-commit --no-deps --force $project_path + +# Remove unwanted files +rm -rf $project_path/script +rm -rf $project_path/src/*.sol +rm -rf $project_path/test diff --git a/compiler/integration-tests/scripts/setup-project.sh b/compiler/integration-tests/scripts/setup-project.sh new file mode 100644 index 00000000000..202c53bce1e --- /dev/null +++ b/compiler/integration-tests/scripts/setup-project.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +self_path=$(dirname "$(readlink -f "$0")") + +bash $self_path/forge-init.sh +bash $self_path/codegen-verifiers.sh +bash $self_path/deploy-verifiers.sh