|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +orbs: |
| 4 | + # The python orb contains a set of prepackaged circleci configuration you can use repeatedly in your configurations files |
| 5 | + # Orb commands and jobs help you with common scripting around a language/tool |
| 6 | + # so you dont have to copy and paste it everywhere. |
| 7 | + # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python |
| 8 | + python: circleci/python@1.2 |
| 9 | + # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/heroku |
| 10 | + heroku: circleci/heroku@1.2 |
| 11 | + |
| 12 | +workflows: |
| 13 | + sample: # This is the name of the workflow, feel free to change it to better match your workflow. |
| 14 | + # Inside the workflow, you define the jobs you want to run. |
| 15 | + # For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows |
| 16 | + jobs: |
| 17 | + - build-and-test |
| 18 | + - heroku/deploy-via-git: |
| 19 | + force: true # this parameter instructs the push to use a force flag when pushing to the heroku remote, see: https://devcenter.heroku.com/articles/git |
| 20 | + requires: |
| 21 | + - build-and-test # only run deploy-via-git job if the build job has completed |
| 22 | + filters: |
| 23 | + branches: |
| 24 | + # This sample config runs this job on any branch matching the regex below, however, it's more likely you want to only run this job on master. |
| 25 | + only: /.*-heroku-deploy/ # Delete this line |
| 26 | + # only: master # Uncomment this line |
| 27 | + |
| 28 | +jobs: |
| 29 | + build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do! |
| 30 | + # These next lines defines a docker executors: https://circleci.com/docs/2.0/executor-types/ |
| 31 | + # You can specify an image from dockerhub or use one of the convenience images from CircleCI's Developer Hub |
| 32 | + # A list of available CircleCI docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python |
| 33 | + # The executor is the environment in which the steps below will be executed - below will use a python 3.9 container |
| 34 | + # Change the version below to your required version of python |
| 35 | + docker: |
| 36 | + - image: cimg/python:3.8 |
| 37 | + # Checkout the code as the first step. This is a dedicated CircleCI step. |
| 38 | + # The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default. |
| 39 | + # Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt. |
| 40 | + # Then run your tests! |
| 41 | + # CircleCI will report the results back to your VCS provider. |
| 42 | + steps: |
| 43 | + - checkout |
| 44 | + - python/install-packages: |
| 45 | + pkg-manager: pip |
| 46 | + # app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory. |
| 47 | + # pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements. |
| 48 | + - run: |
| 49 | + name: Run tests |
| 50 | + # This assumes pytest is installed via the install-package step above |
| 51 | + command: pytest |
0 commit comments