Browse Source

🚀 deploy

main
MTLantoine 5 years ago
parent
commit
2fea9d8149
  1. 40
      .circleci/config.yml

40
.circleci/config.yml

@ -2,8 +2,8 @@ version: 2
jobs:
install:
docker:
- image: circleci/python:3.9.1
- image: circleci/postgres:9.6.5
- image: cimg/python:3.9.1
- image: circleci/postgres:9.6.2
environment:
POSTGRES_DB: example
POSTGRES_USER: circleci
@ -13,30 +13,29 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- setup_remote_docker
- restore_cache:
keys:
- dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/prod.txt" }}
# fallback to using the latest cache if no exact match is found
- dependencies-
- run:
name: Install dependencies
- run:
name: install python and dependencies
command: pip install -r requirements/dev.txt
# Upgrade dependencies for sqlalchemy and Flask-SQLAlchemy to pass unit tests
- run:
command: pip install sqlalchemy --upgrade && pip install Flask-SQLAlchemy --upgrade
- run:
name: Setup dababase
command: pip install sqlalechmy --upgrade && pip install Flask-SQLAlchemy --upgrade
- run:
name: db upgrade
environment:
FLASK_APP: /home/circleci/repo/autoapp.py
FLASK_DEBUG: 0
FLASK_DEBUG: 0
command: flask db upgrade
- run:
name: Flask test
- run:
name: flask test
environment:
FLASK_APP: /home/circleci/repo/autoapp.py
FLASK_DEBUG: 0
command: flask test
back-deploy-heroku:
deploy:
docker:
- image: buildpack-deps:trusty
steps:
@ -47,12 +46,13 @@ jobs:
- run:
name: Smoke Test
command: |
HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/`
HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://devops-project-back.herokuapp.com/api/articles`
if [[ "$HTTPCODE" -ne 200 ]]; then
echo "heroku app not responding, failing deploy" \
exit 1; \
fi
docker-build-and-push:
build-push:
docker:
- image: docker:17.05.0-ce-git
steps:
@ -70,14 +70,16 @@ jobs:
docker tag app $DOCKER_HUB_USER_ID/devops-project-back:latest
docker push $DOCKER_HUB_USER_ID/devops-project-back:$CIRCLE_BUILD_NUM
docker push $DOCKER_HUB_USER_ID/devops-project-back:latest
version: 2.1
workflows:
version: 2
build-test:
devopsTP4:
jobs:
- install
- back-deploy-heroku:
- deploy:
requires:
- install
- docker-build-and-push:
- build-push:
requires:
- install
Loading…
Cancel
Save