Skip to content

Commit a22778d

Browse files
ci: parallelize tests by running each package in a separate CI job
1 parent 10c7260 commit a22778d

2 files changed

Lines changed: 285 additions & 50 deletions

File tree

.circleci/continue_config.yml

Lines changed: 149 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,19 @@ workflows:
154154
# << pipeline.parameters.run-build-ui >>,
155155
# ]
156156
jobs:
157-
- tests-node-v22
157+
- build-and-lint
158+
- test-bytecode-utils:
159+
requires: [build-and-lint]
160+
- test-compilers:
161+
requires: [build-and-lint]
162+
- test-lib-sourcify:
163+
requires: [build-and-lint]
164+
- test-monitor:
165+
requires: [build-and-lint]
166+
- test-server:
167+
requires: [build-and-lint]
168+
- test-4byte:
169+
requires: [build-and-lint]
158170
# TODO: run-build options are not taking affect. We build them always.
159171
- build-push-monitor-amd64:
160172
run-build: << pipeline.parameters.run-build-monitor >>
@@ -205,7 +217,19 @@ workflows:
205217
- not:
206218
equal: [staging, << pipeline.git.branch >>]
207219
jobs:
208-
- tests-node-v22
220+
- build-and-lint
221+
- test-bytecode-utils:
222+
requires: [build-and-lint]
223+
- test-compilers:
224+
requires: [build-and-lint]
225+
- test-lib-sourcify:
226+
requires: [build-and-lint]
227+
- test-monitor:
228+
requires: [build-and-lint]
229+
- test-server:
230+
requires: [build-and-lint]
231+
- test-4byte:
232+
requires: [build-and-lint]
209233

210234
#######################
211235
### JOB DEFINITIONS ###
@@ -277,27 +301,11 @@ jobs:
277301
no_output_timeout: 10m
278302
command: |
279303
./.circleci/scripts/deploy_to_gcp.sh
280-
tests-node-v22:
304+
build-and-lint:
281305
docker:
282306
- image: cimg/node:22.22.0
283-
- image: postgres:15-alpine
284-
name: sourcify-db
285-
environment:
286-
POSTGRES_DB: sourcify
287-
POSTGRES_USER: sourcify
288-
POSTGRES_PASSWORD: sourcify
289-
- image: postgres:15-alpine
290-
name: fourbytes-db
291-
environment:
292-
POSTGRES_DB: fourbytes_test_db
293-
POSTGRES_USER: fourbytes
294-
POSTGRES_PASSWORD: fourbytes
295-
resource_class: large
307+
resource_class: xlarge
296308
working_directory: ~/sourcify
297-
parameters:
298-
run_coveralls:
299-
type: boolean
300-
default: false
301309
steps:
302310
- run:
303311
name: Versions
@@ -315,24 +323,140 @@ jobs:
315323
- run:
316324
name: init the database submodule
317325
command: cd services/database && git submodule update --init
326+
- persist_to_workspace:
327+
root: ~/sourcify
328+
paths:
329+
- node_modules
330+
- packages/*/node_modules
331+
- packages/bytecode-utils/build
332+
- packages/compilers/build
333+
- packages/compilers-types/build
334+
- packages/lib-sourcify/build
335+
- services/*/node_modules
336+
- services/server/dist
337+
- services/monitor/dist
338+
- services/4byte/dist
339+
- services/database
340+
test-bytecode-utils:
341+
docker:
342+
- image: cimg/node:22.22.0
343+
resource_class: medium
344+
working_directory: ~/sourcify
345+
steps:
346+
- checkout
347+
- attach_workspace:
348+
at: ~/sourcify
349+
- run:
350+
name: test
351+
command: npx lerna run test --scope=@ethereum-sourcify/bytecode-utils --stream
352+
- run:
353+
name: create lcov report
354+
command: npx lerna run cov:lcov --scope=@ethereum-sourcify/bytecode-utils
355+
- codecov/upload
356+
test-compilers:
357+
docker:
358+
- image: cimg/node:22.22.0
359+
resource_class: medium
360+
working_directory: ~/sourcify
361+
steps:
362+
- checkout
363+
- attach_workspace:
364+
at: ~/sourcify
365+
- run:
366+
name: test
367+
command: npx lerna run test --scope=@ethereum-sourcify/compilers --stream
368+
- run:
369+
name: create lcov report
370+
command: npx lerna run cov:lcov --scope=@ethereum-sourcify/compilers
371+
- codecov/upload
372+
test-lib-sourcify:
373+
docker:
374+
- image: cimg/node:22.22.0
375+
resource_class: medium
376+
working_directory: ~/sourcify
377+
steps:
378+
- checkout
379+
- attach_workspace:
380+
at: ~/sourcify
318381
- run:
319382
name: test
320-
command: npx lerna run test --stream
383+
command: npx lerna run test --scope=@ethereum-sourcify/lib-sourcify --stream
384+
- run:
385+
name: create lcov report
386+
command: npx lerna run cov:lcov --scope=@ethereum-sourcify/lib-sourcify
387+
- codecov/upload
388+
test-monitor:
389+
docker:
390+
- image: cimg/node:22.22.0
391+
resource_class: medium
392+
working_directory: ~/sourcify
393+
steps:
394+
- checkout
395+
- attach_workspace:
396+
at: ~/sourcify
397+
- run:
398+
name: test
399+
command: npx lerna run test --scope=sourcify-monitor --stream
400+
- run:
401+
name: create lcov report
402+
command: npx lerna run cov:lcov --scope=sourcify-monitor
403+
- codecov/upload
404+
test-server:
405+
docker:
406+
- image: cimg/node:22.22.0
407+
- image: postgres:15-alpine
408+
name: sourcify-db
409+
environment:
410+
POSTGRES_DB: sourcify
411+
POSTGRES_USER: sourcify
412+
POSTGRES_PASSWORD: sourcify
413+
resource_class: large
414+
working_directory: ~/sourcify
415+
steps:
416+
- checkout
417+
- attach_workspace:
418+
at: ~/sourcify
419+
- run:
420+
name: test
421+
command: npx lerna run test --scope=sourcify-server --stream
321422
environment:
322423
DOCKER_HOST_POSTGRES_TEST_PORT: 5432
323424
SOURCIFY_POSTGRES_HOST: "sourcify-db"
324425
SOURCIFY_POSTGRES_DB: "sourcify"
325426
SOURCIFY_POSTGRES_USER: "sourcify"
326427
SOURCIFY_POSTGRES_PASSWORD: "sourcify"
327-
SOURCIFY_POSTGRES_PORT: 5432 # On it's own db container
428+
SOURCIFY_POSTGRES_PORT: 5432
429+
- run:
430+
name: create lcov report
431+
command: npx lerna run cov:lcov --scope=sourcify-server
432+
- codecov/upload
433+
test-4byte:
434+
docker:
435+
- image: cimg/node:22.22.0
436+
- image: postgres:15-alpine
437+
name: fourbytes-db
438+
environment:
439+
POSTGRES_DB: fourbytes_test_db
440+
POSTGRES_USER: fourbytes
441+
POSTGRES_PASSWORD: fourbytes
442+
resource_class: medium
443+
working_directory: ~/sourcify
444+
steps:
445+
- checkout
446+
- attach_workspace:
447+
at: ~/sourcify
448+
- run:
449+
name: test
450+
command: npx lerna run test --scope=sourcify-4byte --stream
451+
environment:
328452
FOURBYTES_POSTGRES_HOST: "fourbytes-db"
329453
FOURBYTES_POSTGRES_DB: "fourbytes_test_db"
330454
FOURBYTES_POSTGRES_USER: "fourbytes"
331455
FOURBYTES_POSTGRES_PASSWORD: "fourbytes"
332-
FOURBYTES_POSTGRES_PORT: 5432 # On it's own db container
456+
FOURBYTES_POSTGRES_PORT: 5432
333457
- run:
334-
name: create lcov reports
335-
command: npx lerna run cov:lcov
458+
name: create lcov report
459+
command: npx lerna run cov:lcov --scope=sourcify-4byte
336460
- codecov/upload
337461
monitor-e2e-sepolia:
338462
<<: *monitor-e2e-base

0 commit comments

Comments
 (0)