diff --git a/.github/ci-setup-action/action.yml b/.github/ci-setup-action/action.yml index 147089383303..93ad03f59413 100644 --- a/.github/ci-setup-action/action.yml +++ b/.github/ci-setup-action/action.yml @@ -35,6 +35,10 @@ runs: # TODO reconsider how jq gets into image - name: Setup jq uses: dcarbone/install-jq-action@v2.1.0 + - name: Setup yq + uses: dcarbone/install-yq-action@v1.1.1 + with: + version: v4.44.3 - name: Setup Earthly uses: earthly/actions-setup@v1 diff --git a/.github/ensure-tester/action.yml b/.github/ensure-tester/action.yml index 4525f2df30a7..ec6b1c275422 100644 --- a/.github/ensure-tester/action.yml +++ b/.github/ensure-tester/action.yml @@ -95,6 +95,16 @@ runs: " || true fi + - name: Setup yq + shell: bash + run: | + set -x + scripts/run_on_tester " + wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_amd64 -O ./yq + chmod +x ./yq + sudo mv ./yq /usr/bin/yq + " + - name: Ensure Tester Cleanup uses: gacts/run-and-post-run@v1 with: diff --git a/.github/workflows/ci-arm.yml b/.github/workflows/ci-arm.yml index 104914717e66..1ba74da9a634 100644 --- a/.github/workflows/ci-arm.yml +++ b/.github/workflows/ci-arm.yml @@ -3,7 +3,7 @@ on: push: branches: - master - - '*/*arm-build' + - "*/*arm-build" workflow_dispatch: inputs: {} concurrency: @@ -101,8 +101,9 @@ jobs: # prepare images locally, tagged by commit hash - name: "Build E2E Image" timeout-minutes: 40 + working-directory: ./yarn-project/end-to-end run: | - earthly-ci ./yarn-project/end-to-end+uniswap-trade-on-l1-from-l2 + ./scripts/e2e_compose_test.sh uniswap_trade_on_l1_from_l2.test.ts rerun-check: runs-on: ubuntu-20.04 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84b63b632d16..8c1ffb5ff53c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: branches: - master - provernet - - '*/ci-push*' + - "*/ci-push*" pull_request: types: - opened @@ -172,6 +172,7 @@ jobs: LABELS="" fi echo Labels: $LABELS + echo "list=$(./scripts/ci/get_e2e_jobs.sh ${{github.ref_name}} "$LABELS")" echo "list=$(./scripts/ci/get_e2e_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT - name: Create list of bench end-to-end jobs id: bench_list @@ -197,24 +198,26 @@ jobs: - uses: actions/checkout@v4 with: { ref: "${{ env.GIT_COMMIT }}" } - uses: ./.github/ci-setup-action + - name: Determine runner type + id: runner_type + run: | + runner=$(./scripts/ci/select_runner.sh ${{ matrix.test }}) + echo "type=$runner" >> $GITHUB_OUTPUT - name: Setup and Test timeout-minutes: 40 uses: ./.github/ensure-tester-with-images env: USERNAME: ${{ needs.configure.outputs.username }} with: - runner_type: ${{ contains(matrix.test, 'prover') && '64core-tester-x86' || '8core-tester-x86' }} + runner_type: ${{ steps.runner_type.outputs.type }} builder_type: builder-x86 - # these are copied to the tester and expected by the earthly command below - # if they fail to copy, it will try to build them on the tester and fail builder_images_to_copy: aztecprotocol/aztec:${{ env.GIT_COMMIT }} aztecprotocol/end-to-end:${{ env.GIT_COMMIT }} - # command to produce the images in case they don't exist builder_command: scripts/earthly-ci ./yarn-project+export-e2e-test-images run: | set -eux cd ./yarn-project/end-to-end/ export FORCE_COLOR=1 - ../../scripts/earthly-ci -P --no-output +${{ matrix.test }} + ./scripts/e2e_test.sh ${{ matrix.test }} # all the benchmarking end-to-end integration tests for aztec (not required to merge) bench-e2e: @@ -229,13 +232,18 @@ jobs: - uses: actions/checkout@v4 with: { ref: "${{ env.GIT_COMMIT }}" } - uses: ./.github/ci-setup-action + - name: Determine runner type + id: runner_type + run: | + runner=$(./scripts/ci/select_runner.sh ${{ matrix.test }}) + echo "type=$runner" >> $GITHUB_OUTPUT - name: Setup and Test uses: ./.github/ensure-tester-with-images env: USERNAME: ${{ needs.configure.outputs.username }} timeout-minutes: 45 with: - runner_type: ${{ contains(matrix.test, 'prover') && '64core-tester-x86' || '16core-tester-x86' }} + runner_type: ${{ steps.runner_type.outputs.type }} builder_type: builder-x86 # these are copied to the tester and expected by the earthly command below # if they fail to copy, it will try to build them on the tester and fail @@ -248,7 +256,9 @@ jobs: cd ./yarn-project/end-to-end/ export FORCE_COLOR=1 export EARTHLY_BUILD_ARGS="${{ env.EARTHLY_BUILD_ARGS }}" - ../../scripts/earthly-ci --exec-stats -P --no-output +${{ matrix.test }} + ./scripts/e2e_test.sh ${{ matrix.test }} + + earthly-ci +UPLOAD_LOGS --PULL_REQUEST=${{ github.event.pull_request.number }} --BRANCH=${{ github.ref_name }} --COMMIT_HASH=${{ env.GIT_COMMIT }} acir-bench: runs-on: ubuntu-20.04 @@ -584,7 +594,7 @@ jobs: yarn-project-formatting: needs: [build, configure] - if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' + if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' runs-on: ${{ needs.configure.outputs.username }}-x86 steps: - uses: actions/checkout@v4 @@ -598,7 +608,7 @@ jobs: yarn-project-test: needs: [build, configure] - if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' + if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' runs-on: ${{ needs.configure.outputs.username }}-x86 steps: - uses: actions/checkout@v4 @@ -613,7 +623,7 @@ jobs: prover-client-test: needs: [build, configure] runs-on: ${{ needs.configure.outputs.username }}-x86 - if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' + if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' steps: - uses: actions/checkout@v4 with: { ref: "${{ env.GIT_COMMIT }}" } diff --git a/.github/workflows/nightly-kind-test.yml b/.github/workflows/nightly-kind-test.yml index 255835daa765..668dc341ca6a 100644 --- a/.github/workflows/nightly-kind-test.yml +++ b/.github/workflows/nightly-kind-test.yml @@ -74,8 +74,7 @@ jobs: set -eux ./spartan/scripts/setup_local_k8s.sh export FORCE_COLOR=1 - export EARTHLY_BUILD_ARGS="${{ env.EARTHLY_BUILD_ARGS }}" - ./scripts/earthly-ci --exec-stats -P --no-output ./yarn-project/end-to-end/+kind-network-transfer --values-file=${{ matrix.values_file }} + NAMESPACE=transfer FRESH_INSTALL=true VALUES_FILE=${{ matrix.values_file }} ./scripts/network_test.sh ./src/spartan/transfer.test.ts || true success-check: runs-on: ubuntu-20.04 diff --git a/.github/workflows/sepolia-test.yml b/.github/workflows/sepolia-test.yml index e2e6210f28ab..b389302f2a5f 100644 --- a/.github/workflows/sepolia-test.yml +++ b/.github/workflows/sepolia-test.yml @@ -54,11 +54,11 @@ jobs: set -eux cd ./yarn-project/end-to-end/ export FORCE_COLOR=1 - ../../scripts/earthly-ci -P --no-output +e2e-public-testnet \ - --SEQ_PUBLISHER_PRIVATE_KEY=${{ secrets.SEPOLIA_SEQ_PRIVATE_KEY }} \ - --PROVER_PUBLISHER_PRIVATE_KEY=${{ secrets.SEPOLIA_PROVER_PRIVATE_KEY }} \ - --ETHEREUM_HOST="https://sepolia.infura.io/v3/${{ secrets.SEPOLIA_API_KEY }}" \ - --L1_CHAIN_ID=${{ env.L1_CHAIN_ID }} + SEQ_PUBLISHER_PRIVATE_KEY=${{ secrets.SEPOLIA_SEQ_PRIVATE_KEY }} \ + PROVER_PUBLISHER_PRIVATE_KEY=${{ secrets.SEPOLIA_PROVER_PRIVATE_KEY }} \ + ETHEREUM_HOST="https://sepolia.infura.io/v3/${{ secrets.SEPOLIA_API_KEY }}" \ + L1_CHAIN_ID=${{ env.L1_CHAIN_ID }} \ + ./scripts/e2e_test_public_testnet.sh ./src/public-testnet success-check: runs-on: ubuntu-20.04 diff --git a/Earthfile b/Earthfile index f8eea6475ba8..ed020738d418 100644 --- a/Earthfile +++ b/Earthfile @@ -20,9 +20,6 @@ build: # yarn-project has the entry point to Aztec BUILD ./yarn-project/+build -test-end-to-end: - BUILD ./yarn-project/end-to-end+e2e-tests - release-meta: COPY .release-please-manifest.json /usr/src/.release-please-manifest.json SAVE ARTIFACT /usr/src /usr/src @@ -46,7 +43,7 @@ UPLOAD_LOGS: ENV BRANCH=$BRANCH ENV COMMIT_HASH=$COMMIT_HASH RUN --secret AWS_ACCESS_KEY_ID --secret AWS_SECRET_ACCESS_KEY /usr/src/scripts/logs/upload_logs_to_s3.sh /usr/var/log - + base-log-uploader: # Install awscli on a fresh ubuntu, and copy the repo "scripts" folder, which we'll use to upload logs # Note that we cannot do this LOCALLY because Earthly does not support using secrets locally diff --git a/scripts/ci/get_e2e_jobs.sh b/scripts/ci/get_e2e_jobs.sh index ffd09503d2ed..cc8468935bab 100755 --- a/scripts/ci/get_e2e_jobs.sh +++ b/scripts/ci/get_e2e_jobs.sh @@ -7,46 +7,54 @@ cd "$(dirname "$0")"/../.. BRANCH=$1 LABELS=$2 +# Function to parse YAML and extract test names +get_test_names() { + yq e '.tests | keys | .[]' yarn-project/end-to-end/scripts/e2e_test_config.yml +} + +# Read the full list from the YAML file +full_list=$(get_test_names) + # Define the jobs that will run on every PR allow_list=( - "e2e-2-pxes" - "e2e-authwit" - "e2e-avm-simulator" - "e2e-block-building" - "e2e-cross-chain-messaging" - "e2e-deploy-contract" - "e2e-fees" - "e2e-fees-gas-estimation" - "e2e-fees-private-payments" - "e2e-max-block-number" - "e2e-nested-contract" - "e2e-ordering" - "e2e-static-calls" - "integration-l1-publisher" - "e2e-cheat-codes" - "e2e-prover-fake-proofs" - "e2e-prover-coordination" - "e2e-lending-contract" - "kind-network-smoke" + "e2e_2_pxes" + "e2e_authwit" + "e2e_avm_simulator" + "e2e_block_building" + "e2e_cross_chain_messaging" + "e2e_deploy_contract" + "e2e_fees" + "e2e_fees_gas_estimation" + "e2e_fees_private_payments" + "e2e_max_block_number" + "e2e_nested_contract" + "e2e_ordering" + "e2e_static_calls" + "integration_l1_publisher" + "e2e_cheat_codes" + "e2e_prover_fake_proofs" + "e2e_prover_coordination" + "e2e_lending_contract" + "kind_network_smoke" ) # Add labels from input to the allow_list -IFS=',' read -r -a input_labels <<< "$LABELS" +IFS=',' read -r -a input_labels <<<"$LABELS" allow_list+=("${input_labels[@]}") # Generate full list of targets, excluding specific entries, on one line -full_list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+bench' | grep -v "+network" | grep -v 'devnet' | sed 's/+//' | xargs echo) +test_list=$(echo "${full_list[@]}" | grep -v 'base' | grep -v 'bench' | grep -v "network" | grep -v 'devnet' | xargs echo) -# If branch is master or allow_list contains 'e2e-all', return full list +# # If branch is master or allow_list contains 'e2e-all', return full list if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "e2e-all" ]]; then # print as JSON list - echo "$full_list" | jq -Rc 'split(" ")' + echo "$test_list" | jq -Rc 'split(" ")' exit 0 fi -# Filter the full_list to include only items in the allow_list +# # Filter the test_list to include only items in the allow_list filtered_list=() -for item in $full_list; do +for item in $test_list; do for allowed in "${allow_list[@]}"; do if [[ "$item" == "$allowed" ]]; then filtered_list+=("$item") @@ -54,5 +62,5 @@ for item in $full_list; do done done -# Print the filtered list in JSON format +# # Print the filtered list in JSON format echo ${filtered_list[@]} | jq -Rc 'split(" ")' diff --git a/scripts/ci/select_runner.sh b/scripts/ci/select_runner.sh new file mode 100755 index 000000000000..a4db64dbd991 --- /dev/null +++ b/scripts/ci/select_runner.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Check if the test requires a prover +requires_prover() { + local test_name=$1 + [[ $test_name == *"prover"* ]] +} + +test_name=$1 + +if requires_prover "$test_name"; then + echo "64core-tester-x86" +else + if [[ $test_name == *"bench"* ]]; then + echo "16core-tester-x86" + else + echo "8core-tester-x86" + fi +fi diff --git a/yarn-project/end-to-end/Earthfile b/yarn-project/end-to-end/Earthfile deleted file mode 100644 index bafa08e967d8..000000000000 --- a/yarn-project/end-to-end/Earthfile +++ /dev/null @@ -1,295 +0,0 @@ -VERSION 0.8 - -# Flakey, TODO(https://github.com/AztecProtocol/aztec-packages/issues/9164) -# e2e-p2p: -# LOCALLY -# RUN ./scripts/e2e_test.sh ./src/e2e_p2p/ --runInBand - -e2e-l1-with-wall-time: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_l1_with_wall_time.test.ts - -e2e-synching: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_synching.test.ts - -e2e-2-pxes: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_2_pxes.test.ts - -e2e-nft: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_nft.test.ts - -e2e-prover-full: - LOCALLY - RUN HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} ./scripts/e2e_test.sh ./src/e2e_prover/full - -e2e-prover-fake-proofs: - LOCALLY - RUN FAKE_PROOFS=1 ./scripts/e2e_test.sh ./src/e2e_prover/full - -e2e-prover-coordination: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/prover-coordination - -e2e-account-contracts: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_account_contracts.test.ts - -e2e-authwit: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_authwit.test.ts - -e2e-avm-simulator: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_avm_simulator.test.ts - -e2e-blacklist-token-contract: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_blacklist_token_contract - -e2e-block-building: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_block_building.test.ts - -e2e-bot: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_bot.test.ts - -e2e-card-game: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_card_game.test.ts - -e2e-cheat-codes: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_cheat_codes.test.ts - -e2e-crowdfunding-and-claim: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_crowdfunding_and_claim.test.ts - -e2e-deploy-contract: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_deploy_contract - -e2e-escrow-contract: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_escrow_contract.test.ts - -e2e-keys: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_keys.test.ts - -e2e-lending-contract: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_lending_contract.test.ts - -e2e-max-block-number: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_max_block_number.test.ts - -e2e-multiple-accounts-1-enc-key: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_multiple_accounts_1_enc_key.test.ts - -e2e-nested-contract: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_nested_contract - -e2e-non-contract-account: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_non_contract_account.test.ts - -e2e-note-getter: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_note_getter.test.ts - -e2e-ordering: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_ordering.test.ts - -e2e-outbox: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_outbox.test.ts - -e2e-pending-note-hashes-contract: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_pending_note_hashes_contract.test.ts - -e2e-private-voting-contract: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_private_voting_contract.test.ts - -e2e-fees-private-payments: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_fees/private_payments.test.ts - -e2e-fees-private-refunds: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_fees/private_refunds.test.ts - -e2e-fees-gas-estimation: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_fees/gas_estimation.test.ts - -e2e-fees-dapp-subscription: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_fees/dapp_subscription.test.ts - -e2e-fees-failures: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_fees/failures.test.ts - -e2e-fees-fee-juice-payments: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_fees/fee_juice_payments.test.ts - -e2e-fees-account-init: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_fees/account_init.test.ts - -e2e-cross-chain-messaging: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_cross_chain_messaging - -e2e-state-vars: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_state_vars.test.ts - -e2e-logs: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_event_logs.test.ts - -e2e-static-calls: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_static_calls.test.ts - -e2e-token-contract: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/e2e_token_contract - -# https://github.com/AztecProtocol/aztec-packages/issues/8925 -# e2e-prover-coordination: -# LOCALLY -# RUN ./scripts/e2e_test.sh ./src/prover-coordination/e2e_json_coordination.test.ts - -e2e-public-testnet: - ARG L1_CHAIN_ID="31337" - # automatically exported as ENV variables for below - ARG ETHEREUM_HOST - ARG SEQ_PUBLISHER_PRIVATE_KEY - ARG PROVER_PUBLISHER_PRIVATE_KEY - LOCALLY - RUN ./scripts/e2e_test_public_testnet.sh ./src/public-testnet - -flakey-e2e-tests: - LOCALLY - RUN ./scripts/e2e_test.sh ./src/flakey || true - -e2e-sandbox-example: - LOCALLY - RUN ./scripts/e2e_compose_test.sh e2e_sandbox_example.test.ts - -uniswap-trade-on-l1-from-l2: - LOCALLY - RUN ./scripts/e2e_compose_test.sh uniswap_trade_on_l1_from_l2.test.ts - -integration-l1-publisher: - LOCALLY - RUN ./scripts/e2e_compose_test.sh integration_l1_publisher.test.ts - -# Disabled, TODO https://github.com/AztecProtocol/aztec-packages/issues/6624 -# integration-proof-verification: -# LOCALLY -# RUN COMPOSE_FILE=./scripts/docker-compose-no-sandbox.yml ./scripts/e2e_compose_test.sh integration_proof_verification.test.ts - -e2e-browser: - LOCALLY - RUN ./scripts/e2e_compose_test.sh e2e_aztec_js_browser.test.ts - -pxe: - LOCALLY - RUN ./scripts/e2e_compose_test.sh pxe.test.ts - -e2e-docs-examples: - LOCALLY - RUN ./scripts/e2e_compose_test.sh docs_examples.test.ts - -guides-writing-an-account-contract: - LOCALLY - RUN ./scripts/e2e_compose_test.sh guides/writing_an_account_contract.test.ts - -guides-dapp-testing: - LOCALLY - RUN ./scripts/e2e_compose_test.sh guides/dapp_testing.test.ts - -# The two tests below need to be separated, because there is some crosstalk between the two. TODO (#8813): Figure out why. -guides-sample-dapp-ci: - LOCALLY - RUN ./scripts/e2e_compose_test.sh sample-dapp/ci/index.test.mjs - -guides-sample-dapp: - LOCALLY - RUN ./scripts/e2e_compose_test.sh sample-dapp/index.test.mjs - -guides-up-quick-start: - LOCALLY - RUN ./scripts/e2e_compose_test.sh guides/up_quick_start.test.ts - -bench-publish-rollup: - LOCALLY - ENV COMPOSE_FILE=scripts/docker-compose-no-sandbox.yml - ENV DEBUG="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" - ENV HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} - # redundant, but just to be explicit: - ENV PULL_REQUEST=$PULL_REQUEST - ENV BRANCH=$BRANCH - ENV COMMIT_HASH=$COMMIT_HASH - RUN ./scripts/e2e_compose_test.sh benchmarks/bench_publish_rollup.test.ts - DO ../../+UPLOAD_LOGS --PULL_REQUEST=$PULL_REQUEST --BRANCH=$BRANCH --COMMIT_HASH=$COMMIT_HASH - -# TODO(#9359): regressed seemingly after changes to reorgs -#bench-process-history: -# LOCALLY -# ENV COMPOSE_FILE=scripts/docker-compose-no-sandbox.yml -# ENV DEBUG="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" -# ENV HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} -# # redundant, but just to be explicit: -# ENV PULL_REQUEST=$PULL_REQUEST -# ENV BRANCH=$BRANCH -# ENV COMMIT_HASH=$COMMIT_HASH -# RUN ./scripts/e2e_compose_test.sh benchmarks/bench_process_history.test.ts -# DO ../../+UPLOAD_LOGS --PULL_REQUEST=$PULL_REQUEST --BRANCH=$BRANCH --COMMIT_HASH=$COMMIT_HASH - -bench-tx-size: - LOCALLY - ENV COMPOSE_FILE=scripts/docker-compose-no-sandbox.yml - ENV DEBUG="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" - ENV HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} - # redundant, but just to be explicit: - ENV PULL_REQUEST=$PULL_REQUEST - ENV BRANCH=$BRANCH - ENV COMMIT_HASH=$COMMIT_HASH - RUN ./scripts/e2e_compose_test.sh benchmarks/bench_tx_size_fees.test.ts - DO ../../+UPLOAD_LOGS --PULL_REQUEST=$PULL_REQUEST --BRANCH=$BRANCH --COMMIT_HASH=$COMMIT_HASH - -bench-prover: - LOCALLY - ENV COMPOSE_FILE=scripts/docker-compose-no-sandbox.yml - ENV DEBUG="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" - ENV HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} - # redundant, but just to be explicit: - ENV PULL_REQUEST=$PULL_REQUEST - ENV BRANCH=$BRANCH - ENV COMMIT_HASH=$COMMIT_HASH - RUN ./scripts/e2e_compose_test.sh bench_prover - DO ../../+UPLOAD_LOGS --PULL_REQUEST=$PULL_REQUEST --BRANCH=$BRANCH --COMMIT_HASH=$COMMIT_HASH - -e2e-devnet-smoke: - LOCALLY - RUN COMPOSE_FILE=scripts/docker-compose-devnet.yml ./scripts/e2e_compose_test.sh devnet/e2e_smoke.test.ts - -e2e-cli-wallet: - LOCALLY - RUN COMPOSE_FILE=scripts/docker-compose-wallet.yml ./scripts/e2e_compose_test.sh e2e_cli_wallet diff --git a/yarn-project/end-to-end/scripts/e2e_compose_test.sh b/yarn-project/end-to-end/scripts/e2e_compose_test.sh index eb3e419f6147..531230b83a62 100755 --- a/yarn-project/end-to-end/scripts/e2e_compose_test.sh +++ b/yarn-project/end-to-end/scripts/e2e_compose_test.sh @@ -23,9 +23,9 @@ export AZTEC_DOCKER_TAG="${AZTEC_DOCKER_TAG:-$(git rev-parse HEAD)}" # Set the ARCH_TAG variable for docker compose ARCH=$(uname -m) if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then - export ARCH_TAG="arm64" + export ARCH_TAG="arm64" else - export ARCH_TAG="amd64" + export ARCH_TAG="amd64" fi FORCE_BUILD="${FORCE_BUILD:-true}" @@ -34,15 +34,15 @@ FORCE_BUILD="${FORCE_BUILD:-true}" export JOB_NAME=$(echo "$TEST" | sed 's/\./_/g' | sed 's/\//_/g') # Determine CMD -if docker compose > /dev/null 2>&1; then +if docker compose >/dev/null 2>&1; then CMD="docker compose" else CMD="docker-compose" fi # Optimize image building -if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/aztec:$AZTEC_DOCKER_TAG" || \ - ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"; then +if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/aztec:$AZTEC_DOCKER_TAG" || + ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"; then echo "Docker images not found. They need to be built with 'earthly ./yarn-project/+export-test-images' or otherwise tagged with aztecprotocol/aztec:$AZTEC_DOCKER_TAG and aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG." exit 1 fi diff --git a/yarn-project/end-to-end/scripts/e2e_test.sh b/yarn-project/end-to-end/scripts/e2e_test.sh index 3dcf49edfacc..61871b7bbb0a 100755 --- a/yarn-project/end-to-end/scripts/e2e_test.sh +++ b/yarn-project/end-to-end/scripts/e2e_test.sh @@ -3,21 +3,75 @@ # Usage: ./e2e_test.sh <...extra_args> # Optional environment variables: # HARDWARE_CONCURRENCY (default: "") +# FAKE_PROOFS (default: "") +# COMPOSE_FILE (default: "./scripts/docker-compose.yml") set -eu # Main positional parameter -TEST="$1" +export TEST="$1" shift # Default values for environment variables -HARDWARE_CONCURRENCY="${HARDWARE_CONCURRENCY:-}" -FAKE_PROOFS="${FAKE_PROOFS:-}" -AZTEC_DOCKER_TAG=$(git rev-parse HEAD) +export HARDWARE_CONCURRENCY="${HARDWARE_CONCURRENCY:-}" +export FAKE_PROOFS="${FAKE_PROOFS:-}" +export COMPOSE_FILE="${COMPOSE_FILE:-./scripts/docker-compose.yml}" +export AZTEC_DOCKER_TAG=$(git rev-parse HEAD) +# Function to load test configuration +load_test_config() { + local test_name="$1" + yq e ".tests.${test_name}" "$(dirname "$0")/e2e_test_config.yml" +} + +# Check if Docker images exist if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"; then echo "Docker images not found. They need to be built with 'earthly ./yarn-project/+export-end-to-end' or otherwise tagged with aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG." exit 1 fi -docker run -e HARDWARE_CONCURRENCY="$HARDWARE_CONCURRENCY" -e FAKE_PROOFS="$FAKE_PROOFS" --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG "$TEST" $@ +# Load test configuration +test_config=$(load_test_config "$TEST") + +# Determine the test path +test_path=$(echo "$test_config" | yq e '.test_path // ""' -) +if [ -z "$test_path" ]; then + test_path="${TEST}" +fi + +# Check for ignore_failures +ignore_failures=$(echo "$test_config" | yq e '.ignore_failures // false' -) +if [ "$ignore_failures" = "true" ]; then + echo "Ignoring failures for test $TEST" +fi + +# Check if the test uses docker compose +if [ "$(echo "$test_config" | yq e '.use_compose // false' -)" = "true" ]; then + $(dirname "$0")/e2e_compose_test.sh "$test_path" "$@" || [ "$ignore_failures" = "true" ] +else + # Set environment variables + while IFS='=' read -r key value; do + export "$key=$value" + done < <(echo "$test_config" | yq e '.env // {} | to_entries | .[] | .key + "=" + .value' -) + + # Check for custom command + custom_command=$(echo "$test_config" | yq e '.command // ""' -) + env_args=$(echo "$test_config" | yq e '.env // {} | to_entries | .[] | "-e " + .key + "=" + .value' - | tr '\n' ' ') + if [ -n "$custom_command" ]; then + # Run the docker command + docker run \ + -e HARDWARE_CONCURRENCY="$HARDWARE_CONCURRENCY" \ + -e FAKE_PROOFS="$FAKE_PROOFS" \ + $env_args \ + --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG \ + /bin/bash -c "$custom_command" || [ "$ignore_failures" = "true" ] + else + # Run the default docker command + docker run \ + -e HARDWARE_CONCURRENCY="$HARDWARE_CONCURRENCY" \ + -e FAKE_PROOFS="$FAKE_PROOFS" \ + $env_args \ + --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG \ + "$test_path" "$@" || [ "$ignore_failures" = "true" ] + fi +fi diff --git a/yarn-project/end-to-end/scripts/e2e_test_config.yml b/yarn-project/end-to-end/scripts/e2e_test_config.yml new file mode 100644 index 000000000000..3520f49f1394 --- /dev/null +++ b/yarn-project/end-to-end/scripts/e2e_test_config.yml @@ -0,0 +1,125 @@ +tests: + base: {} + bench_prover: + env: + HARDWARE_CONCURRENCY: "32" + COMPOSE_FILE: "scripts/docker-compose-no-sandbox.yml" + DEBUG: "aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" + command: "./scripts/e2e_compose_test.sh bench_prover" + bench_publish_rollup: + env: + HARDWARE_CONCURRENCY: "32" + COMPOSE_FILE: "scripts/docker-compose-no-sandbox.yml" + DEBUG: "aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" + command: "./scripts/e2e_compose_test.sh bench_publish_rollup" + bench_tx_size: + env: + HARDWARE_CONCURRENCY: "32" + COMPOSE_FILE: "scripts/docker-compose-no-sandbox.yml" + DEBUG: "aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" + command: "./scripts/e2e_compose_test.sh bench_tx_size" + e2e_2_pxes: {} + e2e_account_contracts: {} + e2e_authwit: {} + e2e_avm_simulator: {} + e2e_blacklist_token_contract: {} + e2e_block_building: {} + e2e_bot: {} + e2e_aztec_js_browser: + use_compose: true + e2e_card_game: {} + e2e_cheat_codes: {} + e2e_cross_chain_messaging: {} + e2e_crowdfunding_and_claim: {} + e2e_deploy_contract: {} + e2e_devnet_smoke: {} + docs_examples: + use_compose: true + e2e_escrow_contract: {} + e2e_fees_account_init: + test_path: "e2e_fees/account_init.test.ts" + e2e_fees_dapp_subscription: + test_path: "e2e_fees/dapp_subscription.test.ts" + e2e_fees_failures: + test_path: "e2e_fees/failures.test.ts" + e2e_fees_fee_juice_payments: + test_path: "e2e_fees/fee_juice_payments.test.ts" + e2e_fees_gas_estimation: + test_path: "e2e_fees/gas_estimation.test.ts" + e2e_fees_private_payments: + test_path: "e2e_fees/private_payments.test.ts" + e2e_fees_private_refunds: + test_path: "e2e_fees/private_refunds.test.ts" + e2e_keys: {} + e2e_l1_with_wall_time: {} + e2e_lending_contract: {} + e2e_event_logs: {} + e2e_max_block_number: {} + e2e_multiple_accounts_1_enc_key: {} + e2e_nested_contract: {} + e2e_nft: {} + e2e_non_contract_account: {} + e2e_note_getter: {} + e2e_ordering: {} + e2e_outbox: {} + e2e_pending_note_hashes_contract: {} + e2e_private_voting_contract: {} + e2e_prover_coordination: {} + e2e_prover_fake_proofs: + test_path: "e2e_prover/full.test.ts" + env: + FAKE_PROOFS: "1" + e2e_prover_full: + test_path: "e2e_prover/full.test.ts" + env: + HARDWARE_CONCURRENCY: "32" + e2e_public_testnet: {} + e2e_sandbox_example: + use_compose: true + e2e_state_vars: {} + e2e_static_calls: {} + e2e_synching: {} + e2e_token_contract: {} + flakey_e2e_tests: + test_path: "./src/flakey" + ignore_failures: true + guides_dapp_testing: + use_compose: true + test_path: "guides/dapp_testing.test.ts" + guides_sample_dapp: + use_compose: true + test_path: "sample-dapp/index.test.mjs" + guides_sample_dapp_ci: + use_compose: true + test_path: "sample-dapp/ci/index.test.mjs" + guides_up_quick_start: + use_compose: true + test_path: "guides/up_quick_start.test.ts" + guides_writing_an_account_contract: + use_compose: true + test_path: "guides/writing_an_account_contract.test.ts" + integration_l1_publisher: + use_compose: true + kind_network_4epochs: + env: + NAMESPACE: "smoke" + FRESH_INSTALL: "true" + VALUES_FILE: "$-default.yaml" + command: "./scripts/network_test.sh ./src/spartan/4epochs.test.ts" + ignore_failures: true + kind_network_smoke: + env: + NAMESPACE: "smoke" + FRESH_INSTALL: "true" + VALUES_FILE: "$-default.yaml" + command: "./scripts/network_test.sh ./src/spartan/smoke.test.ts" + kind_network_transfer: + env: + NAMESPACE: "transfer" + FRESH_INSTALL: "true" + VALUES_FILE: "$-default.yaml" + command: "./scripts/network_test.sh ./src/spartan/smoke.test.ts" + pxe: + use_compose: true + uniswap_trade_on_l1_from_l2: + use_compose: true