-
Notifications
You must be signed in to change notification settings - Fork 669
156 lines (142 loc) · 4.96 KB
/
hive-tests.yml
File metadata and controls
156 lines (142 loc) · 4.96 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Hive tests
on:
push:
tags: ['*']
branches: [master]
workflow_dispatch:
inputs:
test-suite:
description: Test suite
type: choice
options:
- 'all'
- devp2p
- ethereum/consensus
- ethereum/eest
- ethereum/engine
- ethereum/graphql
- ethereum/rpc-compat
- ethereum/sync
limit:
description: Limit
required: false
type: string
log-level:
description: Log level
required: true
default: '3'
type: choice
options: ['0', '1', '2', '3', '4', '5']
parallelism:
description: Parallelism
required: true
default: 4
type: number
buildarg:
description: Docker build arguments
required: false
type: string
hive-repo:
description: Hive repo
required: true
default: ethereum/hive
type: string
hive-branch:
description: Hive branch
required: false
default: master
type: string
env:
DEFAULT_PARALLELISM: 4
jobs:
setup:
name: Set up test matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- id: matrix
run: |
if [[ "${{ github.event_name }}" == "push" || "${{ github.event.inputs.test-suite }}" == "all" ]]; then
# engine-withdrawals at parallelism 2: the 128-block primary build takes
# ~5 min on shared CI runners at parallelism 4, consuming the entire 300 s
# test timeout before the syncing client starts. engine-[^w] covers all
# other engine suites automatically.
{
echo 'matrix<<MATRIX_END'
echo '[
{"suite":"ethereum/engine", "limit":"engine-withdrawals", "parallelism":2, "name":"engine-withdrawals"},
{"suite":"ethereum/engine", "limit":"engine-[^w]", "name":"engine-other"},
{"suite":"ethereum/graphql"},
{"suite":"ethereum/rpc-compat"},
{"suite":"ethereum/sync"}
]'
echo 'MATRIX_END'
} >> "$GITHUB_OUTPUT"
else
echo 'matrix=[{"suite":"${{ github.event.inputs.test-suite }}","limit":"${{ github.event.inputs.limit }}","parallelism":${{ github.event.inputs.parallelism || env.DEFAULT_PARALLELISM }}}]' >> "$GITHUB_OUTPUT"
fi
test:
name: Build and run tests (${{ matrix.name || matrix.suite }})
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.setup.outputs.matrix) }}
steps:
- name: Set up parameters
run: |
echo "LOG_LEVEL=${{ github.event.inputs.log-level || '3' }}" >> $GITHUB_ENV
echo "HIVE_REPO=${{ github.event.inputs.hive-repo || 'ethereum/hive' }}" >> $GITHUB_ENV
echo "HIVE_BRANCH=${{ github.event.inputs.hive-branch || 'master' }}" >> $GITHUB_ENV
echo "BUILDARG=${{ github.event.inputs.buildarg || '' }}" >> $GITHUB_ENV
- name: Check out Nethermind repository
uses: actions/checkout@v6
with:
path: nethermind
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_SUMMARY: false
with:
context: nethermind
file: nethermind/Dockerfile
tags: nethermind:test-${{ github.sha }}
outputs: type=docker,dest=/tmp/image.tar
- name: Check out Hive repository
uses: actions/checkout@v6
with:
repository: ${{ env.HIVE_REPO }}
ref: ${{ env.HIVE_BRANCH }}
path: hive
- name: Patch Hive Dockerfile
run: sed -i 's#FROM $baseimage:$tag#FROM nethermind:test-${{ github.sha }}#g' hive/clients/nethermind/Dockerfile
- name: Build Hive
working-directory: hive
run: go build .
- name: Load Docker image
run: docker load --input /tmp/image.tar
- name: Run Hive
continue-on-error: true
working-directory: hive
run: |
HIVE_ARGS="--client nethermind
--sim ${{ matrix.suite }}
--sim.loglevel $LOG_LEVEL
--sim.parallelism ${{ matrix.parallelism || env.DEFAULT_PARALLELISM }}"
[[ -n "${{ matrix.limit }}" ]] && HIVE_ARGS+=" --sim.limit ${{ matrix.limit }}"
[[ -n "$BUILDARG" ]] && HIVE_ARGS+=" --sim.buildarg \"$BUILDARG\""
./hive $HIVE_ARGS
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: results-${{ strategy.job-index }}-${{ github.run_number }}-${{ github.run_attempt }}
path: hive/workspace
retention-days: 7
- name: Print results
run: |
rm -f hive/workspace/logs/hive.json
nethermind/scripts/hive-results.sh "hive/workspace/logs/*.json"