forked from erigontech/erigon
-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (163 loc) · 6.95 KB
/
test-hive-eest.yml
File metadata and controls
178 lines (163 loc) · 6.95 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Hive EEST tests
on:
push:
branches:
- 'release/**'
- main
workflow_dispatch:
env:
EEST_VERSION: 'v5.3.0'
concurrency:
# Dynamic group to fill all available runners
group: hive-eest-tests-${{ github.run_id }}
cancel-in-progress: false
jobs:
test-hive-eest:
runs-on:
group: hive
strategy:
fail-fast: false
matrix:
include:
- sim: consume-engine
sim-limit: ""
- sim: consume-rlp
sim-limit: ".*eip2930_access_list.*" # all tests take too long
steps:
- name: Clean docker system
run: |
echo "Force stopping and removing all containers..."
if [ -n "$(docker ps -aq)" ]; then
docker kill $(docker ps -aq) || true
docker rm -f $(docker ps -aq) || true
fi
echo "Pruning all images..."
docker image prune -af || true
if [ -n "$(docker images -aq)" ]; then
echo "Force removing all images..."
docker rmi -f $(docker images -aq) || true
fi
echo "Pruning docker system..."
docker system prune -af --volumes
- name: Checkout Erigon go.mod
uses: actions/checkout@v6
with:
sparse-checkout: go.mod
sparse-checkout-cone-mode: false
path: erigon-src
- name: Checkout Hive
uses: actions/checkout@v6
with:
repository: ethereum/hive
ref: master
path: hive
- name: Conditional Docker Login
# Only login if we can. Workflow works without it but we want to avoid
# rate limiting by Docker Hub when possible. External repos don't
# have access to our Docker secrets.
# continue-on-error: transient Docker Hub network timeouts should not
# abort the entire workflow — the run proceeds without login (unlogged pull).
if: |
github.repository == 'erigontech/erigon' &&
github.actor != 'dependabot[bot]' &&
(github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork)
continue-on-error: true
uses: docker/login-action@v3
with:
username: ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_USERNAME }}
password: ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_TOKEN }}
- name: Setup go env and cache
uses: actions/setup-go@v6
with:
go-version: '>=1.25'
# Targetting the clients/erigon/Dockerfile.git in the Hive director -
# this builds the container from github and uses it for tests
- name: Get dependencies and build hive
run: |
cd hive
git status
go get . >> buildlogs.log
rm clients/erigon/Dockerfile
mv clients/erigon/Dockerfile.git clients/erigon/Dockerfile
branch_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/[&/\]/\\&/g')
echo Building Hive with Erigon branch - $branch_name
sed -i "s/^ARG tag=main$/ARG tag=${branch_name}/" clients/erigon/Dockerfile
go_version=$(go mod edit -json ../erigon-src/go.mod | jq -r .Go)
echo "Patching builder Go version to ${go_version}"
sed -i "s|golang:[0-9.]*-alpine|golang:${go_version}-alpine|" clients/erigon/Dockerfile
go build . >> buildlogs.log
# Depends on the last line of hive output that prints the number of suites, tests and failed
# Currently, we fail even if suites and tests are too few, indicating the tests did not run
# We also fail if more than half the tests fail
- name: Run hive tests and parse output
run: |
cd hive
docker ps
run_suite() {
echo -e "\n\n============================================================"
echo "Running test: ${1}"
echo -e "\n"
./hive -docker.output -docker.auth --sim ethereum/eels/"${1}" --sim.limit="${2}" --sim.parallelism=12 --client erigon --docker.nocache=true --sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/${{ env.EEST_VERSION }}/fixtures_develop.tar.gz 2>&1 | tee output.log || {
if [ $? -gt 0 ]; then
echo "Exitcode gt 0"
fi
}
status_line=$(tail -2 output.log | head -1 | sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g")
suites=$(echo "$status_line" | sed -n 's/.*suites=\([0-9]*\).*/\1/p')
if [ -z "$suites" ]; then
status_line=$(tail -1 output.log | sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g")
suites=$(echo "$status_line" | sed -n 's/.*suites=\([0-9]*\).*/\1/p')
fi
tests=$(echo "$status_line" | sed -n 's/.*tests=\([0-9]*\).*/\1/p')
failed=$(echo "$status_line" | sed -n 's/.*failed=\([0-9]*\).*/\1/p')
echo -e "\n"
message="----------- Results for ${1} -----------\nTests: $tests, Failed: $failed\n\n============================================================"
echo -e "$message"
echo -e "$message" >> result.log
if (( tests < 4 )); then
echo "Too few tests run for suite ${1} - ${tests} tests"
echo "failed" > failed.log
exit 1
fi
if (( failed > 0 )); then
echo "Too many failures for suite ${1} - ${failed} failed out of ${tests}"
echo "failed" > failed.log
exit 1
fi
}
run_suite ${{ matrix.sim }} ${{ matrix.sim-limit }}
continue-on-error: true
- name: Upload output log
if: always()
uses: actions/upload-artifact@v6
with:
name: hive-workspace-log-${{ matrix.sim }}
path: hive/workspace/logs
if-no-files-found: ignore
- name: Test Results
if: always()
run: |
cat hive/result.log
if grep -q "failed" hive/failed.log; then
echo "One or more tests failed."
exit 1
fi
echo "All tests passed successfully."
# This step is not required UNTIL the github-managed runners are dismissed in favor of self-hosted ones (which is planned)
# So it is good to PROACTIVELY run it (it should not cause any issues within github-managed runners either)
- name: Remove Hive directory
run: |
echo "Removing the Hive directory..."
rm -rf hive
if: always()
# This step is not required UNTIL the github-managed runners are dismissed in favor of self-hosted ones (which is planned)
# So it is good to PROACTIVELY run it (it should not cause any issues within github-managed runners either)
- name: Prune docker
run: |
echo "Stopping and removing all containers..."
docker rm -f $(docker ps -aq) || true
echo "Removing all images..."
docker rmi -f $(docker images -aq) || true
echo "Pruning docker..."
docker system prune -af --volumes
if: always()