-
-
Notifications
You must be signed in to change notification settings - Fork 300
228 lines (198 loc) Β· 6.65 KB
/
test.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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: Tests
# only one can run at a time
concurrency:
# If PR, cancel prev commits. head_ref = source branch name on pull_request, null if push
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
# We intentionally don't run push on feature branches. See PR for rational.
branches: [unstable, stable]
pull_request:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: ${{ matrix.node }}
- name: Test root binary exists
run: ./lodestar --version
- name: Reject yarn.lock changes
run: .github/workflows/scripts/reject_yarn_lock_changes.sh
# Run only on forks
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
lint:
name: Lint
needs: build
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: ${{ matrix.node }}
- name: Assert yarn prints no warnings
run: scripts/assert_no_yarn_warnings.sh
- name: Lint yarn lockfile
run: npx lockfile-lint --path yarn.lock --allowed-hosts npm yarn --validate-https
- name: Lint Code
run: yarn lint
- name: Lint Grafana dashboards
run: scripts/validate-grafana-dashboards.sh
- name: Assert ESM module exports
run: node scripts/assert_exports.mjs
- name: Assert eslintrc rules sorted
run: scripts/assert_eslintrc_sorted.mjs
type-checks:
name: Type Checks
needs: build
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: ${{ matrix.node }}
- name: Check Types
run: yarn check-types
- name: README check
run: yarn check-readme
unit-tests:
name: Unit Tests
needs: type-checks
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: ${{ matrix.node }}
# Cache validator slashing protection data tests
- name: Restore spec tests cache
uses: actions/cache@master
with:
path: packages/validator/spec-tests
key: spec-test-data-${{ hashFiles('packages/validator/test/spec/params.ts') }}
- name: Unit tests
# id: unit_tests
# Rever to "yarn test:unit" when finished debugging core dumps
# run: sudo sh -c "ulimit -c unlimited && /usr/bin/node-with-debug $(which yarn) test:unit"
run: yarn test:unit
# # Remove when finished debugging core dumps
# - uses: './.github/actions/core-dump'
# if: ${{ failure() && steps.unit_tests.conclusion == 'failure' }}
- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true # optional (default = false)
flags: "unit"
e2e-tests:
name: E2E Tests
runs-on: buildjet-4vcpu-ubuntu-2204
needs: build
strategy:
fail-fast: false
matrix:
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: ${{ matrix.node }}
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Run the e2e test environment
run: scripts/run_e2e_env.sh start
- name: E2E tests
run: yarn test:e2e
env:
GOERLI_RPC_URL: ${{ secrets.GOERLI_RPC_URL!=0 && secrets.GOERLI_RPC_URL || env.GOERLI_RPC_DEFAULT_URL }}
- name: Stop the e2e test environment
run: scripts/run_e2e_env.sh stop
- name: Upload debug log test for test env
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: debug-e2e-test-logs-node-${{matrix.node}}
path: test-logs/e2e-test-env
browser-tests:
name: Browser Tests
runs-on: buildjet-4vcpu-ubuntu-2204
needs: build
strategy:
fail-fast: false
matrix:
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: ${{ matrix.node }}
- name: Install Chrome browser
run: npx @puppeteer/browsers install chromedriver@latest --path /tmp
- name: Install Firefox browser
run: npx @puppeteer/browsers install firefox@latest --path /tmp
- name: Browser tests
run: |
export DISPLAY=':99.0'
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
yarn test:browsers
spec-tests:
name: Spec tests
needs: build
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: ${{ matrix.node }}
# Download spec tests with cache
- name: Restore spec tests cache
uses: actions/cache@master
with:
path: packages/beacon-node/spec-tests
key: spec-test-data-${{ hashFiles('packages/beacon-node/test/spec/specTestVersioning.ts') }}
- name: Download spec tests
run: yarn download-spec-tests
working-directory: packages/beacon-node
# Run them in different steps to quickly identifying which command failed
# Otherwise just doing `yarn test:spec` you can't tell which specific suite failed
# many of the suites have identical names for minimal and mainnet
- name: Spec tests general
run: yarn test:spec:general
working-directory: packages/beacon-node
- name: Spec tests bls
run: yarn test:spec:bls
working-directory: packages/beacon-node
- name: Spec tests minimal
run: yarn test:spec:minimal
working-directory: packages/beacon-node
- name: Spec tests mainnet
run: NODE_OPTIONS='--max-old-space-size=4096' yarn test:spec:mainnet
working-directory: packages/beacon-node