Skip to content

test(stress): add stress test with ceremony params #74

test(stress): add stress test with ceremony params

test(stress): add stress test with ceremony params #74

name: Nightly Ceremony
on:
push:
branches:
- test/stress-test
env:
STATE_TREE_DEPTH: ${{ vars.STATE_TREE_DEPTH }}
jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-04950f0be945cc4c7
ec2-instance-type: t3.2xlarge
subnet-id: subnet-0817be1b2160793b5
security-group-id: sg-0aea3cbb15e30a921
aws-resource-tags: >
[
{ "Key": "Name", "Value": "maci-github-runner" },
{ "Key": "GitHubRepository", "Value": "${{ github.repository }}" }
]
test-with-ceremony-keys:
# required to start the main job when the runner is ready
needs: start-runner
# run the job on the newly created runner
runs-on: ${{ needs.start-runner.outputs.label }}
steps:
- uses: actions/checkout@v4
with:
ref: test/stress-test
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --yes \
build-essential \
libgmp-dev \
libsodium-dev \
nasm \
nlohmann-json3-dev
- name: Install
run: |
pnpm install --frozen-lockfile --prefer-offline
- name: Build
run: |
pnpm run build
- name: Run hardhat fork
run: |
cd contracts
pnpm run hardhat &
- name: Download rapidsnark (1c137)
run: |
mkdir -p ~/rapidsnark/build
wget -qO ~/rapidsnark/build/prover https://maci-devops-zkeys.s3.ap-northeast-2.amazonaws.com/rapidsnark-linux-amd64-1c137
chmod +x ~/rapidsnark/build/prover
- name: Download ceremony artifacts
run: ./.github/scripts/download-ceremony-artifacts.sh
- name: Run stress tests
run: pnpm run test:stress
- name: Stop Hardhat
if: always()
run: kill $(lsof -t -i:8545)
stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- test-with-ceremony-keys # required to wait when the main job is done
runs-on: ubuntu-latest
# required to stop the runner even if the error happened in the previous jobs
if: ${{ always() }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}