Skip to content

Commit c6eb414

Browse files
committed
Add matrix-based CI testing
1 parent 76dfdba commit c6eb414

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

.circleci/config.yml

+33-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,28 @@
22
#
33
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
44
#
5-
version: 2
5+
version: 2.1
6+
7+
workflows:
8+
all-tests:
9+
jobs:
10+
- test-and-build:
11+
# Override graphql-version to test against specific versions. Type checking is disabled due missing
12+
# definitions for field extensions in older @types/graphql versions
13+
matrix:
14+
parameters:
15+
graphql-version: ["~0.13", "~14.0", "~14.5", "~14.6"]
16+
- test-and-build:
17+
# Leave graphql-version unspecified to respect the lockfile and also run tsc
18+
name: test-and-build-with-typecheck
19+
620
jobs:
7-
build:
21+
test-and-build:
22+
parameters:
23+
graphql-version:
24+
type: string
25+
default: ""
26+
827
docker:
928
# specify the version you desire here
1029
- image: circleci/node:latest
@@ -17,16 +36,24 @@ jobs:
1736
# Download and cache dependencies
1837
- restore_cache:
1938
keys:
20-
- v1-dependencies-{{ checksum "package.json" }}
39+
- v1-dependencies-{{ checksum "package.json" }}-<< parameters.graphql-version >>
2140
# fallback to using the latest cache if no exact match is found
2241
- v1-dependencies-
2342

24-
- run: yarn
43+
- when:
44+
condition: << parameters.graphql-version >>
45+
steps:
46+
- run: yarn install --ignore-scripts
47+
- run: yarn --ignore-scripts add --dev graphql@<< parameters.graphql-version >>
48+
- unless:
49+
condition: << parameters.graphql-version >>
50+
steps:
51+
- run: yarn install --frozen-lockfile
2552

2653
- save_cache:
2754
paths:
2855
- node_modules
29-
key: v1-dependencies-{{ checksum "package.json" }}
56+
key: v1-dependencies-{{ checksum "package.json" }}-<< parameters.graphql-version >>
3057

3158
# run tests!
32-
- run: yarn test
59+
- run: yarn test

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"clean": "rimraf dist/*",
1010
"build": "tsc",
1111
"test": "npm run lint && npm run testonly",
12-
"testonly": "mocha --check-leaks --exit --full-trace --require ts-node/register 'src/**/__tests__/**/*-test.{ts,tsx}'",
12+
"testonly": "mocha --check-leaks --exit --full-trace --require ts-node/register/transpile-only 'src/**/__tests__/**/*-test.{ts,tsx}'",
1313
"dist": "npm run clean && tsc && npm run build",
1414
"prepublish": "npm run clean && npm run dist"
1515
},

0 commit comments

Comments
 (0)