diff --git a/.github/workflows/regression-test.yml b/.github/workflows/regression-test-manual-trigger.yml similarity index 89% rename from .github/workflows/regression-test.yml rename to .github/workflows/regression-test-manual-trigger.yml index 3c36349..f08adfb 100644 --- a/.github/workflows/regression-test.yml +++ b/.github/workflows/regression-test-manual-trigger.yml @@ -1,4 +1,4 @@ -name: Regression Tests +name: Regression Tests - Manual Trigger 'on': workflow_dispatch: inputs: @@ -9,18 +9,6 @@ name: Regression Tests description: bake time (minutes) required: false default: 20 - push: - branches: - - main - inputs: - zkevm_agglayer_commit_id: - description: 0xPolygon/agglayer commit id - required: false - default: '${{ github.event.before }}' # Set default value to commit ID being merged to main - bake_time: - description: bake time (minutes) - required: false - default: 20 jobs: deploy_devnet: runs-on: ubuntu-latest @@ -36,6 +24,7 @@ jobs: git clone https://github.com/0xPolygon/agglayer.git cd agglayer git checkout "${{ github.event.inputs.zkevm_agglayer_commit_id }}" + echo "Containerizing and testing commit: ${{ github.event.inputs.zkevm_agglayer_commit_id }}" docker compose -f docker/docker-compose.yaml build --no-cache agglayer - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 diff --git a/.github/workflows/regression-test-merge-to-main.yml b/.github/workflows/regression-test-merge-to-main.yml new file mode 100644 index 0000000..5337ce4 --- /dev/null +++ b/.github/workflows/regression-test-merge-to-main.yml @@ -0,0 +1,79 @@ +name: Regression Tests - Auto Merge to Main +'on': + push: + branches: + - main + inputs: + bake_time: + description: bake time (minutes) + required: false + default: 20 +jobs: + deploy_devnet: + runs-on: ubuntu-latest + steps: + - name: Set up Docker + uses: docker/setup-buildx-action@v1 + - name: Clone and build agglayer image locally + run: | + git clone https://github.com/0xPolygon/agglayer.git + cd agglayer + git checkout "${{ github.event.before }}" + echo "Containerizing and testing commit: ${{ github.event.before }}" + docker compose -f docker/docker-compose.yaml build --no-cache agglayer + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + - name: Clone internal kurtosis-cdk repo + run: | + git clone https://github.com/0xPolygon/kurtosis-cdk.git + cd kurtosis-cdk + git checkout dan/jit_containers + - name: Install kurtosis + run: | + echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list + sudo apt update + sudo apt install kurtosis-cli + - name: Run kurtosis agent in background, may remove + run: | + kurtosis gateway & # Run cmd in background + - name: Deploy CDK devnet on local github runner + run: | + cd kurtosis-cdk + kurtosis engine restart + kurtosis run --enclave cdk-v1 --args-file params.yml . + - name: Monitor and report any potential regressions to CI logs + run: | + bake_time="${{ github.event.inputs.bake_time }}" + end_minute=$(( $(date +'%M') + bake_time)) + + export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)" + INITIAL_STATUS=$(cast rpc zkevm_verifiedBatchNumber 2>/dev/null) + incremented=false + + while [ $(date +'%M') -lt $end_minute ]; do + # Attempt to connect to the service + if STATUS=$(cast rpc zkevm_verifiedBatchNumber 2>/dev/null); then + echo "ZKEVM_VERIFIED_BATCH_NUMBER: $STATUS" + + # Check if STATUS has incremented + if [ "$STATUS" != "$INITIAL_STATUS" ]; then + incremented=true + echo "ZKEVM_VERIFIED_BATCH_NUMBER successfully incremented to $STATUS. Exiting..." + exit 0 + fi + else + echo "Failed to connect, waiting and retrying..." + sleep 60 + continue + fi + sleep 60 + done + + if ! $incremented; then + echo "ZKEVM_VERIFIED_BATCH_NUMBER did not increment. This may indicate chain experienced a regression. Please investigate." + exit 1 + fi + - name: Finally, remove all devnet resources locally + run: | + cd kurtosis-cdk + kurtosis clean -a