Skip to content

Commit

Permalink
tests: workflow for perf tests (#1810)
Browse files Browse the repository at this point in the history
Co-authored-by: canepat <[email protected]>
  • Loading branch information
mriccobene and canepat authored Feb 12, 2024
1 parent efe41b5 commit 1de8504
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/rpc-performance-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: QA - RPC Performance Tests

on:
schedule:
- cron: '0 0 * * *' # Run every day at 00:00 AM UTC

jobs:
performance-test-suite:
runs-on: self-hosted
env:
ERIGON_DATA_DIR: /opt/erigon/datadir
RPC_PAST_TEST_DIR: /opt/rpc-past-tests

steps:
- name: Checkout Silkworm repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: "0"

- name: Checkout RPC Tests Repository & Install Requirements
run: |
rm -rf ${{runner.workspace}}/rpc-tests
git -c advice.detachedHead=false clone --depth 1 --branch v0.1.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
cd ${{runner.workspace}}/rpc-tests
pip3 install -r requirements.txt
- name: Clean Build Directory
run: rm -rf ${{runner.workspace}}/silkworm/build

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/silkworm/build

- name: Configure CMake
working-directory: ${{runner.workspace}}/silkworm/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release
- name: Build Silkworm RpcDaemon
working-directory: ${{runner.workspace}}/silkworm/build
run: cmake --build . --config Release --target rpcdaemon -j 8

- name: Run Silkworm RpcDaemon
working-directory: ${{runner.workspace}}/silkworm/build/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=$!
echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV
- name: Run RPC Performances Tests
id: test_step
run: |
set +e # Disable exit on error
cd ${{runner.workspace}}/rpc-tests/perf
# Launch the RPC performance test runner
python3 ./run_perf_tests.py -b mainnet -y eth_call -p pattern/mainnet/stress_test_eth_call_001_14M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u
python3 ./run_perf_tests.py -b mainnet -y eth_getLogs -p pattern/mainnet/stress_test_eth_getLogs_15M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u
python3 ./run_perf_tests.py -b mainnet -y eth_getBalance -p pattern/mainnet/stress_test_eth_getBalance_15M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u
python3 ./run_perf_tests.py -b mainnet -y eth_getBlockByHash -p pattern/mainnet/stress_test_eth_getBlockByHash_14M.tar -t 1:1,100:30,1000:20,10000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u
python3 ./run_perf_tests.py -b mainnet -y eth_getBlockByNumber -p pattern/mainnet/stress_test_eth_getBlockByNumber_13M.tar -t 1:1,100:30,1000:20,5000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u
python3 ./run_perf_tests.py -b mainnet -y eth_getTransactionByHash -p pattern/mainnet/stress_test_eth_getTransactionByHash_13M.tar -t 1:1,100:30,1000:20,10000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u
python3 ./run_perf_tests.py -b mainnet -y eth_getTransactionReceipt -p pattern/mainnet/stress_test_eth_getTransactionReceipt_14M.tar -t 1:1,100:30,1000:20,5000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u
# Capture test runner script exit status
perf_exit_status=$?
# Save test results to a directory with timestamp and commit hash
mv ${{runner.workspace}}/rpc-tests/perf/reports/mainnet $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_perf_$(git rev-parse --short HEAD)
# Check test runner script exit status
if [ $perf_exit_status -eq 0 ]; then
echo "Tests completed successfully"
echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT"
else
echo "Error detected during tests"
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
fi
- name: Stop Silkworm RpcDaemon
working-directory: ${{runner.workspace}}/silkworm/build/cmd
run: |
# Clean up rpcdaemon process if it's still running
if kill -0 $RPC_DAEMON_PID 2> /dev/null; then
echo "Terminating rpc-daemon"
kill $RPC_DAEMON_PID
else
echo "rpc-daemon has already terminated"
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

0 comments on commit 1de8504

Please sign in to comment.