Skip to content

Commit ff173df

Browse files
committed
add execution test workflow
1 parent bfdf5e6 commit ff173df

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

.github/workflows/execution-test.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: QA - Execution Test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
stop_at_block:
7+
description: 'Block number to stop at; none for all'
8+
required: true
9+
stop_at_stage:
10+
description: 'Stage to stop at; none for all; sample values: "Execution", "IntermediateHashes", "HashState", "HistoryIndex"'
11+
required: false
12+
type: string
13+
14+
jobs:
15+
integration-test-suite:
16+
runs-on: self-hosted
17+
env:
18+
ERIGON_QA_PATH: /opt/erigon-qa
19+
CHAIN: mainnet
20+
STOP_AT_BLOCK: ${{github.event.inputs.stop_at_block}}
21+
STOP_AT_STAGE: ${{github.event.inputs.stop_at_stage}}
22+
23+
steps:
24+
- name: Checkout Silkworm Repository
25+
uses: actions/checkout@v4
26+
with:
27+
submodules: recursive
28+
fetch-depth: "0"
29+
30+
- name: Clean Build Directory
31+
run: rm -rf ${{runner.workspace}}/silkworm/build
32+
33+
- name: Create Build Environment
34+
run: cmake -E make_directory ${{runner.workspace}}/silkworm/build
35+
36+
- name: Configure CMake
37+
working-directory: ${{runner.workspace}}/silkworm/build
38+
run: |
39+
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release
40+
41+
- name: Build Silkworm
42+
working-directory: ${{runner.workspace}}/silkworm/build
43+
run: cmake --build . --config Release --target silkworm -j 8
44+
45+
- name: Pause the Erigon instance dedicated to db maintenance
46+
run: |
47+
python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true
48+
49+
- name: Start Silkworm
50+
working-directory: ${{runner.workspace}}/silkworm/build/cmd
51+
run: |
52+
echo "Silkworm RpcDaemon starting..."
53+
./silkworm --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check --ws &
54+
SILKWORM_PID=$!
55+
echo "SILKWORM_PID=$SILKWORM_PID" >> $GITHUB_ENV
56+
echo "Silkworm started"
57+
58+
- name: Run RPC Integration Tests
59+
id: test_step
60+
working-directory: ${{runner.workspace}}/silkworm/build/cmd
61+
run: |
62+
set +e # Disable exit on error
63+
64+
# Run Erigon, wait sync and check ability to maintain sync
65+
python3 $ERIGON_QA_PATH/test_system/qa-tests/silkworm/run_and_check_execution.py \
66+
${{runner.workspace}}/silkworm/build/cmd ${{runner.workspace}}/silkworm_datadir $ERIGON_DATA_DIR $TRACKING_TIME_SECONDS $TOTAL_TIME_SECONDS $CHAIN
67+
68+
# Capture monitoring script exit status
69+
test_exit_status=$?
70+
71+
# Save the subsection reached status
72+
echo "::set-output name=test_executed::true"
73+
74+
# Check test runner exit status
75+
if [ $test_exit_status -eq 0 ]; then
76+
echo "tests completed successfully"
77+
echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT"
78+
else
79+
echo "error detected during tests"
80+
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
81+
fi
82+
83+
- name: Stop Silkworm
84+
working-directory: ${{runner.workspace}}/silkworm/build/cmd
85+
run: |
86+
# Clean up silkworm process if it's still running
87+
if kill -0 $SILKWORM_PID 2> /dev/null; then
88+
echo "Silkworm stopping..."
89+
kill $SILKWORM_PID
90+
echo "Silkworm stopped"
91+
else
92+
echo "Silkworm has already terminated"
93+
fi
94+
95+
- name: Resume the Erigon instance dedicated to db maintenance
96+
run: |
97+
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true
98+
99+
- name: Upload test results
100+
if: always()
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: test-results
104+
path: ${{runner.workspace}}/result-${{ env.CHAIN }}.json
105+
106+
- name: Upload Silkworm full log
107+
if: always()
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: silkworm-log
111+
path: ${{runner.workspace}}/silkworm/build/cmd/silkworm.log
112+
113+
- name: Action for Success
114+
if: steps.test_step.outputs.TEST_RESULT == 'success'
115+
run: echo "::notice::Tests completed successfully"
116+
117+
- name: Action for Failure
118+
if: steps.test_step.outputs.TEST_RESULT != 'success'
119+
run: |
120+
echo "::error::Error detected during tests"
121+
exit 1
122+

0 commit comments

Comments
 (0)