Skip to content

Commit

Permalink
ci: introduce composite actions (#131)
Browse files Browse the repository at this point in the history
* ci: add setup composite action

* nit

* ci: add monitor composite action

* ci: debug

* chore: nit

* chore: nit

* chore: clean up

* chore: use kurtosis minor version

* chore: nit

* fix: kurtosis cli version

* chore: nit

* chore: nit

* chore: rename action

* chore: nit

* chore: nit
  • Loading branch information
leovct authored May 30, 2024
1 parent 20029d9 commit 62edb44
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 123 deletions.
21 changes: 21 additions & 0 deletions .github/actions/monitor-cdk-verified-batches/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: monitor-cdk-verified-batches
description: Check that batches are being verified in a CDK environment

inputs:
verified_batches_target:
description: The minimum number of batches to be verified
required: false
default: '30'
timeout:
description: The script timeout in seconds
required: false
default: '600' # 10 minutes

runs:
using: "composite"
steps:
- name: Check that batches are being verified
working-directory: .github/actions/monitor-cdk-verified-batches
shell: bash
run: ./batch_verification_monitor.sh ${{ inputs.verified_batches_target }} ${{ inputs.timeout }}
File renamed without changes.
33 changes: 33 additions & 0 deletions .github/actions/setup-kurtosis-cdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: kurtosis-cdk-setup
description: Install tools to deploy the CDK stack with Kurtosis

inputs:
kurtosis-version:
description: The version of kurtosis
required: false
default: '0.89.12' # https://github.com/kurtosis-tech/kurtosis/releases

runs:
using: "composite"
steps:
- name: Install kurtosis
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-version }}
kurtosis version
- name: Disable kurtosis analytics
shell: bash
run: kurtosis analytics disable

- name: Install yq
shell: bash
run: |
pip3 install yq
yq --version
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
175 changes: 52 additions & 123 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,26 @@ concurrency:
group: deploy-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
KURTOSIS_VERSION: 0.89.3
GO_VERSION: 1.21
BATCH_VERIFICATION_MONITOR_TARGET: 30
BATCH_VERIFICATION_MONITOR_TIMEOUT: 600 # 10 minutes

jobs:
# Deploy the CDK environment in one step, with the gas token feature enabled.
monolithic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version: 1.21
cache-dependency-path: scripts/zkevm-config-diff/go.sum

# 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=${{ env.KURTOSIS_VERSION }}
kurtosis analytics disable
- name: Install yq
run: pip3 install yq

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1

# Deploy components.
- name: Enable gas token feature
run: yq -Y --in-place '.args.zkevm_use_gas_token_contract = true' params.yml
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- name: Deploy Kurtosis CDK package
run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .

- name: Check that batches are being verified
working-directory: ./scripts
run: ./batch_verification_monitor.sh ${{ env.BATCH_VERIFICATION_MONITOR_TARGET }} ${{ env.BATCH_VERIFICATION_MONITOR_TIMEOUT }}
- name: Monitor verified batches
uses: ./.github/actions/monitor-cdk-verified-batches

# Compare configs.
- name: Dump configs
Expand All @@ -76,21 +55,9 @@ jobs:
steps:
- uses: actions/checkout@v4

# 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=${{ env.KURTOSIS_VERSION }}
kurtosis analytics disable
- name: Install yq
run: pip3 install yq

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

# Deploy components.
- name: Disable all deployment steps
run: yq -Y --in-place 'with_entries(if .value | type == "boolean" then .value = false else . end)' params.yml

Expand Down Expand Up @@ -159,9 +126,8 @@ jobs:
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.apply_workload = false' params.yml # reset
- name: Check that batches are being verified
working-directory: ./scripts
run: ./batch_verification_monitor.sh ${{ env.BATCH_VERIFICATION_MONITOR_TARGET }} ${{ env.BATCH_VERIFICATION_MONITOR_TIMEOUT }}
- name: Monitor verified batches
uses: ./.github/actions/monitor-cdk-verified-batches


# Deploy the CDK environment without specifying any parameter file.
Expand All @@ -170,46 +136,43 @@ jobs:
steps:
- uses: actions/checkout@v4

# 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=${{ env.KURTOSIS_VERSION }}
kurtosis analytics disable
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

# Deploy components.
- name: Deploy Kurtosis CDK package
run: kurtosis run --enclave cdk-v1 --image-download always .

- name: Check that batches are being verified
working-directory: ./scripts
run: ./batch_verification_monitor.sh ${{ env.BATCH_VERIFICATION_MONITOR_TARGET }} ${{ env.BATCH_VERIFICATION_MONITOR_TIMEOUT }}
- name: Monitor verified batches
uses: ./.github/actions/monitor-cdk-verified-batches

# Deploy the CDK environment against a local l1 chain with pre-deployed zkevm contracts.
pre-deployed-contracts:
# Deploy the CDK environment with the gas token feature enabled.
gas-token:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# 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=${{ env.KURTOSIS_VERSION }}
kurtosis analytics disable
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- name: Enable gas token feature
run: yq -Y --in-place '.args.zkevm_use_gas_token_contract = true' params.yml

- name: Install yq
run: pip3 install yq
- name: Deploy Kurtosis CDK package
run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Monitor verified batches
uses: ./.github/actions/monitor-cdk-verified-batches

# Deploy the CDK environment against a local l1 chain with pre-deployed zkevm contracts.
pre-deployed-contracts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

# Deploy components.
- name: Deploy L1 and zkEVM contracts
run: |
# Disable all deployment steps.
Expand Down Expand Up @@ -242,96 +205,62 @@ jobs:
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
- name: Monitor verified batches
uses: ./.github/actions/monitor-cdk-verified-batches

# Deploy a standalone permisionless node against Sepolia.
permisionless-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# 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=${{ env.KURTOSIS_VERSION }}
kurtosis analytics disable
- name: Install yq
run: pip3 install yq

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1

# Deploy components.
- name: Only deploy the permisionless node
run: yq -Y --in-place 'with_entries(if .key == "deploy_zkevm_permissionless_node" then .value = true elif .value | type == "boolean" then .value = false else . end)' params.yml
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- name: Configure permisionless node parameters
run: |
yq -Y --in-place '.args.l1_rpc_url = "${{ secrets.ALCHEMY_SEPOLIA_RPC_URL }}"' params.yml
yq -Y --in-place '.args.genesis_file = "templates/permissionless-node/test-genesis.json"' params.yml
- name: Deploy the permisionless node
run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
run: |
# Disable all steps except permisionless node.
yq -Y --in-place 'with_entries(if .key == "deploy_zkevm_permissionless_node" then .value = true elif .value | type == "boolean" then .value = false else . end)' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
# Deploy the CDK environment in rollup mode (data availability).
rollup-da-mode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# 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=${{ env.KURTOSIS_VERSION }}
kurtosis analytics disable
- name: Install yq
run: pip3 install yq
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1

# Deploy components.
- name: Set rollup data availability mode
run: yq -Y --in-place '.args.data_availability_mode = "rollup"' params.yml

- name: Deploy Kurtosis CDK package
run: kurtosis run --enclave cdk-v1 --image-download always .

- name: Check that batches are being verified
working-directory: ./scripts
run: ./batch_verification_monitor.sh ${{ env.BATCH_VERIFICATION_MONITOR_TARGET }} ${{ env.BATCH_VERIFICATION_MONITOR_TIMEOUT }}
- name: Monitor verified batches
uses: ./.github/actions/monitor-cdk-verified-batches

# Deploy the CDK environment in cdk-validium mode (data availability).
cdk-validium-da-mode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# 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=${{ env.KURTOSIS_VERSION }}
kurtosis analytics disable
- name: Install yq
run: pip3 install yq

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

# Deploy components.
- name: Set cdk-validium data availability mode
run: yq -Y --in-place '.args.data_availability_mode = "cdk-validium"' params.yml

- name: Deploy Kurtosis CDK package
run: kurtosis run --enclave cdk-v1 --image-download always .

- name: Check that batches are being verified
working-directory: ./scripts
run: ./batch_verification_monitor.sh ${{ env.BATCH_VERIFICATION_MONITOR_TARGET }} ${{ env.BATCH_VERIFICATION_MONITOR_TIMEOUT }}
- name: Monitor verified batches
uses: ./.github/actions/monitor-cdk-verified-batches

0 comments on commit 62edb44

Please sign in to comment.