integration: use shell scripts & enable workflow for E3 #1934
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: QA - RPC Integration Tests | |
on: | |
pull_request: | |
branches: | |
- master | |
types: | |
- opened | |
- ready_for_review | |
- synchronize | |
jobs: | |
integration-test-suite: | |
strategy: | |
fail-fast: false | |
matrix: | |
backend: [ Erigon2, Erigon3 ] | |
runs-on: [ self-hosted, "${{ matrix.backend }}" ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ matrix.backend }} | |
env: | |
ERIGON_DATA_DIR: /opt/erigon-versions/reference-version/datadir | |
RPC_PAST_TEST_DIR: /opt/rpc-past-tests | |
ERIGON_QA_PATH: /opt/erigon-qa | |
steps: | |
- name: Checkout Silkworm Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: "0" | |
- name: Checkout RPC Tests Repository & Install Requirements | |
run: | | |
rm -rf ${{runner.workspace}}/rpc-tests | |
if [ ${{ matrix.backend }} == 'Erigon2' ]; then | |
git -c advice.detachedHead=false clone --depth 1 --branch v0.52.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests | |
else | |
git -c advice.detachedHead=false clone --depth 1 --branch v0.52.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests | |
fi | |
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: Pause the Erigon instance dedicated to db maintenance | |
if: matrix.backend == 'Erigon2' | |
run: | | |
python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true | |
- name: Start Silkworm RpcDaemon | |
working-directory: ${{runner.workspace}}/silkworm/build/cmd | |
run: | | |
${{runner.workspace}}/silkworm/.github/workflows/run_integration_daemon.sh ${{ matrix.backend }} $ERIGON_DATA_DIR ./jwt.hex & | |
RPC_DAEMON_PID=$! | |
echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV | |
- name: Run RPC Integration Tests | |
id: test_step | |
run: | | |
# Run RPC integration test runner via http | |
${{runner.workspace}}/silkworm/.github/workflows/run_integration_tests.sh ${{ matrix.backend }} ${{runner.workspace}}/rpc-tests/integration ${{runner.workspace}}/silkworm/build/cmd/jwt.hex $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git -C ${{runner.workspace}}/silkworm rev-parse --short HEAD)_http/ | |
# Capture test runner script exit status | |
test_exit_status=$? | |
# Check test runner exit status | |
if [ $test_exit_status -eq 0 ]; then | |
echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" | |
else | |
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Stop Silkworm RpcDaemon | |
working-directory: ${{runner.workspace}}/silkworm/build/cmd | |
run: | | |
${{runner.workspace}}/silkworm/.github/workflows/kill_integration_daemon.sh $RPC_DAEMON_PID | |
- name: Resume the Erigon instance dedicated to db maintenance | |
if: matrix.backend == 'Erigon2' | |
run: | | |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true | |
- name: Upload test results | |
if: steps.test_step.outputs.TEST_RESULT != 'success' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: ${{runner.workspace}}/rpc-tests/integration/mainnet/results/ | |
- name: Action for Success | |
if: steps.test_step.outputs.TEST_RESULT == 'success' | |
run: echo "::notice::Tests completed successfully" | |
- name: Action for Failure | |
if: steps.test_step.outputs.TEST_RESULT != 'success' | |
run: | | |
echo "::error::Error detected during tests" | |
exit 1 | |