Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/sim-import-export' into sim-impo…
Browse files Browse the repository at this point in the history
…rt-export
  • Loading branch information
kingpinXD committed Oct 24, 2024
2 parents 4b0dda4 + 6fcad07 commit e8d127a
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 92 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/sim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Simulation Tests Workflow

on:
push:
branches:
- main
- develop
pull_request:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
inputs:
make-targets:
description: 'Comma separated list of make targets to run (e.g., test-sim-nondeterminism, test-sim-fullappsimulation)'
required: true
default: ''

concurrency:
group: simulation-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
matrix-conditionals:
runs-on: ubuntu-22.04
outputs:
SIM_TEST_NOND: ${{ steps.matrix-conditionals.outputs.SIM_TEST_NOND }}
SIM_TEST_FULL: ${{ steps.matrix-conditionals.outputs.SIM_TEST_FULL }}
SIM_TEST_IMPORT_EXPORT: ${{ steps.matrix-conditionals.outputs.SIM_TEST_IMPORT_EXPORT }}
SIM_TEST_AFTER_IMPORT: ${{ steps.matrix-conditionals.outputs.SIM_TEST_AFTER_IMPORT }}
steps:
- id: matrix-conditionals
uses: actions/github-script@v7
with:
script: |
const makeTargets = context.payload.inputs['make-targets'].split(',');
core.setOutput('SIM_TEST_NOND', makeTargets.includes('test-sim-nondeterminism'));
core.setOutput('SIM_TEST_FULL', makeTargets.includes('test-sim-fullappsimulation'));
core.setOutput('SIM_TEST_IMPORT_EXPORT', makeTargets.includes('test-sim-import-export'));
core.setOutput('SIM_TEST_AFTER_IMPORT', makeTargets.includes('test-sim-after-import'));
simulation-tests:
needs: matrix-conditionals
strategy:
fail-fast: false
matrix:
include:
- make-target: "test-sim-nondeterminism"
runs-on: ubuntu-22.04
run: ${{ needs.matrix-conditionals.outputs.SIM_TEST_NOND == 'true' }}
- make-target: "test-sim-fullappsimulation"
runs-on: ubuntu-22.04
run: ${{ needs.matrix-conditionals.outputs.SIM_TEST_FULL == 'true' }}
- make-target: "test-sim-import-export"
runs-on: ubuntu-22.04
run: ${{ needs.matrix-conditionals.outputs.SIM_TEST_IMPORT_EXPORT == 'true' }}
- make-target: "test-sim-after-import"
runs-on: ubuntu-22.04
run: ${{ needs.matrix-conditionals.outputs.SIM_TEST_AFTER_IMPORT == 'true' }}
name: ${{ matrix.make-target }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Install dependencies
run: make runsim

- name: Run ${{ matrix.make-target }}
run: |
make ${{ matrix.make-target }}
sim-ok:
runs-on: ubuntu-22.04
needs:
- matrix-conditionals
- simulation-tests
if: always()
steps:
- name: Aggregate Results
run: |
result="${{ needs.simulation-tests.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi
76 changes: 0 additions & 76 deletions .github/workflows/simulation-test.yaml

This file was deleted.

30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DOCKER ?= docker
# allow setting of NODE_COMPOSE_ARGS to pass additional args to docker compose
# useful for setting profiles and/ort optional overlays
# example: NODE_COMPOSE_ARGS="--profile monitoring -f docker-compose-persistent.yml"
DOCKER_COMPOSE ?= $(DOCKER) compose $(NODE_COMPOSE_ARGS)
DOCKER_COMPOSE ?= $(DOCKER) compose -f docker-compose.yml $(NODE_COMPOSE_ARGS)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
GOFLAGS := ""
GOLANG_CROSS_VERSION ?= v1.22.4
Expand Down Expand Up @@ -221,11 +221,11 @@ start-localnet: zetanode start-localnet-skip-build
start-localnet-skip-build:
@echo "--> Starting localnet"
export LOCALNET_MODE=setup-only && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d

# stop-localnet should include all profiles so other containers are also removed
stop-localnet:
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile all -f docker-compose.yml down --remove-orphans
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile all down --remove-orphans

###############################################################################
### E2E tests ###
Expand Down Expand Up @@ -253,22 +253,22 @@ start-e2e-test: zetanode
start-e2e-admin-test: zetanode
@echo "--> Starting e2e admin test"
export E2E_ARGS="--skip-regular --test-admin" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile eth2 -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile eth2 up -d

start-e2e-performance-test: zetanode
@echo "--> Starting e2e performance test"
export E2E_ARGS="--test-performance" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress up -d

start-e2e-import-mainnet-test: zetanode
@echo "--> Starting e2e import-data test"
export ZETACORED_IMPORT_GENESIS_DATA=true && \
export ZETACORED_START_PERIOD=15m && \
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) -f docker-compose.yml up -d
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) up -d

start-stress-test: zetanode
@echo "--> Starting stress test"
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress up -d

start-tss-migration-test: zetanode
@echo "--> Starting tss migration test"
Expand All @@ -279,17 +279,17 @@ start-tss-migration-test: zetanode
start-solana-test: zetanode solana
@echo "--> Starting solana test"
export E2E_ARGS="--skip-regular --test-solana" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile solana -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile solana up -d

start-ton-test: zetanode
@echo "--> Starting TON test"
export E2E_ARGS="--skip-regular --test-ton" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile ton -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile ton up -d

start-v2-test: zetanode
@echo "--> Starting e2e smart contracts v2 test"
export E2E_ARGS="--skip-regular --test-v2" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d

###############################################################################
### Upgrade Tests ###
Expand Down Expand Up @@ -321,20 +321,20 @@ start-upgrade-test: zetanode-upgrade
@echo "--> Starting upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=225 && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d

start-upgrade-test-light: zetanode-upgrade
@echo "--> Starting light upgrade test (no ZetaChain state populating before upgrade)"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=90 && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d

start-upgrade-test-admin: zetanode-upgrade
@echo "--> Starting admin upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=90 && \
export E2E_ARGS="--skip-regular --test-admin" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d

# this test upgrades from v18 and execute the v2 contracts migration process
# this tests is part of upgrade test part because it should run the upgrade from v18 to fully replicate the upgrade process
Expand All @@ -343,7 +343,7 @@ start-upgrade-v2-migration-test: zetanode-upgrade
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=90 && \
export E2E_ARGS="--test-v2-migration" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d


start-upgrade-import-mainnet-test: zetanode-upgrade
Expand All @@ -352,7 +352,7 @@ start-upgrade-import-mainnet-test: zetanode-upgrade
export ZETACORED_IMPORT_GENESIS_DATA=true && \
export ZETACORED_START_PERIOD=15m && \
export UPGRADE_HEIGHT=225 && \
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion docs/development/LOCAL_TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This uses `docker compose` to start the localnet and run standard e2e tests insi
More options directly to `docker compose` via the `NODE_COMPOSE_ARGS` variable. This allows setting additional profiles or configuring an overlay. Example:

```
example: NODE_COMPOSE_ARGS="--profile monitoring -f docker-compose-persistent.yml"`
export NODE_COMPOSE_ARGS="--profile monitoring -f docker-compose-persistent.yml"
make start-e2e-test
```

Expand Down

0 comments on commit e8d127a

Please sign in to comment.