Skip to content

Commit

Permalink
[NT] Run CI across multiple NodeJS versions (#2071)
Browse files Browse the repository at this point in the history
Run CI across multiple NodeJS versions to help ensure we make forwards
and backwards compatible changes.
  • Loading branch information
timdawborn committed Oct 12, 2023
1 parent b455e5f commit 67dba6e
Showing 1 changed file with 79 additions and 24 deletions.
103 changes: 79 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
version: 2.1

orbs:
node: circleci/node@1.1.6

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:
Expand All @@ -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:
Expand All @@ -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]+$/
Expand All @@ -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:
Expand Down

0 comments on commit 67dba6e

Please sign in to comment.