|
|
|
@ -9,21 +9,19 @@ jobs: |
|
|
|
- restore_cache: |
|
|
|
keys: |
|
|
|
- dependencies-{{ checksum "package.json" }}-v1 |
|
|
|
# fallback to using the latest cache if no exact match is found |
|
|
|
- dependencies- |
|
|
|
- run: yarn install |
|
|
|
- save_cache: |
|
|
|
paths: |
|
|
|
- node_modules |
|
|
|
key: dependencies-{{ checksum "package.json" }}-v1 |
|
|
|
lint: |
|
|
|
testUnit: |
|
|
|
<<: *shared-config |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- restore_cache: |
|
|
|
key: dependencies-{{ checksum "package.json" }}-v1 |
|
|
|
- run: yarn lint |
|
|
|
- run: yarn format:check |
|
|
|
- run: yarn test:unit |
|
|
|
server-doc-build: |
|
|
|
<<: *shared-config |
|
|
|
steps: |
|
|
|
@ -53,105 +51,15 @@ jobs: |
|
|
|
- run: |
|
|
|
name: Deploy app |
|
|
|
command: yarn netlify deploy --prod --dir=/tmp/server-doc |
|
|
|
back-test-unit: |
|
|
|
<<: *shared-config |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- restore_cache: |
|
|
|
key: dependencies-{{ checksum "package.json" }}-v1 |
|
|
|
- run: |
|
|
|
command: yarn test |
|
|
|
environment: |
|
|
|
DATABASE_URL: postgres://psqluer:psqlpassword@localhost:5432/psqluer |
|
|
|
back-test-e2e: |
|
|
|
docker: |
|
|
|
- image: circleci/node:lts-fermium |
|
|
|
- image: circleci/postgres:9.6.5 |
|
|
|
environment: |
|
|
|
POSTGRES_DB: psqluer |
|
|
|
POSTGRES_USER: psqluer |
|
|
|
POSTGRES_PASSWORD: psqlpassword |
|
|
|
working_directory: ~/repo |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- restore_cache: |
|
|
|
key: dependencies-{{ checksum "package.json" }}-v1 |
|
|
|
- run: |
|
|
|
command: echo ok |
|
|
|
environment: |
|
|
|
DATABASE_URL: postgres://psqluer:psqlpassword@localhost:5432/psqluer |
|
|
|
|
|
|
|
docker-build-and-push: |
|
|
|
working_directory: /dockerapp |
|
|
|
docker: |
|
|
|
- image: docker:17.05.0-ce-git |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- setup_remote_docker |
|
|
|
- run: |
|
|
|
name: Build application Docker image |
|
|
|
command: | |
|
|
|
# docker build --cache-from=app -t app . |
|
|
|
echo true |
|
|
|
- deploy: |
|
|
|
name: Publish application to docker hub |
|
|
|
command: | |
|
|
|
# docker login -e $DOCKER_HUB_EMAIL -u $DOCKER_HUB_USER_ID -p $DOCKER_HUB_PWD |
|
|
|
# docker tag app $DOCKER_HUB_USER_ID/my-awesome-ci-expr:$CIRCLE_BUILD_NUM |
|
|
|
# docker tag app $DOCKER_HUB_USER_ID/my-awesome-ci-expr:latest |
|
|
|
# docker push $DOCKER_HUB_USER_ID/my-awesome-ci-expr:$CIRCLE_BUILD_NUM |
|
|
|
# docker push $DOCKER_HUB_USER_ID/my-awesome-ci-expr:latest |
|
|
|
echo true |
|
|
|
|
|
|
|
back-deploy-heroku: |
|
|
|
docker: |
|
|
|
- image: buildpack-deps:trusty |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- run: |
|
|
|
name: Heroku Deploy |
|
|
|
command: git push https://heroku:$HEROKU_KEY@git.heroku.com/whispering-beach-97898.git HEAD:main |
|
|
|
- run: |
|
|
|
name: Smoke Test |
|
|
|
command: | |
|
|
|
HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://whispering-beach-97898.herokuapp.com/` |
|
|
|
if [ "$HTTPCODE" -ne 200 ];then |
|
|
|
echo "heroku app not responding, failing deploy" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
workflows: |
|
|
|
version: 2 |
|
|
|
build-test-and-lint: |
|
|
|
jobs: |
|
|
|
- build |
|
|
|
- back-test-unit: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
- back-test-e2e: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
- lint: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
- docker-build-and-push: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
- lint |
|
|
|
- back-test-e2e |
|
|
|
- back-test-unit |
|
|
|
filters: |
|
|
|
branches: |
|
|
|
only: main |
|
|
|
- back-deploy-heroku: |
|
|
|
- testUnit: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
- lint |
|
|
|
- back-test-e2e |
|
|
|
- back-test-unit |
|
|
|
filters: |
|
|
|
branches: |
|
|
|
only: main |
|
|
|
- server-doc-build: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
|