Skip to content

Instantly share code, notes, and snippets.

@felicianotech
Created November 16, 2018 15:05
Show Gist options
  • Save felicianotech/481297bc3db4d6c22ed2490f86e88190 to your computer and use it in GitHub Desktop.
Save felicianotech/481297bc3db4d6c22ed2490f86e88190 to your computer and use it in GitHub Desktop.
An example CircleCI 2.1 config building with multiple versions of Node.js.
version: 2.1
workflows:
main:
jobs:
- unit-tests:
version: 6
- unit-tests:
version: 8
- unit-tests:
version: 10
- lint
- integration
- ui
- prod_ui
jobs:
unit-tests:
parameters:
version:
type: string
docker:
- image: circleci/node:<< parameters.version >>
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: "Unit test with Node.js 6"
command: |
yarn run bootstrap
yarn jest -w 1
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
lint:
docker:
- image: circleci/node:8
steps:
- checkout
- run:
name: "Lint Code"
command: |
yarn install
yarn lint
integration:
docker:
- image: circleci/node:8
steps:
- checkout
- run:
name: "Integration Tests"
command: |
yarn install
yarn test:integration
ui:
docker:
- image: circleci/node:8-browsers
steps:
- checkout
- run:
name: "UI Tests"
command: |
cd examples/gatsbygram
yarn install
yarn test
prod_ui:
docker:
- image: circleci/node:8-browsers
steps:
- checkout
- run:
name: "UI Tests"
command: |
cd integration-tests/production-runtime
yarn install
yarn test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment