lion/.circleci/config.yml
2019-12-05 14:12:11 +01:00

74 lines
1.9 KiB
YAML

# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:10.16.0-browsers
jobs:
test:
<<: *defaults
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v3-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v3-dependencies-
- run: yarn install --frozen-lockfile
- save_cache:
paths:
- node_modules
key: v2-dependencies-{{ checksum "package.json" }}
# run lint
- run: npm run lint
# run test locally first
- run: npm run test
# make sure size is ok
- run: npm run bundlesize
# run compatibility tests for multiple browser via browserstack
# disabled until we can safely test multiple browsers
# - run: npm run test:bs
- persist_to_workspace:
root: ~/repo
paths: .
deploy:
<<: *defaults
steps:
# will add github as known host
- checkout
- attach_workspace:
at: ~/repo
- add_ssh_keys:
fingerprints:
- 'df:41:a0:89:d0:a1:30:7d:08:38:d6:65:73:61:a4:ec'
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: git config --global user.email circleci@circleci
- run: git config --global user.name CircleCI
- run:
name: Publish package
command: "./node_modules/.bin/lerna publish --message 'chore: release new versions' --exact --yes"
workflows:
version: 2
test-deploy:
jobs:
- test
- deploy:
requires:
- test
filters:
branches:
only: master