saurabhmish

Circle CI Config File

Jan 31st, 2021
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.08 KB | None | 0 0
  1. workflows:
  2.   version: 2
  3.   build-and-deploy:
  4.     jobs:
  5.      - build
  6.       - deploy:
  7.           requires:
  8.            - build
  9.           filters:
  10.              branches:
  11.                only: master
  12.  
  13. version: 2
  14. jobs:
  15.   build:
  16.     working_directory: ~/microblog
  17.     docker:
  18.       - image: circleci/python:3.9.1      # primary container - build job steps are run
  19.         environment:
  20.           DATABASE_URL: postgresql://microblog_admin@localhost/microblogdb?sslmode=disable
  21.  
  22.       #- image: circleci/postgres:13.1     # services container
  23.       - image: nimbustech/postgres-ssl:9.5
  24.         environment:
  25.           POSTGRES_DB: microblogdb
  26.           POSTGRES_USER: microblog_admin
  27.           POSTGRES_PASSWORD: $POSTGRES_PASSWORD
  28.  
  29.     steps:
  30.      - checkout
  31.       - restore_cache:
  32.           key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
  33.       - run:
  34.           name: Install Project Dependencies
  35.           command: |
  36.            python3 -m venv django-project
  37.             source django-project/bin/activate
  38.             pip install --upgrade pip
  39.             pip install -r requirements.txt
  40.       - save_cache:
  41.           key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
  42.           paths:
  43.            - "django-project"
  44.       - run:
  45.           name: Test Application
  46.           command: |
  47.            # Reactivate virtual environment
  48.             source django-project/bin/activate
  49.             # Testing does not run collectstatic by default and this app is using a storage class that requires it.
  50.             python3 manage.py collectstatic
  51.             # Run all tests in the blog.tests module with maximum verbosity
  52.             python3 manage.py test blog.tests --verbosity=3
  53.   deploy:
  54.     machine:
  55.       enabled: true
  56.     working_directory: ~/microblog
  57.     steps:
  58.      - checkout
  59.       - run:
  60.           name: Setup Heroku and Deploy Master
  61.           command: |
  62.            curl https://cli-assets.heroku.com/install.sh | sh
  63.             git push https://heroku:[email protected]/$HEROKU_APP.git master
  64.             heroku run python manage.py migrate
Advertisement
Add Comment
Please, Sign In to add comment