-
Notifications
You must be signed in to change notification settings - Fork 65
112 lines (94 loc) · 3.97 KB
/
rpc-integration-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: QA - RPC Integration Tests
on:
pull_request:
branches:
- master
types:
- opened
- ready_for_review
- synchronize
jobs:
integration-test-suite:
runs-on: self-hosted
env:
ERIGON_DATA_DIR: /opt/erigon/datadir
RPC_TEST_DIR: /opt/rpc-tests
SILKWORM_BUILD_DIR: ${{runner.workspace}}/silkworm/build
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: "0"
- name: Clean Build Directory
run: rm -rf $SILKWORM_BUILD_DIR
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory $SILKWORM_BUILD_DIR
- name: Configure CMake
working-directory: $SILKWORM_BUILD_DIR
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release
- name: Build SilkRpc
working-directory: $SILKWORM_BUILD_DIR
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config Release --target rpcdaemon -j 2
#- name: Put Erigon ("db-producer") in paused state
# run: |
# response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \
# -H "Content-Type: application/json" \
# -d '{"status":"paused"}')
# if [ "$response" -ne 200 ]; then
# echo "::error::Failed to pause Erigon, reason= $response"
# exit 1
# fi
- name: Run SilkRpc
working-directory: $SILKWORM_BUILD_DIR/cmd
run: |
./rpcdaemon --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 &
RPC_DAEMON_PID=$!
- name: Run integration tests
id: test_step
run: |
cd $RPC_TEST_DIR/integration
# Run Erigon, send ctrl-c and check logs
python3 ./run_tests.py --continue --blockchain mainnet --jwt $SILKWORM_BUILD_DIR/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json
# Capture monitoring script exit status
monitoring_exit_status=$?
# Clean up Erigon process if it's still running
if kill -0 $RPC_DAEMON_PID 2> /dev/null; then
echo "Terminating rpc-daemon"
kill $RPC_DAEMON_PID
wait $RPC_DAEMON_PID
else
echo "rpc-daemon has already terminated"
fi
# Check monitoring script exit status
if [ $monitoring_exit_status -eq 0 ]; then
echo "Tests completed successfully"
echo "::notice::Tests completed successfully"
echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT"
else
echo "Error detected during tests"
echo "::error::Error detected during tests"
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
fi
- name: Resume Erigon ("db-producer")
if: always()
run: |
response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \
-H "Content-Type: application/json" \
-d '{"status":"resumed"}')
if [ "$response" -ne 200 ]; then
echo "Request failed with status $response"
echo "::warning::Failed to resume Erigon, reason= $response"
fi
- name: Action for Success
if: steps.test_step.outputs.TEST_RESULT == 'success'
run: echo "::notice::Tests completed successfully"
- name: Action for Not Success
if: steps.test_step.outputs.TEST_RESULT != 'success'
run: |
echo "::error::Error detected during tests"
exit 1