Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save felicianotech/54b2a8c8e6ff31649053cf29919da6d0 to your computer and use it in GitHub Desktop.
Save felicianotech/54b2a8c8e6ff31649053cf29919da6d0 to your computer and use it in GitHub Desktop.
An example CircleCI 2.0 config building with multiple versions of Node.js.
workflows:
version: 2
main:
jobs:
- unit-node6
- unit-node8
- unit-node10
- lint
- integration
- ui
- prod_ui
version: 2
jobs:
unit-node6:
docker:
- image: circleci/node:6
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
unit-node8:
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: "Unit test with Node.js 8"
command: |
yarn run bootstrap
yarn jest -w 1
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
unit-node10:
docker:
- image: circleci/node:10
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: "Unit test with Node.js 10"
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/my-js-repo
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