Skip to content

Use a test matrix to test against multiple graphql versions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,28 @@
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
version: 2.1

workflows:
all-tests:
jobs:
- test-and-build:
# Override graphql-version to test against specific versions. Type checking is disabled due missing
# definitions for field extensions in older @types/graphql versions
matrix:
parameters:
graphql-version: ["~0.13", "~14.0", "~14.5", "~14.6"]
- test-and-build:
# Leave graphql-version unspecified to respect the lockfile and also run tsc
name: test-and-build-with-typecheck

jobs:
build:
test-and-build:
parameters:
graphql-version:
type: string
default: ""

docker:
# specify the version you desire here
- image: circleci/node:latest
Expand All @@ -17,16 +36,24 @@ jobs:
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-{{ checksum "package.json" }}-<< parameters.graphql-version >>
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: yarn
- when:
condition: << parameters.graphql-version >>
steps:
- run: yarn install --ignore-scripts
- run: yarn --ignore-scripts add --dev graphql@<< parameters.graphql-version >>
- unless:
condition: << parameters.graphql-version >>
steps:
- run: yarn install --frozen-lockfile

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
key: v1-dependencies-{{ checksum "package.json" }}-<< parameters.graphql-version >>

# run tests!
- run: yarn test
- run: yarn test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"clean": "rimraf dist/*",
"build": "tsc",
"test": "npm run lint && npm run testonly",
"testonly": "mocha --check-leaks --exit --full-trace --require ts-node/register 'src/**/__tests__/**/*-test.{ts,tsx}'",
"testonly": "mocha --check-leaks --exit --full-trace --require ts-node/register/transpile-only 'src/**/__tests__/**/*-test.{ts,tsx}'",
"dist": "npm run clean && tsc && npm run build",
"prepublish": "npm run clean && npm run dist"
},
Expand Down