2017-11-17 11:25:17 +00:00
|
|
|
aliases:
|
|
|
|
- &restore-cache
|
|
|
|
keys:
|
|
|
|
- dependencies-{{ .Branch }}-{{ checksum "package.json" }}
|
|
|
|
# Fallback in case checksum fails
|
|
|
|
- dependencies-{{ .Branch }}-
|
2017-06-06 11:54:30 +00:00
|
|
|
|
2017-11-17 11:25:17 +00:00
|
|
|
- &save-cache
|
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
key: dependencies-{{ .Branch }}-{{ checksum "package.json" }}
|
|
|
|
|
2017-11-29 13:44:04 +00:00
|
|
|
- &deploy-website
|
|
|
|
command: |
|
|
|
|
# Deploy Metro website
|
|
|
|
git config --global user.email "metro-bot@users.noreply.github.com"
|
|
|
|
git config --global user.name "Website Deployment Script"
|
|
|
|
echo "machine github.com login metro-bot password $GITHUB_TOKEN" > ~/.netrc
|
|
|
|
# install Docusaurus and generate file of English strings
|
|
|
|
cd website && yarn && yarn run write-translations
|
|
|
|
# build and publish website
|
|
|
|
GIT_USER=metro-bot yarn run publish-gh-pages
|
|
|
|
|
2017-11-17 11:25:17 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-01-22 16:09:34 +00:00
|
|
|
run-js-checks:
|
|
|
|
working_directory: ~/metro
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-cache
|
|
|
|
- run: yarn --no-progress
|
|
|
|
- save-cache: *save-cache
|
|
|
|
- run: yarn run test-ci
|
2017-11-17 11:25:17 +00:00
|
|
|
test-node-9:
|
2018-01-22 16:09:34 +00:00
|
|
|
working_directory: ~/metro
|
2017-11-17 11:25:17 +00:00
|
|
|
docker:
|
|
|
|
- image: circleci/node:9
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-cache
|
|
|
|
- run: yarn --no-progress
|
|
|
|
- save-cache: *save-cache
|
2018-01-22 16:09:34 +00:00
|
|
|
- run: yarn run jest
|
2017-11-17 11:25:17 +00:00
|
|
|
|
|
|
|
test-node-8:
|
2018-01-22 16:09:34 +00:00
|
|
|
working_directory: ~/metro
|
2017-11-17 11:25:17 +00:00
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-cache
|
|
|
|
- run: yarn --no-progress
|
|
|
|
- save-cache: *save-cache
|
2018-01-22 16:09:34 +00:00
|
|
|
- run: yarn run jest
|
2017-11-17 11:25:17 +00:00
|
|
|
|
|
|
|
test-node-6:
|
2018-01-22 16:09:34 +00:00
|
|
|
working_directory: ~/metro
|
2017-11-17 11:25:17 +00:00
|
|
|
docker:
|
|
|
|
- image: circleci/node:6
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-cache
|
|
|
|
- run: sudo npm i -g yarn@^1.2.1
|
|
|
|
- run: yarn --no-progress
|
|
|
|
- save-cache: *save-cache
|
2018-01-22 16:09:34 +00:00
|
|
|
- run: yarn run jest
|
2017-11-17 11:25:17 +00:00
|
|
|
|
2018-01-22 16:09:34 +00:00
|
|
|
publish-to-npm:
|
|
|
|
working_directory: ~/metro
|
2017-11-17 11:25:17 +00:00
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-cache
|
|
|
|
- run:
|
2017-11-30 11:56:25 +00:00
|
|
|
working_directory: packages/metro
|
2017-11-17 11:25:17 +00:00
|
|
|
command: yarn --no-progress
|
|
|
|
- save-cache: *save-cache
|
2018-04-11 17:38:46 +00:00
|
|
|
- run:
|
|
|
|
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
2017-11-24 15:23:00 +00:00
|
|
|
- run:
|
2018-01-22 16:09:34 +00:00
|
|
|
working_directory: ~/metro
|
2018-03-21 02:19:15 +00:00
|
|
|
command: npm run publish
|
2017-11-29 13:44:04 +00:00
|
|
|
test-and-deploy-website:
|
|
|
|
working_directory: ~/metro
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-cache
|
|
|
|
- run: |
|
|
|
|
cd website
|
|
|
|
yarn --no-progress
|
|
|
|
- save-cache: *save-cache
|
|
|
|
- deploy: *deploy-website
|
2017-11-17 11:25:17 +00:00
|
|
|
|
|
|
|
# Workflows enables us to run multiple jobs in parallel
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build-and-deploy:
|
|
|
|
jobs:
|
2018-01-22 16:09:34 +00:00
|
|
|
- run-js-checks
|
2017-11-17 11:25:17 +00:00
|
|
|
- test-node-6
|
2017-11-29 13:44:04 +00:00
|
|
|
- test-node-8
|
|
|
|
- test-node-9
|
|
|
|
- test-and-deploy-website
|
2018-01-22 16:09:34 +00:00
|
|
|
- publish-to-npm:
|
2017-11-17 11:25:17 +00:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
tags:
|
|
|
|
only: /v[0-9]+(\.[0-9]+)*/
|