Yield generated for 1815f06a-80e6-4837-882b-dd7ffb311be7
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

112 lines
2.8 KiB

---
jobs:
build:
docker:
- auth:
password: $DOCKERHUB_PASSWORD
username: xaela37
image: circleci/node:lts-fermium
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- dependencies-{{ checksum "package.json" }}-v1
- dependencies-
- run: yarn install
- save_cache:
paths:
- node_modules
key: dependencies-{{ checksum "package.json" }}-v1
test_unit:
docker:
- auth:
password: $DOCKERHUB_PASSWORD
username: xaela37
image: circleci/node:lts-fermium
steps:
- checkout
- restore_cache:
key: dependencies-{{ checksum "package.json" }}-v1
- run:
command: yarn test
end_to_end:
docker:
- auth:
password: $DOCKERHUB_PASSWORD
username: xaela37
image: circleci/node:lts-fermium
- auth:
password: $DOCKERHUB_PASSWORD
username: xaela37
environment:
POSTGRES_DB: pgdb
POSTGRES_PASSWORD: pass
POSTGRES_USER: pguser
image: "circleci/postgres:9.6.2-alpine"
steps:
- checkout
- restore_cache:
keys:
- "npm-v1-dependencies-{{ checksum \"yarn.lock\" }}"
- run:
command: "yarn test:e2e"
environment:
DATABASE_URL: "postgres://pguser:pass@localhost:5432/pgdb"
name: "yarn test"
lint:
docker:
- auth:
password: $DOCKERHUB_PASSWORD
username: xaela37
image: "cimg/node:14.15.0"
steps:
- checkout
- restore_cache:
key: "npm-v1-dependencies-{{ checksum \"yarn.lock\" }}"
- run:
command: |-
yarn lint
yarn format:check
name: "step lint"
heroku_deploy:
docker:
- image: buildpack-deps:trusty
steps:
- checkout
- run:
name: Heroku Deploy
command: git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:main
- run:
name: Smoke Test
command: |
HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://backend-final-devops.herokuapp.com/`
if [ "$HTTPCODE" -ne 200 ];then
echo "heroku app not responding, failing deploy"
exit 1
fi
version: 2
workflows:
my_workflow:
jobs:
- build
- test_unit:
requires:
- build
- end_to_end:
requires:
- build
- lint:
requires:
- build
- heroku_deploy:
requires:
- build
- test_unit
- end_to_end
- lint
version: 2