Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- workflows:
- version: 2
- build-and-deploy:
- jobs:
- - build
- - deploy:
- requires:
- - build
- filters:
- branches:
- only: master
- version: 2
- jobs:
- build:
- working_directory: ~/microblog
- docker:
- - image: circleci/python:3.9.1 # primary container - build job steps are run
- environment:
- DATABASE_URL: postgresql://microblog_admin@localhost/microblogdb?sslmode=disable
- #- image: circleci/postgres:13.1 # services container
- - image: nimbustech/postgres-ssl:9.5
- environment:
- POSTGRES_DB: microblogdb
- POSTGRES_USER: microblog_admin
- POSTGRES_PASSWORD: $POSTGRES_PASSWORD
- steps:
- - checkout
- - restore_cache:
- key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
- - run:
- name: Install Project Dependencies
- command: |
- python3 -m venv django-project
- source django-project/bin/activate
- pip install --upgrade pip
- pip install -r requirements.txt
- - save_cache:
- key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
- paths:
- - "django-project"
- - run:
- name: Test Application
- command: |
- # Reactivate virtual environment
- source django-project/bin/activate
- # Testing does not run collectstatic by default and this app is using a storage class that requires it.
- python3 manage.py collectstatic
- # Run all tests in the blog.tests module with maximum verbosity
- python3 manage.py test blog.tests --verbosity=3
- deploy:
- machine:
- enabled: true
- working_directory: ~/microblog
- steps:
- - checkout
- - run:
- name: Setup Heroku and Deploy Master
- command: |
- curl https://cli-assets.heroku.com/install.sh | sh
- git push https://heroku:[email protected]/$HEROKU_APP.git master
- heroku run python manage.py migrate
Advertisement
Add Comment
Please, Sign In to add comment