Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 5c72f27

Browse files
ntampakastestuser-at-490752553772
and
testuser-at-490752553772
authored
Integration tests with ephemeral runners via GitHub ops (#1319)
### Description This PR introduces github-ops functionality to zkevm-circuits/integration-tests, allowing execution on ephemeral AWS hosted runners. Execution mode is parameterized based on event trigger type and prover type selection. ### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [X] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Contents - .github/workflows/integration.yml - integration-tests/run.sh - integration-tests/README.md ``` This PR contains: - A new job that initializes prover and instance type workflow variables - run.sh updated to Compose V2 - Updated README.md file to reflect the updated docker compose commands ``` ### Design choices As per new integration tests execution mode, we run the tests manually, on schedule or on specific GitHub events (PR, push to main). Depending on workflow setup, test is executed either with real or mock prover, thus different AWS instance is selected to accommodate increased resource requirements for real prover. For this reason, we introduced a new job that initializes instance type and prover type variables as job outputs to be used for subsequent jobs (integration-tests). --------- Co-authored-by: testuser-at-490752553772 <[email protected]>
1 parent d808fc9 commit 5c72f27

File tree

3 files changed

+39
-48
lines changed

3 files changed

+39
-48
lines changed

.github/workflows/integration.yml

+33-42
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Integration Tests
22

33
on:
4+
merge_group:
45
schedule:
56
- cron: '50 1 * * SUN'
67
pull_request:
@@ -19,56 +20,40 @@ on:
1920
- real_prover
2021
- mock_prover
2122

22-
jobs:
23-
consecutiveness:
24-
if: github.event_name == 'schedule' ||
25-
github.event_name == 'push' ||
26-
github.event_name == 'workflow_dispatch' ||
27-
contains(github.event.pull_request.labels.*.name, 'trigger-integration-tests')
28-
29-
30-
runs-on: ubuntu-latest
31-
steps:
32-
- uses: mktcode/consecutive-workflow-action@v1
33-
with:
34-
token: ${{ secrets.GITHUB_TOKEN }}
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
3526

36-
wakeuprunner:
27+
jobs:
28+
set-outputs:
3729
if: github.event.pull_request.draft == false
3830

39-
needs: [consecutiveness]
40-
name: Wake up self-hosted runner
41-
runs-on: pse-runner
42-
31+
runs-on: ubuntu-latest
32+
outputs:
33+
instancetype: ${{ steps.set-outputs.outputs.instancetype }}
34+
provertype: ${{ steps.set-outputs.outputs.provertype }}
4335
steps:
44-
- uses: actions/checkout@v2
45-
- run: |
46-
.github/integrationTestsScripts/wakeUpRunner.sh
36+
- id: set-outputs
37+
name: Select instance and prover type
38+
run: |
39+
if [ "${{ github.event.inputs.provertype }}" = "real_prover" ] || [ "${{ github.event_name }}" = "schedule" ]; then
40+
echo "instancetype=r6i.32xlarge" >> "$GITHUB_OUTPUT"
41+
echo "provertype=real_prover" >> "$GITHUB_OUTPUT"
42+
elif [ "${{ github.event.inputs.provertype }}" = "mock_prover" ] || [ -z ${{ github.event.inputs.provertype }} ]; then
43+
echo "instancetype=c5.9xlarge" >> "$GITHUB_OUTPUT"
44+
echo "provertype=mock_prover" >> "$GITHUB_OUTPUT"
45+
else
46+
exit 1
47+
fi
4748
4849
integration-tests:
4950
if: github.event.pull_request.draft == false
5051

51-
needs: [wakeuprunner]
5252
name: Integration Tests
53-
runs-on: integration-tests-runner
53+
runs-on: ["${{github.run_id}}", self-hosted, "${{needs.set-outputs.outputs.instancetype}}"]
54+
needs: set-outputs
5455

55-
defaults:
56-
run:
57-
working-directory: ./integration-tests
5856
steps:
59-
- name: Set provertype to mock_prover for push & pull_request_labelled
60-
run: |
61-
echo "provertype=mock_prover" >> $GITHUB_ENV
62-
if: github.event_name == 'push' ||
63-
github.event_name == 'pull_request'
64-
- name: Set provertype to workflow_dispatch choice
65-
run: |
66-
echo "provertype=${{ inputs.provertype }}" >> $GITHUB_ENV
67-
if: github.event_name == 'workflow_dispatch'
68-
- name: Set provertype to real_prover for scheduled runs
69-
run: |
70-
echo "provertype=real_prover" >> $GITHUB_ENV
71-
if: github.event_name == 'schedule'
7257
- uses: actions/checkout@v2
7358
- uses: actions-rs/toolchain@v1
7459
with:
@@ -88,7 +73,7 @@ jobs:
8873
restore-keys: |
8974
${{ runner.os }}-go-
9075
- name: Cargo cache
91-
uses: actions/cache@v3
76+
uses: actions/cache@v3
9277
with:
9378
path: |
9479
~/.cargo/bin/
@@ -97,14 +82,20 @@ jobs:
9782
~/.cargo/git/db/
9883
target/
9984
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
100-
# Run an initial build in a separate step to split the build time from execution time
85+
# Run an initial build in a separate step to split the build time from execution time
10186
- name: Build bins
10287
run: cargo build --bin gen_blockchain_data
10388
- name: Build tests
10489
run: for testname in rpc circuit_input_builder circuits; do cargo test --profile release --test $testname --features $testname --no-run; done
10590
- run: ./run.sh --steps "setup"
91+
working-directory: integration-tests
10692
- run: ./run.sh --steps "gendata"
93+
working-directory: integration-tests
10794
- run: ./run.sh --steps "tests" --tests "rpc"
95+
working-directory: integration-tests
10896
- run: ./run.sh --steps "tests" --tests "circuit_input_builder"
109-
- run: RUST_TEST_THREADS=1 ./run.sh --steps "tests" --tests "circuits::${{ env.provertype }}"
97+
working-directory: integration-tests
98+
- run: RUST_TEST_THREADS=1 ./run.sh --steps "tests" --tests "circuits::${{ needs.set-outputs.outputs.provertype }}"
99+
working-directory: integration-tests
110100
- run: ./run.sh --steps "cleanup"
101+
working-directory: integration-tests

integration-tests/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ is used like this:
1111
$ ./run.sh --help
1212
Usage: ./run.sh [OPTIONS]
1313
Options:
14-
--sudo Use sudo for docker-compose commands.
14+
--sudo Use sudo for docker compose commands.
1515
--steps ARG Space separated list of steps to do.
1616
Default: "setup gendata tests cleanup".
1717
--tests ARG Space separated list of tests to run.
@@ -21,7 +21,7 @@ $ ./run.sh --help
2121

2222
## Steps
2323
1. Setup: Start the docker container that runs a fresh geth in dev mode, via
24-
docker-compose.
24+
docker compose.
2525
2. Gendata: Run the `gen_blockchain_data` binary found in
2626
`src/bin/gen_blockchain_data.rs` which compiles the contracts, deploys them,
2727
and executes transactions; in order to generate blocks with a variety of
@@ -45,6 +45,6 @@ themselves are defined in `lib.rs`.
4545
## Requirements
4646

4747
The following software needs to be installed to run the integration tests script:
48-
- docker-compose
48+
- docker compose
4949
- Rust toolchain
5050
- `solc` version 0.7.x or 0.8.x

integration-tests/run.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ usage() {
99
cat >&2 << EOF
1010
Usage: $0 [OPTIONS]
1111
Options:
12-
--sudo Use sudo for docker-compoes commands.
12+
--sudo Use sudo for docker compose commands.
1313
--steps ARG Space separated list of steps to do.
1414
Default: "${ARG_DEFAULT_STEPS}".
1515
--tests ARG Space separated list of tests to run.
@@ -76,9 +76,9 @@ done
7676

7777
docker_compose_cmd() {
7878
if [ -n "$ARG_SUDO" ]; then
79-
sudo docker-compose $@
79+
sudo docker compose $@
8080
else
81-
docker-compose $@
81+
docker compose $@
8282
fi
8383
}
8484

0 commit comments

Comments
 (0)