Skip to content

Test

Test #13

name: regression-tests
on:
workflow_dispatch:
inputs:
zkevm_agglayer_commit_id:
description: 0xPolygon/agglayer (commit id)
required: true
zkevm_bridge_service_commit_id:
description: 0xPolygonHermez/zkevm-bridge-service (commit id)
required: true
zkevm_bridge_ui_commit_id:
description: 0xPolygonHermez/zkevm-bridge-ui (commit id)
required: true
zkevm_dac_commit_id:
description: 0xPolygon/cdk-data-availability (commit id)
required: true
zkevm_node_commit_id:
description: 0xPolygon/cdk-validium-node (commit id)
required: true
bake_time:
description: bake time (minutes)
required: false
default: 30
jobs:
regression-tests:
runs-on: ubuntu-latest
steps:
- name: Log inputs
run: |
echo "zkevm_agglayer_commit_id: ${{ github.event.inputs.zkevm_agglayer_commit_id }}"
echo "zkevm_bridge_service_commit_id: ${{ github.event.inputs.zkevm_bridge_service_commit_id }}"
echo "zkevm_bridge_ui_commit_id: ${{ github.event.inputs.zkevm_bridge_ui_commit_id }}"
echo "zkevm_dac_commit_id: ${{ github.event.inputs.zkevm_dac_commit_id }}"
echo "zkevm_node_commit_id: ${{ github.event.inputs.zkevm_node_commit_id }}"
echo "bake_time: ${{ github.event.inputs.bake_time }}"
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
# Build docker images.
- uses: actions/setup-go@v5
with:
go-version: 1.21.x
- name: Build zkevm-agglayer
run: |
git clone https://github.com/0xPolygon/agglayer.git
pushd agglayer || exit
git checkout "${{ github.event.inputs.zkevm_agglayer_commit_id }}"
make build
mv ./dist/agglayer .
docker build -t zkevm-agglayer:local -f ./Dockerfile.release .
popd || exit
rm -rf agglayer
- name: Build zkevm-bridge-service
run: |
git clone https://github.com/0xPolygonHermez/zkevm-bridge-service.git
pushd zkevm-bridge-service || exit
git checkout "${{ github.event.inputs.zkevm_bridge_service_commit_id }}"
docker build -t zkevm-bridge-service:local -f ./Dockerfile .
popd || exit
rm -rf zkevm-bridge-service
- name: Build zkevm-bridge-ui
run: |
git clone https://github.com/0xPolygonHermez/zkevm-bridge-ui.git
pushd zkevm-bridge-ui || exit
git checkout "${{ github.event.inputs.zkevm_bridge_ui_commit_id }}"
docker build -t zkevm-bridge-ui:local -f ./Dockerfile .
popd || exit
rm -rf zkevm-bridge-ui
- name: Build cdk-data-availability
run: |
git clone https://github.com/0xPolygon/cdk-data-availability.git
pushd cdk-data-availability || exit
git checkout "${{ github.event.inputs.zkevm_dac_commit_id }}"
docker build -t cdk-data-availability:local -f ./Dockerfile .
popd || exit
rm -rf cdk-data-availability
- name: Build cdk-validium-node
run: |
git clone https://github.com/0xPolygon/cdk-validium-node.git
pushd cdk-validium-node || exit
git checkout "${{ github.event.inputs.zkevm_node_commit_id }}"
docker build -t cdk-validium-node:local -f ./Dockerfile .
popd || exit
rm -rf cdk-validium-node
# Install tools.
- 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
kurtosis analytics disable
- name: Install yq
run: pip3 install yq
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
# Deploy components.
- name: Update params.yml to use local docker images
run: |
yq -Y --in-place '.zkevm_agglayer_image = "zkevm-agglayer:local"' params.yml
yq -Y --in-place '.zkevm_bridge_service_image = "zkevm-bridge-service:local"' params.yml
yq -Y --in-place '.zkevm_bridge_ui_image = "zkevm-bridge-ui:local"' params.yml
yq -Y --in-place '.cdk_da_image = "cdk-data-availability:local"' params.yml
yq -Y --in-place '.cdk_validium_node_image = "cdk-validium-node:local"' params.yml
- name: Deploy Kurtosis CDK package
run: kurtosis run --enclave cdk-v1 --args-file params.yml .
- name: Check that batches are being verified
run: |
timeout_minutes="${{ github.event.inputs.bake_time }}"
start_time=$(date +%s)
end_time=$((start_time + timeout_minutes*60))
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
while true; do
current_time=$(date +%s)
if (( current_time > end_time )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ❌ Exiting... Timeout reached. No batches were verified."
exit 1
fi
verified_batches=$(cast to-dec $(cast rpc zkevm_verifiedBatchNumber | sed 's/"//g'))
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Verified Batches: $verified_batches"
if (( verified_batches > 5 )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✅ Exiting... At least five batches were verified."
exit 0
fi
sleep 10
done