-
Notifications
You must be signed in to change notification settings - Fork 434
106 lines (98 loc) · 3.18 KB
/
nethermind-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Nethermind/Ethereum tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches: [kch/test-runner-in-loop]
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