Skip to content

Commit

Permalink
chore: simplify circle config
Browse files Browse the repository at this point in the history
  • Loading branch information
trs committed Mar 8, 2019
1 parent eafaf6f commit 0d9131c
Showing 1 changed file with 54 additions and 84 deletions.
138 changes: 54 additions & 84 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,127 +1,97 @@
version: 2

create-cache-file: &create-cache-file
run:
name: Setup cache
command: echo "$NODE_VERSION" > _cache_node_version

package-json-cache: &package-json-cache
key: npm-install-{{ checksum "_cache_node_version" }}

base-build: &base-build
steps:
- checkout
- <<: *create-cache-file
- restore_cache:
<<: *package-json-cache
- run:
name: Install
command: npm ci
- persist_to_workspace:
root: "./$NODE_VERSION"
paths:
- node_modules
- save_cache:
<<: *package-json-cache
paths:
- ~/.npm/_cacache
- run:
name: Lint
command: npm run verify
- run:
name: Test
command: npm run test

jobs:
test_node_11:
build:
docker:
- image: circleci/node:11
environment:
- NODE_VERSION: 11
<<: *base-build
- image: &node-image circleci/node:lts
steps:
- checkout
- restore_cache:
keys:
- &npm-cache-key npm-cache-{{ .Branch }}-{{ .Revision }}
- npm-cache-{{ .Branch }}
- npm-cache
- run:
name: Install
command: npm ci
- persist_to_workspace:
root: .
paths:
- node_modules
- save_cache:
key: *npm-cache-key
paths:
- ~/.npm/_cacache

test_node_10:
lint:
docker:
- image: circleci/node:10
environment:
- NODE_VERSION: 10
<<: *base-build
- image: *node-image
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Lint
command: npm run verify

test_node_8:
test:
docker:
- image: circleci/node:8
environment:
- NODE_VERSION: 8
<<: *base-build
- image: *node-image
steps:
- checkout
- attach_workspace:
at: .
- deploy:
name: Test
command: |
npm run test
release_dry_run:
docker:
- image: circleci/node:10
environment:
- NODE_VERSION: 10
- image: *node-image
steps:
- checkout
- attach_workspace:
at: "./10"
at: .
- deploy:
name: Dry Release
command: |
npm run semantic-release -- --dry-run
release:
docker:
- image: circleci/node:10
environment:
- NODE_VERSION: 10
- image: *node-image
steps:
- checkout
- attach_workspace:
at: "./10"
at: .
- deploy:
name: Release
command: |
npm run semantic-release
workflows:
version: 2
test_and_tag:
publish:
jobs:
- test_node_11:
filters:
branches:
only: master
- test_node_10:
filters:
branches:
only: master
- test_node_8:
- build
- lint:
requires:
- build
- test:
requires:
- build
- release_dry_run:
filters:
branches:
only: master
- release_dry_run:
requires:
- test_node_8
- test_node_10
- test_node_11
- test
- lint
- hold_release:
type: approval
requires:
- release_dry_run
- release:
requires:
- hold_release

build_and_test:
jobs:
- test_node_11:
filters:
branches:
ignore: master
- test_node_10:
filters:
branches:
ignore: master
- test_node_8:
filters:
branches:
ignore: master

0 comments on commit 0d9131c

Please sign in to comment.