Skip to content

QA - Stage Exec Smoke Test #38

QA - Stage Exec Smoke Test

QA - Stage Exec Smoke Test #38

Workflow file for this run

name: QA - Stage Exec Smoke Test
on:
schedule:
- cron: '0 4 * * *' # Run daily at 04:00 UTC
workflow_dispatch: # Run manually
# Auto-fire on PRs that touch this workflow's own YAML so the exec-mode
# matrix change can be validated in-PR without a manual dispatch.
# Regular PRs that don't touch this file are unaffected.
pull_request:
paths:
- '.github/workflows/qa-stage-exec.yml'
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
stage-exec-test:
name: stage-exec-test (${{ matrix.mode_name }}, ${{ matrix.exec_mode }})
runs-on: [self-hosted, qa, Ethereum, tip-tracking]
strategy:
fail-fast: false
matrix:
# Each (mode_name, exec_mode) pair runs separately. The testbed
# data dir already disambiguates by mode_name; we extend it with
# exec_mode so serial+parallel entries don't clobber each other.
include:
- mode_name: resume-nonchaintip
extra_flags: ""
test_name: stage_exec_resume_nonchaintip
exec_mode: serial
- mode_name: resume-nonchaintip
extra_flags: ""
test_name: stage_exec_resume_nonchaintip
exec_mode: parallel
- mode_name: from-0
extra_flags: "--rm-state-all"
test_name: stage_exec_from_0
exec_mode: serial
- mode_name: from-0
extra_flags: "--rm-state-all"
test_name: stage_exec_from_0
exec_mode: parallel
- mode_name: chaintip
extra_flags: "--chaintip"
test_name: stage_exec_resume_chaintip
exec_mode: serial
- mode_name: chaintip
extra_flags: "--chaintip"
test_name: stage_exec_resume_chaintip
exec_mode: parallel
env:
ERIGON_TESTBED_DATA_DIR: /opt/erigon-testbed/datadir-${{ matrix.mode_name }}-${{ matrix.exec_mode }}
ERIGON_QA_PATH: /home/qarunner/erigon-qa
TIMEOUT_SECONDS: 360
CHAIN: mainnet
# Toggle dbg.Exec3Parallel from CI without code changes. envLookup
# in common/dbg/dbg_env.go auto-prepends ERIGON_, so this maps to
# the EXEC3_PARALLEL flag declared in common/dbg/experiments.go.
ERIGON_EXEC3_PARALLEL: ${{ matrix.exec_mode == 'parallel' && 'true' || 'false' }}
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set reference data dir based on branch
run: |
BRANCH="${{ github.base_ref }}"
if [ -z "$BRANCH" ]; then
BRANCH="${{ github.ref }}"
BRANCH="${BRANCH#refs/heads/}"
fi
REF_DIR="/opt/erigon-versions/reference-version/datadir"
if [[ "$BRANCH" == release/* ]]; then
VERSION="${BRANCH#release/}"
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
MAJOR="${VERSION%.*}"
MINOR="${VERSION##*.}"
if [ "$MINOR" -gt 0 ] 2>/dev/null; then
PREV_VERSION="${MAJOR}.$((MINOR - 1))"
REF_DIR="/opt/erigon-versions/reference-version-${PREV_VERSION}/datadir"
else
echo "Warning: Release branch '$BRANCH' has minor version 0; using default reference data dir."
fi
else
echo "Warning: Release branch '$BRANCH' does not match expected 'MAJOR.MINOR' format; using default reference data dir."
fi
fi
echo "ERIGON_REFERENCE_DATA_DIR=$REF_DIR" >> $GITHUB_ENV
- name: Clean Erigon Build Directory
run: |
make clean
- name: Build Erigon and Integration
run: |
make erigon
make integration
working-directory: ${{ github.workspace }}
- name: Pause the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true
- name: Mirror datadir
run: |
${{ github.workspace }}/cmd/scripts/mirror-datadir.sh $ERIGON_REFERENCE_DATA_DIR $ERIGON_TESTBED_DATA_DIR
- name: Run stage_exec smoke test
id: test_step
run: |
set +e
python3 $ERIGON_QA_PATH/test_system/qa-tests/stage-exec/run_and_check_stage_exec.py \
${{ github.workspace }}/build/bin $ERIGON_TESTBED_DATA_DIR $TIMEOUT_SECONDS $CHAIN \
--result-file ${{ github.workspace }}/result-$CHAIN-${{ matrix.mode_name }}-${{ matrix.exec_mode }}.json \
${{ matrix.extra_flags }}
test_exit_status=$?
echo "test_executed=true" >> $GITHUB_OUTPUT
if [ $test_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: Save test results
if: ${{ always() && steps.test_step.outputs.test_executed == 'true' }}
env:
TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }}
run: |
db_version=$(python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/prod_info.py $ERIGON_REFERENCE_DATA_DIR/../production.ini production erigon_repo_commit)
if [ -z "$db_version" ]; then
db_version="no-version"
fi
python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py \
--repo erigon \
--commit $(git rev-parse HEAD) \
--branch ${{ github.ref_name }} \
--test_name ${{ matrix.test_name }} \
--chain $CHAIN \
--runner ${{ runner.name }} \
--db_version $db_version \
--outcome $TEST_RESULT \
--result_file ${{ github.workspace }}/result-$CHAIN-${{ matrix.mode_name }}-${{ matrix.exec_mode }}.json
- name: Upload test results
if: ${{ always() && steps.test_step.outputs.test_executed == 'true' }}
uses: actions/upload-artifact@v7
with:
name: test-results-${{ matrix.mode_name }}-${{ matrix.exec_mode }}
path: ${{ github.workspace }}/result-${{ env.CHAIN }}-${{ matrix.mode_name }}-${{ matrix.exec_mode }}.json
- name: Upload erigon logs
if: ${{ always() && steps.test_step.outputs.test_executed == 'true' }}
uses: actions/upload-artifact@v7
with:
name: erigon-logs-${{ matrix.mode_name }}-${{ matrix.exec_mode }}
path: ${{ env.ERIGON_TESTBED_DATA_DIR }}/logs/
- name: Delete Erigon Testbed Data Directory
if: always()
run: |
if [ -d "$ERIGON_TESTBED_DATA_DIR" ]; then
rm -rf $ERIGON_TESTBED_DATA_DIR
fi
- name: Resume the Erigon instance dedicated to db maintenance
if: always()
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true
- 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 stage_exec test"
exit 1