Skip to content

Commit

Permalink
probably port CI to toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless committed Sep 18, 2024
1 parent 6da6ad7 commit 938f036
Showing 1 changed file with 91 additions and 83 deletions.
174 changes: 91 additions & 83 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,61 +213,108 @@ jobs:
ci_run pre_download_compilers.sh
ci_run sccache --start-server
- name: Init
- name: Build zk_toolbox
run: ci_run bash -c "./bin/zkt"

- name: Create log directories
run: |
SERVER_LOGS_DIR=logs/server
INTEGRATION_TESTS_LOGS_DIR=logs/integration_tests
INTEGRATION_TESTS_EN_LOGS_DIR=logs/integration_tests/en
SNAPSHOT_RECOVERY_LOGS_DIR=logs/snapshot_recovery/
GENESIS_RECOVERY_LOGS_DIR=logs/genesis_recovery/
EXTERNAL_NODE_LOGS_DIR=logs/external_node
REVERT_LOGS_DIR=logs/revert
mkdir -p $SERVER_LOGS_DIR
mkdir -p $INTEGRATION_TESTS_LOGS_DIR
mkdir -p $INTEGRATION_TESTS_EN_LOGS_DIR
mkdir -p $SNAPSHOT_RECOVERY_LOGS_DIR
mkdir -p $GENESIS_RECOVERY_LOGS_DIR
mkdir -p $EXTERNAL_NODE_LOGS_DIR
mkdir -p $REVERT_LOGS_DIR
echo "SERVER_LOGS_DIR=$SERVER_LOGS_DIR" >> $GITHUB_ENV
echo "INTEGRATION_TESTS_LOGS_DIR=$INTEGRATION_TESTS_LOGS_DIR" >> $GITHUB_ENV
echo "INTEGRATION_TESTS_EN_LOGS_DIR=$INTEGRATION_TESTS_EN_LOGS_DIR" >> $GITHUB_ENV
echo "SNAPSHOT_RECOVERY_LOGS_DIR=$SNAPSHOT_RECOVERY_LOGS_DIR" >> $GITHUB_ENV
echo "GENESIS_RECOVERY_LOGS_DIR=$GENESIS_RECOVERY_LOGS_DIR" >> $GITHUB_ENV
echo "EXTERNAL_NODE_LOGS_DIR=$EXTERNAL_NODE_LOGS_DIR" >> $GITHUB_ENV
echo "REVERT_LOGS_DIR=$REVERT_LOGS_DIR" >> $GITHUB_ENV
- 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/sdk/binaryen
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
ci_run run_retried rustup show
if [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
ci_run zk env dev_validium_docker
ci_run zk config compile dev_validium_docker
else
ci_run zk config compile
fi
ci_run zk init ${{ matrix.base_token == 'Custom' && '--base-token-name BAT' || ''}} ${{ matrix.deployment_mode == 'Validium' && '--validium-mode' || ''}}
# `sleep 5` because we need to wait until server started properly
- name: Run server
ci_run zk_inception ecosystem init --deploy-paymaster --deploy-erc20 \
--deploy-ecosystem --l1-rpc-url=http://localhost:8545 \
--server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \
--server-db-name=zksync_server_localhost_era \
--prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \
--prover-db-name=zksync_prover_localhost_era \
--ignore-prerequisites --verbose \
--observability=false
- name: Initialize gateway chain
run: |
ci_run zk server --components=$SERVER_COMPONENTS &>server.log &
ci_run sleep 5
ci_run zk_inception chain create \
--chain-name gateway \
--chain-id 505 \
--prover-mode no-proofs \
--wallet-creation localhost \
--l1-batch-commit-data-generator-mode rollup \
--base-token-address 0x0000000000000000000000000000000000000001 \
--base-token-price-nominator 1 \
--base-token-price-denominator 1 \
--set-as-default false \
--ignore-prerequisites
ci_run zk_inception chain init \
--deploy-paymaster \
--l1-rpc-url=http://localhost:8545 \
--server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \
--server-db-name=zksync_server_localhost_gateway \
--prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \
--prover-db-name=zksync_prover_localhost_gateway \
--port-offset 2000 \
--chain gateway \
ci_run zk_inception chain convert-to-gateway --chain gateway --ignore-prerequisites
- name: Build test dependencies
run: |
ci_run zk_supervisor test build
- name: Run contract verifier
- name: Run gateway
run: |
ci_run zk contract_verifier &>contract_verifier.log &
ci_run sleep 2
ci_run zk_inception server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
# FIXME: do this only when the sync layer is true
- name: Prepare the server to be the synclayer
ci_run sleep 5
- name: Migrate chain to gateway
run: |
ci_run zk dev2 supply-rich-wallets
ci_run zk contract prepare-sync-layer
ci_run zk contract register-sync-layer-counterpart
# Note that the server will live only for 120s. Since we'll need to restart it
# before migrating it to the sync layer, we'll need to turn it off and update the config
#
# FIXME: The `zk server --clear-l1-txs-history` is needed to clear the history of transactions on the server side.
# It is a workaround and shouild be removed before prod.
- name: Prepare launch sync-layer based chain
ci_run zk_inception chain migrate-to-gateway --chain era --gateway-chain-name gateway
- name: Run era chain
ci_run zk_inception server --ignore-prerequisites --chain era &> ${{ env.SERVER_LOGS_DIR }}/rollup.log &

- name: Run integration tests
run: |
ci_run zk config prepare-l1-hyperchain --env-name test-chain --chain-id 320
ci_run zk env test-chain
ci_run zk config compile test-chain --diff 5
ci_run zk init hyper --skip-contract-compilation-override
ci_run zk contract migrate-to-sync-layer
ci_run zk contract prepare-sync-layer-validators
ci_run zk contract update-config-for-sync-layer
ci_run sleep 120
ci_run zk server >> server2.log 2>&1 &
ci_run sleep 5
ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain era &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/rollup.log &
PID1=$!
- name: Server integration tests
run: ci_run zk test i server
wait $PID1
- name: Upload logs
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: always()
with:
name: logs
path: logs

# FIXME: restore snapshot test
# - name: Snapshot recovery test
Expand Down Expand Up @@ -318,45 +365,6 @@ jobs:
# ci_run sleep 10
# ci_run zk test i upgrade

- name: Show server.log logs
if: always()
run: ci_run cat server.log || true

- name: Show server2.log logs
if: always()
run: ci_run cat server2.log || true

- name: Show contract_verifier.log logs
if: always()
run: ci_run cat contract_verifier.log || true

- name: Show snapshot-creator.log logs
if: always()
run: ci_run cat core/tests/recovery-test/snapshot-creator.log || true
- name: Show snapshot-recovery.log logs
if: always()
run: ci_run cat core/tests/recovery-test/snapshot-recovery.log || true
- name: Show genesis-recovery.log logs
if: always()
run: ci_run cat core/tests/recovery-test/genesis-recovery.log || true

- name: Show revert.log logs
if: always()
run: ci_run cat logs/revert/default/server.log || true

- name: Show upgrade.log logs
if: always()
run: ci_run cat core/tests/upgrade-test/upgrade.log || true

- name: Show fee-projection.log logs
if: always()
run: ci_run cat core/tests/ts-integration/fees.log || true

- name: Show sccache logs
if: always()
run: |
ci_run sccache --show-stats || true
ci_run cat /tmp/sccache_log.txt || true

# FIXME: restore tests with EN and sync layer
# external-node:
Expand Down

0 comments on commit 938f036

Please sign in to comment.