Skip to content

Commit

Permalink
ci: update regression test action (#134)
Browse files Browse the repository at this point in the history
* chore: update regression test action

* chore: nit

* docs: nit

* chore: clean up

* ci: update agglayer build
  • Loading branch information
leovct authored Jun 5, 2024
1 parent 3534cc4 commit b231b01
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 127 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Deploy Kurtosis CDK
name: Deploy

on:
pull_request_target:
Expand Down
52 changes: 5 additions & 47 deletions .github/workflows/regression-tests.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,13 @@
name: Regression Tests
name: Test

on:
workflow_dispatch:
inputs:
zkevm_agglayer:
description: 0xPolygon/agglayer (short commit hash or release tag)
required: true
default: 0.1.4
zkevm_bridge_service:
description: 0xPolygonHermez/zkevm-bridge-service (short commit hash or release tag)
required: true
default: v0.4.2
zkevm_bridge_ui:
description: 0xPolygonHermez/zkevm-bridge-ui (short commit hash or release tag)
required: true
default: '0006445'
zkevm_dac:
description: 0xPolygon/cdk-data-availability (short commit hash or release tag)
required: true
default: 0.0.7
zkevm_node:
description: 0xPolygon/cdk-validium-node (short commit hash or release tag)
required: true
default: 0.6.5-cdk
kurtosis_cli:
description: kurtosis-tech/kurtosis (release tag)
required: false
default: 0.89.3
kurtosis_cdk:
description: 0xPolygon/kurtosis-cdk (release tag)
required: false
default: v0.2.0
bake_time:
description: bake time (minutes)
required: false
default: 30

jobs:
regression_tests:
regression-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Run Regression Tests
uses: 0xPolygon/[email protected]
with:
zkevm_agglayer: ${{ github.event.inputs.zkevm_agglayer }}
zkevm_bridge_service: ${{ github.event.inputs.zkevm_bridge_service }}
zkevm_bridge_ui: ${{ github.event.inputs.zkevm_bridge_ui }}
zkevm_dac: ${{ github.event.inputs.zkevm_dac }}
zkevm_node: ${{ github.event.inputs.zkevm_node }}
kurtosis_cli: ${{ github.event.inputs.kurtosis_cli }}
kurtosis_cdk: ${{ github.event.inputs.kurtosis_cdk }}
bake_time: ${{ github.event.inputs.bake_time }}
uses: 0xPolygon/kurtosis-cdk@main
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To begin, you will need to install [Docker](https://docs.docker.com/get-docker/)
You will also need a few other tools. Run this script to check you have the required versions.

```bash
sh scripts/tool_check.sh
./scripts/tool_check.sh
```

Once that is good and installed on your system, you can run the following command to deploy the complete CDK stack locally.
Expand Down
130 changes: 52 additions & 78 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,56 @@
name: 'Regression Tests - Polygon CDK'
description: 'Deploys local kurtosis CDK devnet and performs series of regression tests.'
author: 'Dan Moore'
name: Regression Tests - Polygon CDK
description: Deploy a local Polygon CDK devnet using Kurtosis and perform series of regression tests
author: [email protected]

inputs:
zkevm_agglayer:
description: 0xPolygon/agglayer (short commit hash or release tag)
required: false
default: 0.1.4
default: '0.1.4'
zkevm_bridge_service:
description: 0xPolygonHermez/zkevm-bridge-service (short commit hash or release tag)
required: false
default: v0.4.2
default: 'v0.4.2'
zkevm_bridge_ui:
description: 0xPolygonHermez/zkevm-bridge-ui (short commit hash or release tag)
required: false
default: '0006445'
zkevm_dac:
description: 0xPolygon/cdk-data-availability (short commit hash or release tag)
required: false
default: 0.0.7
default: '0.0.7'
zkevm_node:
description: 0xPolygon/cdk-validium-node (short commit hash or release tag)
required: false
default: 0.6.5-cdk
default: '0.6.5-cdk'
kurtosis_cli:
description: kurtosis-tech/kurtosis (release tag)
required: false
default: 0.89.3
default: '0.89.3'
kurtosis_cdk:
description: 0xPolygon/kurtosis-cdk (release tag)
required: false
default: v0.2.0
bake_time:
description: bake time (minutes)
required: false
default: 30
default: 'v0.2.0'

runs:
using: "composite"
steps:
# Build docker images.
- name: Clone and build agglayer, if no release tag given
shell: bash
run: |
if [[ ${{ inputs.zkevm_agglayer }} =~ ^[0-9a-fA-F]{7}$ ]]; then
git clone https://github.com/0xPolygon/agglayer.git
cd agglayer
git checkout "${{ inputs.zkevm_agglayer }}"
docker compose -f docker/docker-compose.yaml build --no-cache agglayer
echo "Containerizing commit id: ${{ inputs.zkevm_agglayer }}"
make build
mv ./dist/agglayer .
docker build -t agglayer:local -f ./Dockerfile.release .
else
echo "Skipping building agglayer as release tag provided: ${{ inputs.zkevm_agglayer }}"
fi
- name: Clone and build zkevm-bridge-service, if no release tag given
shell: bash
run: |
Expand All @@ -59,6 +62,7 @@ runs:
else
echo "Skipping building zkevm-bridge-service as release tag provided: ${{ inputs.zkevm_bridge_service }}"
fi
- name: Clone and build zkevm-bridge-ui, if no release tag given
shell: bash
run: |
Expand All @@ -70,17 +74,19 @@ runs:
else
echo "Skipping building zkevm-bridge-ui as release tag provided: ${{ inputs.zkevm_bridge_ui }}"
fi
- name: Clone and build cdk-data-availability, if no release tag given
shell: bash
run: |
if [[ ${{ inputs.zkevm_dac }} =~ ^[0-9a-fA-F]{7}$ ]]; then
git clone https://github.com/0xPolygon/cdk-data-availability.git
cd cdk-data-availability
git checkout "${{ inputs.zkevm_dac }}"
docker build -t cdk-data-availability:local -f ./Dockerfile .
docker build -t cdk-data-availability:local -f ./Dockerfile .
else
echo "Skipping building cdk-data-availability as release tag provided: ${{ inputs.zkevm_dac }}"
fi
- name: Clone and build cdk-validium-node, if no release tag given
shell: bash
run: |
Expand All @@ -92,32 +98,30 @@ runs:
else
echo "Skipping building cdk-validium-node as release tag provided: ${{ inputs.zkevm_node }}"
fi
- name: Install Foundry
shell: bash
run: |
curl -LO https://github.com/foundry-rs/foundry/releases/download/nightly-de33b6af53005037b463318d2628b5cfcaf39916/foundry_nightly_linux_amd64.tar.gz
tar -xzvf foundry_nightly_linux_amd64.tar.gz
- name: Clone internal kurtosis-cdk repo
shell: bash
run: |
git clone https://github.com/0xPolygon/kurtosis-cdk.git
cd kurtosis-cdk
git checkout "${{ inputs.kurtosis_cdk }}"
- name: Install kurtosis
# Install tools
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk
with:
kurtosis-version: ${{ inputs.kurtosis_cli }}

- name: Install polycli
shell: bash
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=${{ inputs.kurtosis_cli }}
kurtosis analytics disable
- name: Install yq
git clone https://github.com/maticnetwork/polygon-cli.git
cd polygon-cli
make install
export PATH="$HOME/go/bin:$PATH"
# Deploy components.
- name: Use specific version of kurtosis-cdk
shell: bash
run: pip3 install yq
- name: Update kurtosis params.yml with custom devnet containers
run: git checkout "${{ inputs.kurtosis_cdk }}"

- name: Use local docker containers
shell: bash
run: |
cd kurtosis-cdk
# when short commit hash given, reference custom image built earlier tagged 'local'
# When short commit hash given, reference custom image built earlier tagged 'local'.
if [[ ${{ inputs.zkevm_agglayer }} =~ ^[0-9a-fA-F]{7}$ ]]; then
agglayer_tag="local"
agglayer_docker_hub="agglayer"
Expand Down Expand Up @@ -157,60 +161,30 @@ runs:
node_tag="${{ inputs.zkevm_node }}"
node_docker_hub="0xpolygon/cdk-validium-node"
fi
cat params.yml
yq -Y --in-place ".args.zkevm_agglayer_image = \"$agglayer_docker_hub:$agglayer_tag\"" params.yml
yq -Y --in-place ".args.zkevm_bridge_service_image = \"$bridge_service_docker_hub:$bridge_service_tag\"" params.yml
yq -Y --in-place ".args.zkevm_bridge_ui_image = \"$bridge_ui_docker_hub:$bridge_ui_tag\"" params.yml
yq -Y --in-place ".args.zkevm_da_image = \"$dac_docker_hub:$dac_tag\"" params.yml
yq -Y --in-place ".args.zkevm_node_image = \"$node_docker_hub:$node_tag\"" params.yml
cat params.yml
- name: Deploy CDK devnet on local github runner
shell: bash
run: |
cd kurtosis-cdk
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
- name: Monitor and report any potential regressions to CI logs
- name: Deploy Kurtosis CDK package
shell: bash
run: |
bake_time=30
end_minute=$(( $(date +'%M') + bake_time))
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
INITIAL_STATUS=$($GITHUB_WORKSPACE/cast rpc zkevm_verifiedBatchNumber 2>/dev/null)
incremented=false
while [ $(date +'%M') -lt $end_minute ]; do
# Attempt to connect to the service
if STATUS=$($GITHUB_WORKSPACE/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: Install polycli and send transaction load for further integration tests
run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .

- name: Monitor verified batches
uses: ./.github/actions/monitor-verified-batches

# Perform loadtest.
- name: Perform load test
shell: bash
run: |
git clone https://github.com/maticnetwork/polygon-cli.git
cd polygon-cli
make install
export PATH="$HOME/go/bin:$PATH"
export PK="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
export PK="$(yq .args.zkevm_l2_admin_private_key params.yml)"
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 5 --mode t
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 10 --mode t
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 10 --mode 2

0 comments on commit b231b01

Please sign in to comment.