Browse Source

💚 FIX CI

main
Alexandre SOARES 4 years ago
parent
commit
0f8c9c593a
  1. 83
      .circleci/config.yml

83
.circleci/config.yml

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

Loading…
Cancel
Save