Browse Source

💚 FIX CI

main
Alexandre SOARES 4 years ago
parent
commit
e41d8c9987
  1. 102
      .circleci/config.yml

102
.circleci/config.yml

@ -1,4 +1,3 @@
version: 2
jobs: jobs:
build: &shared-config build: &shared-config
docker: docker:
@ -15,32 +14,8 @@ jobs:
paths: paths:
- node_modules - node_modules
key: dependencies-{{ checksum "package.json" }}-v1 key: dependencies-{{ checksum "package.json" }}-v1
lint:
<<: *shared-config
steps:
- checkout
- restore_cache:
key: dependencies-{{ checksum "package.json" }}-v1
- run: yarn lint
- run: yarn format:check
server-doc-build:
<<: *shared-config
steps:
- checkout
- restore_cache:
key: dependencies-{{ checksum "package.json" }}-v1
- run: yarn doc:build
- run:
name: Copy deployment artifacts to workspace
command: |
cp docs/ /tmp/server-doc -r
- store_artifacts:
path: /tmp/server-doc
- persist_to_workspace:
root: /tmp
paths:
- server-doc
back-test-unit:
test_unit:
<<: *shared-config <<: *shared-config
steps: steps:
- checkout - checkout
@ -49,9 +24,8 @@ jobs:
- run: - run:
command: yarn test command: yarn test
environment: environment:
DATABASE_URL: postgres://$PG_USER:$PG_PWD@localhost:5432/$PG_DB
back-test-e2e:
DATABASE_URL: postgres://psqluer:psqlpassword@localhost:5432/psqluer
end_to_end:
docker: docker:
- image: circleci/node:lts-fermium - image: circleci/node:lts-fermium
- image: circleci/postgres:9.6.5 - image: circleci/postgres:9.6.5
@ -67,28 +41,17 @@ jobs:
- run: - run:
command: yarn test:e2e command: yarn test:e2e
environment: environment:
DATABASE_URL: postgres://$PG_USER:$PG_PASS@localhost:5432/$PG_DB
docker-build-and-push:
working_directory: /dockerapp
docker:
- image: docker:17.05.0-ce-git
DATABASE_URL: $DATABASE_URL
lint:
<<: *shared-config
steps: steps:
- checkout - checkout
- setup_remote_docker:
version: 19.03.13
- run:
name: Build application Docker image
command: |
docker build -t app .
- deploy:
name: Publish application to docker hub
command: |
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
docker tag app $DOCKERHUB_USERNAME/$DOCKERHUB_APP_NAME:$CIRCLE_BUILD_NUM
docker tag app $DOCKERHUB_USERNAME/$DOCKERHUB_APP_NAME:latest
docker push $DOCKERHUB_USERNAME/$DOCKERHUB_APP_NAME:$CIRCLE_BUILD_NUM
docker push $DOCKERHUB_USERNAME/$DOCKERHUB_APP_NAME:latest
back-deploy-heroku:
- restore_cache:
key: dependencies-{{ checksum "package.json" }}-v1
- run: yarn lint
- run: yarn format:check
heroku_deploy:
docker: docker:
- image: buildpack-deps:trusty - image: buildpack-deps:trusty
steps: steps:
@ -104,44 +67,23 @@ jobs:
echo "heroku app not responding, failing deploy" echo "heroku app not responding, failing deploy"
exit 1 exit 1
fi fi
workflows:
version: 2 version: 2
build-test-and-lint:
workflows:
my_workflow:
jobs: jobs:
- build - build
- back-test-unit:
requires:
- build
- back-test-e2e:
- test_unit
- end_to_end:
requires: requires:
- build - build
- lint: - lint:
requires: requires:
- build - build
- docker-build-and-push:
requires:
- build
- lint
- back-test-e2e
- back-test-unit
filters:
branches:
only: main
- back-deploy-heroku:
- heroku_deploy:
requires: requires:
- build - build
- test_unit
- end_to_end
- lint - lint
- back-test-e2e
- back-test-unit
filters:
branches:
only: main
- server-doc-build:
requires:
- build
- lint
- back-test-e2e
- back-test-unit
filters:
branches:
only: main
version: 2
Loading…
Cancel
Save