Skip to content

Use rust for building toolbox #1

Use rust for building toolbox

Use rust for building toolbox #1

name: Workflow template for CI jobs for Core Components
on:
workflow_call:
secrets:
DOCKERHUB_USER:
description: "DOCKERHUB_USER"
required: true
DOCKERHUB_TOKEN:
description: "DOCKERHUB_TOKEN"
required: true
env:
CLICOLOR: 1
jobs:
# lint:
# name: lint
# uses: ./.github/workflows/ci-core-lint-reusable.yml
# secrets:
# DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
# DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
build:
runs-on: [matterlabs-ci-runner]
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
submodules: "recursive"
fetch-depth: 0
- name: Build
uses: "actions-rs/toolchain@v1"
run: |
cd zk_toolbox
cargo build --release
# Compress with tar to avoid permission loss
# https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss
- name: Tar zk_toolbox binaries
run: |
tar -C ./zk_toolbox/target/release -cvf zk_toolbox.tar zk_inception zk_supervisor
- name: Upload zk_toolbox binaries
uses: actions/upload-artifact@v4
with:
name: zk_toolbox
path: zk_toolbox.tar
compression-level: 0
tests:
runs-on: [matterlabs-ci-runner]
needs: [build]
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
submodules: "recursive"
fetch-depth: 0
- name: Download zk_toolbox binaries
uses: actions/download-artifact@v4
with:
name: zk_toolbox
path: .
- name: Extract zk_toolbox binaries
run: |
tar -xvf zk_toolbox.tar -C ./bin
- name: Setup environment
run: |
echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV
echo $(pwd)/bin >> $GITHUB_PATH
echo IN_DOCKER=1 >> .env
docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }}
- name: Start services
run: |
ci_localnet_up
ci_run sccache --start-server
- name: Initialize ecosystem
run: |
ci_run git config --global --add safe.directory /usr/src/zksync
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk_inception ecosystem init --deploy-paymaster --deploy-erc20 \
--deploy-ecosystem --l1-rpc-url=http://reth:8545 \
--server-db-url=postgres://postgres:notsecurepassword@postgres:5432 \
--server-db-name=zksync_server_localhost_era \
--prover-db-url=postgres://postgres:notsecurepassword@postgres:5432 \
--prover-db-name=zksync_prover_localhost_era \
--ignore-prerequisites --verbose
- name: Run server
run: |
ci_run zk_inception server --ignore-prerequisites &>server.log &
ci_run sleep 5
- name: Run integration tests
run: |
ci_run zk_supervisor test integration --ignore-prerequisites --verbose
- name: Init external node server
run: |
ci_run zk_inception external-node configs --db-url=postgres://postgres:notsecurepassword@postgres:5432 \
--db-name=zksync_en_localhost_era --l1-rpc-url=http://reth:8545
ci_run zk_inception external-node init --ignore-prerequisites
- name: Run recovery tests (from snapshot)
run: |
ci_run zk_supervisor test recovery --snapshot --ignore-prerequisites --verbose
- name: Run recovery tests (from genesis)
run: |
ci_run zk_supervisor test recovery --ignore-prerequisites --verbose
- name: Run external node server
run: |
ci_run zk_inception external-node run --ignore-prerequisites &>external_node.log &
ci_run sleep 5
- name: Run integration tests en
run: |
ci_run zk_supervisor test integration --ignore-prerequisites --verbose --external-node
- name: Run revert tests
run: |
ci_run zk_supervisor test revert --ignore-prerequisites --verbose
- name: Run revert tests (external node)
run: |
ci_run zk_supervisor test revert --external-node --ignore-prerequisites --verbose
- name: Show server.log logs
if: always()
run: ci_run cat server.log || true
- name: Show external_node.log logs
if: always()
run: ci_run cat external_node.log || true
- name: Show revert.log logs
if: always()
run: ci_run cat ./core/tests/revert-test/revert.log || true