Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qa-tests: add a snapshot-test workflow #2537

Merged
merged 6 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .github/workflows/snapshot-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: QA - Snapshot Test

on:
workflow_dispatch:

jobs:
execution-test-suite:
runs-on: [ self-hosted, Erigon3 ] # must run on E2 not to steal E3 runner, which is used for PR approval
mriccobene marked this conversation as resolved.
Show resolved Hide resolved
timeout-minutes: 7200 # 5 days
env:
ERIGON_QA_PATH: /opt/erigon-qa
ERIGON_DATA_DIR: /opt/erigon-versions/reference-version/datadir
ERIGON_SNAPSHOT_TEST_DIR: /opt/erigon-snapshot
CHAIN: mainnet
TRACKING_TIME_SECONDS: 431400 # 5 days minus 10 minutes
TOTAL_TIME_SECONDS: 431400
mriccobene marked this conversation as resolved.
Show resolved Hide resolved

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

- 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
working-directory: ${{runner.workspace}}/silkworm/build
run: cmake --build . --config Release --target silkworm -j 8
mriccobene marked this conversation as resolved.
Show resolved Hide resolved

- name: Pause the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true

- name: Sync the snapshot directory
run: |
rsync -a --delete $ERIGON_DATA_DIR/snapshots/ $ERIGON_SNAPSHOT_TEST_DIR/

- name: Run Execution Test
id: test_step
working-directory: ${{runner.workspace}}/silkworm/build/cmd
run: |
set +e # Disable exit on error

# Run the test script
some_test_cmd
mriccobene marked this conversation as resolved.
Show resolved Hide resolved

# Capture monitoring script exit status
test_exit_status=$?

# Save the subsection reached status
echo "::set-output name=test_executed::true"

# Check test runner exit status
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: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ env.CHAIN }}
path: ${{runner.workspace}}/silkworm/build/cmd/result.json

- name: Upload test full log
if: always()
uses: actions/upload-artifact@v4
with:
name: silkworm-log
path: ${{runner.workspace}}/silkworm/build/cmd/execution.log

- 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

Loading