circleci v2

This commit is contained in:
Danny Coates 2018-02-25 15:44:46 -08:00
parent 74b9e364fe
commit fd2dfcc4f2
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
2 changed files with 98 additions and 28 deletions

View File

@ -1,28 +1,97 @@
machine: version: 2.0
node: jobs:
version: 8 build:
services: docker:
- docker - image: circleci/node:8
- redis steps:
- checkout
deployment: - restore_cache:
latest: key: send-{{ checksum "package-lock.json" }}
branch: master - run: npm install
commands: - save_cache:
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS key: send-{{ checksum "package-lock.json" }}
- docker build -t mozilla/send:latest . paths:
- docker push mozilla/send:latest - 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
deploy_dev:
machine: true
steps:
- attach_workspace:
at: .
- run: docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- run: docker build -t mozilla/send:latest .
- run: docker push mozilla/send:latest
deploy_stage:
machine: true
steps:
- attach_workspace:
at: .
- run: docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- 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: tags:
tag: /.*/ ignore: /^v.*/
owner: mozilla - deploy_latest:
commands: requires:
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - build
- docker build -t mozilla/send:$CIRCLE_TAG . filters:
- docker push mozilla/send:$CIRCLE_TAG branches:
only: master
test: tags:
override: ignore: /^v.*/
- npm run build build_and_deploy_stage:
- npm run lint jobs:
- npm test - build:
- nsp check filters:
branches:
only: master
tags:
only: /^v.*/
- test:
filters:
branches:
only: master
tags:
only: /^v.*/
- deploy_stage:
requires:
- build
- test
filters:
branches:
only: master
tags:
only: /^v.*/

View File

@ -10,6 +10,7 @@
"scripts": { "scripts": {
"precommit": "lint-staged", "precommit": "lint-staged",
"prepush": "npm test", "prepush": "npm test",
"check": "nsp check",
"clean": "rimraf dist", "clean": "rimraf dist",
"build": "npm run clean && webpack -p", "build": "npm run clean && webpack -p",
"lint": "npm-run-all lint:*", "lint": "npm-run-all lint:*",