Skip to content

Commit

Permalink
integrate solana tests into CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Jul 17, 2024
1 parent 77953c8 commit 39497f4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ on:
type: boolean
required: false
default: false
solana-test:
type: boolean
required: false
default: false

concurrency:
group: e2e-${{ github.head_ref || github.sha }}
Expand All @@ -66,7 +70,7 @@ jobs:
PERFORMANCE_TESTS: ${{ steps.matrix-conditionals.outputs.PERFORMANCE_TESTS }}
STATEFUL_DATA_TESTS: ${{ steps.matrix-conditionals.outputs.STATEFUL_DATA_TESTS }}
TSS_MIGRATION_TESTS: ${{ steps.matrix-conditionals.outputs.TSS_MIGRATION_TESTS }}

SOLANA_TESTS: ${{ steps.matrix-conditionals.outputs.SOLANA_TESTS }}
steps:
# use api rather than event context to avoid race conditions (label added after push)
- id: matrix-conditionals
Expand All @@ -89,6 +93,7 @@ jobs:
core.setOutput('PERFORMANCE_TESTS', labels.includes('PERFORMANCE_TESTS'));
core.setOutput('STATEFUL_DATA_TESTS', labels.includes('STATEFUL_DATA_TESTS'));
core.setOutput('TSS_MIGRATION_TESTS', labels.includes('TSS_MIGRATION_TESTS'));
core.setOutput('SOLANA_TESTS', labels.includes('SOLANA_TESTS'));
} else if (context.eventName === 'merge_group') {
core.setOutput('DEFAULT_TESTS', true);
} else if (context.eventName === 'push' && context.ref === 'refs/heads/develop') {
Expand All @@ -109,6 +114,7 @@ jobs:
core.setOutput('ADMIN_TESTS', true);
core.setOutput('PERFORMANCE_TESTS', true);
core.setOutput('STATEFUL_DATA_TESTS', true);
core.setOutput('SOLANA_TESTS', true);
} else if (context.eventName === 'workflow_dispatch') {
core.setOutput('DEFAULT_TESTS', context.payload.inputs['default-test']);
core.setOutput('UPGRADE_TESTS', context.payload.inputs['upgrade-test']);
Expand All @@ -118,6 +124,7 @@ jobs:
core.setOutput('PERFORMANCE_TESTS', context.payload.inputs['performance-test']);
core.setOutput('STATEFUL_DATA_TESTS', context.payload.inputs['stateful-data-test']);
core.setOutput('TSS_MIGRATION_TESTS', context.payload.inputs['tss-migration-test']);
core.setOutput('SOLANA_TESTS', context.payload.inputs['solana-test']);
}
e2e:
Expand Down Expand Up @@ -150,6 +157,9 @@ jobs:
- make-target: "start-tss-migration-test"
runs-on: ubuntu-20.04
run: ${{ needs.matrix-conditionals.outputs.TSS_MIGRATION_TESTS == 'true' }}
- make-target: "start-solana-test"
runs-on: ubuntu-20.04
run: ${{ needs.matrix-conditionals.outputs.SOLANA_TESTS == 'true' }}
name: ${{ matrix.make-target }}
uses: ./.github/workflows/reusable-e2e.yml
with:
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ start-tss-migration-test: zetanode
export E2E_ARGS="--test-tss-migration" && \
cd contrib/localnet/ && $(DOCKER) compose up -d

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

###############################################################################
### Upgrade Tests ###
###############################################################################
Expand Down
14 changes: 9 additions & 5 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
flagTestAdmin = "test-admin"
flagTestPerformance = "test-performance"
flagTestCustom = "test-custom"
flagTestSolana = "test-solana"
flagSkipRegular = "skip-regular"
flagLight = "light"
flagSetupOnly = "setup-only"
Expand Down Expand Up @@ -62,6 +63,7 @@ func NewLocalCmd() *cobra.Command {
cmd.Flags().Bool(flagTestAdmin, false, "set to true to run admin tests")
cmd.Flags().Bool(flagTestPerformance, false, "set to true to run performance tests")
cmd.Flags().Bool(flagTestCustom, false, "set to true to run custom tests")
cmd.Flags().Bool(flagTestSolana, false, "set to true to run solana tests")
cmd.Flags().Bool(flagSkipRegular, false, "set to true to skip regular tests")
cmd.Flags().Bool(flagLight, false, "run the most basic regular tests, useful for quick checks")
cmd.Flags().Bool(flagSetupOnly, false, "set to true to only setup the networks")
Expand All @@ -84,6 +86,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
testAdmin = must(cmd.Flags().GetBool(flagTestAdmin))
testPerformance = must(cmd.Flags().GetBool(flagTestPerformance))
testCustom = must(cmd.Flags().GetBool(flagTestCustom))
testSolana = must(cmd.Flags().GetBool(flagTestSolana))
skipRegular = must(cmd.Flags().GetBool(flagSkipRegular))
light = must(cmd.Flags().GetBool(flagLight))
setupOnly = must(cmd.Flags().GetBool(flagSetupOnly))
Expand Down Expand Up @@ -176,7 +179,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) {

deployerRunner.SetupEVM(contractsDeployed, true)
deployerRunner.SetZEVMContracts()
deployerRunner.SetSolanaContracts(conf.AdditionalAccounts.UserSolana.SolanaPrivateKey.String())
if testSolana {
deployerRunner.SetSolanaContracts(conf.AdditionalAccounts.UserSolana.SolanaPrivateKey.String())
}
noError(deployerRunner.FundEmissionsPool())

deployerRunner.MintERC20OnEvm(10000)
Expand Down Expand Up @@ -239,9 +244,6 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
e2etests.TestMessagePassingZEVMtoEVMRevertFailName,
e2etests.TestMessagePassingEVMtoZEVMRevertFailName,
}
solanaTests := []string{
e2etests.TestSolanaDepositName,
}

bitcoinTests := []string{
e2etests.TestBitcoinDepositName,
Expand Down Expand Up @@ -284,7 +286,6 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
eg.Go(zetaTestRoutine(conf, deployerRunner, verbose, zetaTests...))
eg.Go(zevmMPTestRoutine(conf, deployerRunner, verbose, zevmMPTests...))
eg.Go(bitcoinTestRoutine(conf, deployerRunner, verbose, !skipBitcoinSetup, testHeader, bitcoinTests...))
eg.Go(solanaTestRoutine(conf, deployerRunner, verbose, solanaTests...))
eg.Go(ethereumTestRoutine(conf, deployerRunner, verbose, testHeader, ethereumTests...))
}

Expand All @@ -310,6 +311,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
if testCustom {
eg.Go(miscTestRoutine(conf, deployerRunner, verbose, e2etests.TestMyTestName))
}
if testSolana {
eg.Go(solanaTestRoutine(conf, deployerRunner, verbose, e2etests.TestSolanaDepositName))
}

// while tests are executed, monitor blocks in parallel to check if system txs are on top and they have biggest priority
txPriorityErrCh := make(chan error, 1)
Expand Down
3 changes: 3 additions & 0 deletions contrib/localnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ services:
image: solana-local:latest
container_name: solana
hostname: solana
profiles:
- solana
- all
ports:
- "8899:8899"
networks:
Expand Down

0 comments on commit 39497f4

Please sign in to comment.