-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NT] Run CI across multiple NodeJS versions (#2071)
Run CI across multiple NodeJS versions to help ensure we make forwards and backwards compatible changes.
- Loading branch information
1 parent
b455e5f
commit 67dba6e
Showing
1 changed file
with
79 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
node: circleci/[email protected] | ||
|
||
executors: | ||
node-executor: | ||
node14: | ||
docker: | ||
- image: cimg/node:14.17 | ||
resource_class: medium | ||
working_directory: ~/repo | ||
|
||
node16: | ||
docker: | ||
- image: cimg/node:16.20.1 | ||
resource_class: medium | ||
working_directory: ~/repo | ||
|
||
node18: | ||
docker: | ||
- image: cimg/node:18.18.1 | ||
resource_class: medium | ||
working_directory: ~/repo | ||
|
||
node20: | ||
docker: | ||
- image: cimg/node:20.4.0 | ||
resource_class: medium | ||
working_directory: ~/repo | ||
|
||
commands: | ||
|
@@ -26,37 +42,61 @@ commands: | |
- node_modules | ||
key: v3-dependencies-{{ checksum "package.json" }} | ||
|
||
jobs: | ||
test: | ||
executor: node-executor | ||
resource_class: xlarge | ||
parallelism: 8 | ||
run-tests: | ||
description: Run the unit tests | ||
steps: | ||
- prepare-repository | ||
- node/with-splitting: | ||
glob-path: lib/**/*.spec.ts | ||
timings-type: classname | ||
steps: | ||
- run: | ||
name: Run tests | ||
command: yarn ci:test $TESTFILES | ||
environment: | ||
JEST_JUNIT_OUTPUT_DIR: ./test-reports/jest | ||
JEST_JUNIT_OUTPUT_NAME: results.xml | ||
JEST_JUNIT_CLASSNAME: "{filepath}" | ||
- run: | ||
name: Compile the repository on this version of Node. | ||
command: yarn build | ||
- run: | ||
name: Run the tests on this version of Node. | ||
environment: | ||
JEST_JUNIT_OUTPUT_DIR: ./test-reports/jest | ||
JEST_JUNIT_OUTPUT_NAME: results.xml | ||
JEST_JUNIT_CLASSNAME: "{filepath}" | ||
command: | | ||
set -uex | ||
TESTFILES=$(circleci tests glob lib/**/*.spec.ts | circleci tests split --split-by=timings) | ||
yarn ci:test $TESTFILES | ||
- store_test_results: | ||
path: ./test-reports | ||
|
||
jobs: | ||
test-node14: | ||
executor: node14 | ||
parallelism: 8 | ||
steps: | ||
- run-tests | ||
|
||
test-node16: | ||
executor: node16 | ||
parallelism: 8 | ||
steps: | ||
- run-tests | ||
|
||
test-node18: | ||
executor: node18 | ||
parallelism: 8 | ||
steps: | ||
- run-tests | ||
|
||
test-node20: | ||
executor: node20 | ||
parallelism: 8 | ||
steps: | ||
- run-tests | ||
|
||
lint-check: | ||
executor: node-executor | ||
executor: node14 | ||
steps: | ||
- prepare-repository | ||
- run: | ||
name: Run lint checker | ||
command: yarn lint:check | ||
|
||
publish: | ||
executor: node-executor | ||
executor: node14 | ||
steps: | ||
- prepare-repository | ||
- run: | ||
|
@@ -69,7 +109,19 @@ jobs: | |
workflows: | ||
build-and-test: | ||
jobs: | ||
- test: | ||
- test-node14: | ||
filters: | ||
tags: | ||
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ | ||
- test-node16: | ||
filters: | ||
tags: | ||
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ | ||
- test-node18: | ||
filters: | ||
tags: | ||
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ | ||
- test-node20: | ||
filters: | ||
tags: | ||
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ | ||
|
@@ -79,7 +131,10 @@ workflows: | |
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ | ||
- publish: | ||
requires: | ||
- test | ||
- test-node14 | ||
- test-node16 | ||
- test-node18 | ||
- test-node20 | ||
- lint-check | ||
filters: | ||
tags: | ||
|