-
Notifications
You must be signed in to change notification settings - Fork 6
364 lines (346 loc) · 14.2 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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
name: Test
on:
pull_request:
types:
- ready_for_review
- synchronize
- opened
push:
branches:
- main
- develop
jobs:
build:
strategy:
matrix:
node-version:
- 20.x
concurrency:
cancel-in-progress: true
group: ${{ github.head_ref }}-unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
version: latest
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pnpm modules
uses: actions/cache@v4
with:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Cache lerna
uses: actions/cache@v4
with:
key: lerna-${{ runner.os }}-${{ github.run_id }}
path: ./.cache
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
unit:
needs:
- build
strategy:
matrix:
node-version:
- 20.x
concurrency:
cancel-in-progress: true
group: ${{ github.head_ref }}-unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
version: latest
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pnpm modules
uses: actions/cache@v4
with:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Cache lerna
uses: actions/cache@v4
with:
key: lerna-${{ runner.os }}
path: ./.cache
restore-keys: lerna-${{ runner.os }}-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Test api
run: cd packages/api && pnpm run test
- name: Test api-common
run: cd packages/api-common && pnpm run test
- name: Test api-database
run: cd packages/api-database && pnpm run test
- name: Test api-development
run: cd packages/api-development && pnpm run test
- name: Test api-evm
run: cd packages/api-evm && pnpm run test
- name: Test api-http
run: cd packages/api-http && pnpm run test
- name: Test api-sync
run: cd packages/api-sync && pnpm run test
- name: Test api-transaction-pool
run: cd packages/api-transaction-pool && pnpm run test
- name: Test bootstrap
run: cd packages/bootstrap && pnpm run test
- name: Test cli
run: cd packages/cli && pnpm run test
- name: Test configuration-generator
run: cd packages/configuration-generator && pnpm run test
# - name: Test consensus
# run: cd packages/consensus && pnpm run test
- name: Test consensus-storage
run: cd packages/consensus-storage && pnpm run test
- name: Test container
run: cd packages/container && pnpm run test
- name: Test contracts
run: cd packages/contracts && pnpm run test
- name: Test core
run: cd packages/core && pnpm run test
- name: Test crypto-address-base58
run: cd packages/crypto-address-base58 && pnpm run test
- name: Test crypto-address-keccak256
run: cd packages/crypto-address-keccak256 && pnpm run test
- name: Test crypto-block
run: cd packages/crypto-block && pnpm run test
- name: Test crypto-commit
run: cd packages/crypto-commit && pnpm run test
- name: Test crypto-config
run: cd packages/crypto-config && pnpm run test
- name: Test crypto-consensus-bls12-381
run: cd packages/crypto-consensus-bls12-381 && pnpm run test
- name: Test crypto-hash-bcrypto
run: cd packages/crypto-hash-bcrypto && pnpm run test
- name: Test crypto-key-pair-bls12-381
run: cd packages/crypto-key-pair-bls12-381 && pnpm run test
- name: Test crypto-key-pair-ecdsa
run: cd packages/crypto-key-pair-ecdsa && pnpm run test
- name: Test crypto-key-pair-ed25519
run: cd packages/crypto-key-pair-ed25519 && pnpm run test
- name: Test crypto-key-pair-schnorr
run: cd packages/crypto-key-pair-schnorr && pnpm run test
- name: Test crypto-messages
run: cd packages/crypto-messages && pnpm run test
- name: Test crypto-signature-bls12-381
run: cd packages/crypto-signature-bls12-381 && pnpm run test
- name: Test crypto-signature-ecdsa
run: cd packages/crypto-signature-ecdsa && pnpm run test
- name: Test crypto-signature-schnorr
run: cd packages/crypto-signature-schnorr && pnpm run test
- name: Test crypto-transaction
run: cd packages/crypto-transaction && pnpm run test
- name: Test crypto-transaction-evm-call
run: cd packages/crypto-transaction-evm-call && pnpm run test
- name: Test crypto-validation
run: cd packages/crypto-validation && pnpm run test
- name: Test crypto-wif
run: cd packages/crypto-wif && pnpm run test
- name: Test crypto-worker
run: cd packages/crypto-worker && pnpm run test
- name: Test database
run: cd packages/database && pnpm run test
# - name: Test evm
# run: cd packages/evm && pnpm run test
- name: Test evm-api-worker
run: cd packages/evm-api-worker && pnpm run test
- name: Test evm-consensus
run: cd packages/evm-consensus && pnpm run test
- name: Test evm-gas-fee
run: cd packages/evm-gas-fee && pnpm run test
- name: Test evm-service
run: cd packages/evm-service && pnpm run test
- name: Test evm-state
run: cd packages/evm-state && pnpm run test
- name: Test kernel
run: cd packages/kernel && pnpm run test
- name: Test logger-pino
run: cd packages/logger-pino && pnpm run test
- name: Test logger-winston
run: cd packages/logger-winston && pnpm run test
- name: Test networking-dns
run: cd packages/networking-dns && pnpm run test
- name: Test networking-ntp
run: cd packages/networking-ntp && pnpm run test
- name: Test p2p
run: cd packages/p2p && pnpm run test
- name: Test processor
run: cd packages/processor && pnpm run test
- name: Test serializer
run: cd packages/serializer && pnpm run test
# - name: Test state
# run: cd packages/state && pnpm run test
- name: Test test-framework
run: cd packages/test-framework && pnpm run test
- name: Test test-runner
run: cd packages/test-runner && pnpm run test
- name: Test test-transaction-builders
run: cd packages/test-transaction-builders && pnpm run test
- name: Test transaction-pool-broadcaster
run: cd packages/transaction-pool-broadcaster && pnpm run test
- name: Test transaction-pool-service
run: cd packages/transaction-pool-service && pnpm run test
- name: Test transaction-pool-worker
run: cd packages/transaction-pool-worker && pnpm run test
- name: Test transactions
run: cd packages/transactions && pnpm run test
- name: Test utils
run: cd packages/utils && pnpm run test
- name: Test validation
run: cd packages/validation && pnpm run test
# - name: Test validator
# run: cd packages/validator && pnpm run test
- name: Test webhooks
run: cd packages/webhooks && pnpm run test
integration:
needs:
- build
strategy:
matrix:
node-version:
- 20.x
concurrency:
cancel-in-progress: true
group: ${{ github.head_ref }}-integration
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: test_db
POSTGRES_USER: test_db
POSTGRES_PASSWORD: password
ports:
- 127.0.0.1:5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
version: latest
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pnpm modules
uses: actions/cache@v4
with:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Cache lerna
uses: actions/cache@v4
with:
key: lerna-${{ runner.os }}
path: ./.cache
restore-keys: lerna-${{ runner.os }}-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Test api-http
run: cd packages/api-http && pnpm run test:integration
e2e:
needs:
- build
concurrency:
cancel-in-progress: true
group: ${{ github.head_ref }}-e2e-${{ matrix.name }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [20.x]
name: ["consensus"]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
version: latest
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pnpm modules
uses: actions/cache@v4
with:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Cache lerna
uses: actions/cache@v4
with:
key: lerna-${{ runner.os }}
path: ./.cache
restore-keys: lerna-${{ runner.os }}-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Docker ${{ matrix.name }}
run: sudo chmod -R 777 tests/e2e/${{ matrix.name }}/nodes && cd tests/e2e/${{ matrix.name }} && docker compose up -d
- name: Running checks for ${{ matrix.name }}
run: |
container_id=$(docker ps -a | grep 'consensus-checks' | awk '{print $1}')
while docker ps | grep -q $container_id; do echo "checks running..."; sleep 5; done
exit_code=$(docker container inspect $container_id --format='{{.State.ExitCode}}')
if [ "$exit_code" != "0" ]; then
echo "Error: checks exited with code $exit_code"
exit 1
fi
- name: Show logs - node0
if: always()
run: docker logs consensus-node0-1
- name: Show logs - node1
if: always()
run: docker logs consensus-node1-1
- name: Show logs - node2
if: always()
run: docker logs consensus-node2-1
- name: Show logs - node3
if: always()
run: docker logs consensus-node3-1
- name: Show logs - node4
if: always()
run: docker logs consensus-node4-1