Yield generated for 9d9d9316-d5f3-47d1-812d-542a1fef0ced
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.
 
 

70 lines
2.9 KiB

version: 2 # use CircleCI 2.0
jobs: # A basic unit of work in a run
build: # runs not using Workflows must have a `build` job as entry point
docker: # run the steps with Docker
# CircleCI Python images available at: https://hub.docker.com/r/circleci/python/
- image: circleci/python:3.7
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKER_HUB_PWD # context / project UI env-var reference
environment: # environment variables for primary container
PIPENV_VENV_IN_PROJECT: true
DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
# CircleCI PostgreSQL images available at: https://hub.docker.com/r/circleci/postgres/
- image: circleci/postgres:9.6.2
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKER_HUB_PWD # context / project UI env-var reference
environment: # environment variables for the Postgres container.
POSTGRES_USER: root
POSTGRES_DB: circle_test
steps: # steps that comprise the `build` job
- checkout # check out source code to working directory
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
- restore_cache:
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
export CONDUIT_SECRET='something-really-secret'
export FLASK_APP=/path/to/autoapp.py
export FLASK_DEBUG=1
sudo pip install pipenv
pipenv lock
pipenv install
pip install -r requirements/dev.txt --user
- save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
- "venv"
- store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: test-results
- store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: test-results
destination: tr1
back-deploy-heroku:
docker:
- image: buildpack-deps:trusty
steps:
- checkout
- run:
name: Heroku Deploy
command: echo $HEROKUFINALTP
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKUFINALTP.git main
- run:
name: Smoke Test
command: |
HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://$HEROKUFINALTP.herokuapp.com/`
if [ "$HTTPCODE" -ne 200 ];then
echo "heroku app not responding, failing deploy"
exit 1
fi
workflows:
version: 2
build-and-deploy:
jobs:
- build
- back-deploy-heroku:
requires:
- build