Skip to content

Nethermind/Ethereum tests #11583

Nethermind/Ethereum tests

Nethermind/Ethereum tests #11583

name: Nethermind/Ethereum tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches: [kch/test-runner-in-loop, test/after-scl]
workflow_dispatch:
inputs:
coverage:
default: false
description: Collect coverage
required: false
type: boolean
env:
COLLECT_COVERAGE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' || github.event.inputs.coverage }}
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1
RETENTION: 1
TERM: xterm
jobs:
nethermind-tests:
name: Run ${{ matrix.project }}
runs-on: [ubuntu-latest-16-cores]
continue-on-error: true
outputs:
collect_coverage: ${{ env.COLLECT_COVERAGE }}
strategy:
matrix:
project:
- Nethermind.Runner.Test
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: test/after-scl
- name: Set up .NET
uses: actions/setup-dotnet@v4
- name: Cache dotnet packages
id: cache-dotnet
uses: actions/cache/restore@v4
with:
path: ~/.nuget/packages/
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}
- name: ${{ matrix.project }}
id: test
run: |
first_run=true
while true; do
if $first_run; then
# Run the first test with build
if dotnet test src/Nethermind/Nethermind.Runner.Test -c release; then
echo "Test passed. Running again..."
first_run=false
else
echo "Test failed on the first run. Exiting loop."
break
fi
else
# Run subsequent tests without build
if dotnet test src/Nethermind/Nethermind.Runner.Test -c release --no-build; then
echo "Test passed. Running again..."
else
echo "Test failed. Exiting loop."
break
fi
fi
sleep 1 # optional pause between runs
done
- name: Save test outcome
if: success() || failure()
run: echo "${{ steps.test.outcome == 'success' }}," >> nethermind.outcome
- name: Upload test outcome
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.project }}-outcome
path: nethermind.outcome
retention-days: ${{ env.RETENTION }}
- name: Upload coverage report
if: env.COLLECT_COVERAGE == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.project }}-coverage
path: src/Nethermind/${{ matrix.project }}/TestResults/**/coverage.cobertura.xml
retention-days: ${{ env.RETENTION }}
nethermind-tests-status:
name: Nethermind tests
needs: nethermind-tests
runs-on: ubuntu-latest
steps:
- name: Download test outcomes
uses: actions/download-artifact@v4
- name: Ensure tests passed
run: |
data=$(cat **/nethermind.outcome) && data=${data%?}
passed=$(echo "[$data]" | jq -r 'all')
[ $passed = 'true' ] && exit 0 || exit 1