2018-02-26 00:44:46 +01:00
|
|
|
version: 2.0
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
key: send-{{ checksum "package-lock.json" }}
|
|
|
|
- run: npm install
|
|
|
|
- save_cache:
|
|
|
|
key: send-{{ checksum "package-lock.json" }}
|
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
- run: npm run build
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- ./*
|
|
|
|
test:
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:8-browsers
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
key: send-{{ checksum "package-lock.json" }}
|
|
|
|
- run: npm install
|
|
|
|
- save_cache:
|
|
|
|
key: send-{{ checksum "package-lock.json" }}
|
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
- run: npm run check
|
|
|
|
- run: npm run lint
|
|
|
|
- run: npm test
|
2018-02-26 19:09:28 +01:00
|
|
|
- store_artifacts:
|
|
|
|
path: coverage
|
2018-02-26 00:44:46 +01:00
|
|
|
deploy_dev:
|
|
|
|
machine: true
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
2018-02-26 02:06:28 +01:00
|
|
|
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
2018-02-26 00:44:46 +01:00
|
|
|
- run: docker build -t mozilla/send:latest .
|
|
|
|
- run: docker push mozilla/send:latest
|
|
|
|
deploy_stage:
|
|
|
|
machine: true
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
2018-02-26 02:06:28 +01:00
|
|
|
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
2018-02-26 00:44:46 +01:00
|
|
|
- run: docker build -t mozilla/send:$CIRCLE_TAG .
|
|
|
|
- run: docker push mozilla/send:$CIRCLE_TAG
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
test_pr:
|
|
|
|
jobs:
|
|
|
|
- test:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: master
|
|
|
|
build_and_deploy_dev:
|
|
|
|
jobs:
|
|
|
|
- build:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
|
|
|
tags:
|
|
|
|
ignore: /^v.*/
|
2018-02-26 02:06:28 +01:00
|
|
|
- deploy_dev:
|
2018-02-26 00:44:46 +01:00
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
|
|
|
tags:
|
|
|
|
ignore: /^v.*/
|
|
|
|
build_and_deploy_stage:
|
|
|
|
jobs:
|
|
|
|
- build:
|
|
|
|
filters:
|
2018-02-26 02:14:37 +01:00
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
2018-02-26 00:44:46 +01:00
|
|
|
tags:
|
|
|
|
only: /^v.*/
|
|
|
|
- test:
|
|
|
|
filters:
|
2018-02-26 02:14:37 +01:00
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
2018-02-26 00:44:46 +01:00
|
|
|
tags:
|
|
|
|
only: /^v.*/
|
|
|
|
- deploy_stage:
|
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
filters:
|
2018-02-26 02:14:37 +01:00
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
2018-02-26 00:44:46 +01:00
|
|
|
tags:
|
|
|
|
only: /^v.*/
|