18.12. Tests CI/CD
Continuous Integration and Deployment
18.12.1. Bitbucket Pipelines
image: python:3.13
clone:
depth: full
pipelines:
default:
- parallel:
- step:
name: "Type Checking"
caches:
- pip
script:
- python -m pip install mypy
- python -m mypy --ignore-missing-imports bin
- python -m mypy --ignore-missing-imports client
# - python -m mypy --ignore-missing-imports myproject
- step:
name: "PEP-8 compliance"
caches:
- pip
script:
- python -m pip install pycodestyle
- python -m pycodestyle bin
- python -m pycodestyle client --ignore=E402
- python -m pycodestyle myproject
- step:
name: "Tests"
caches:
- pip
script:
- python -m pip install -r requirements.txt
- python -m pip freeze
- python manage.py check
- python manage.py test myproject.tests --verbosity=2
- step:
name: "Static Code Analysis"
image: java:8
script:
- curl --insecure -OL https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227.zip
- unzip sonar-scanner-cli-*.zip
- ./sonar-scanner-*/bin/sonar-scanner
- step:
name: "Deployment"
deployment: production
trigger: automatic
script:
- git push --force https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD
18.12.2. Travis
dist: trusty
sudo: required
language: python
python:
- 3.13
addons:
sonarcloud:
organization: "astromatt"
jdk:
- oraclejdk8
cache:
directories:
- '$HOME/.sonar/cache'
install:
- python -m pip install -r requirements.txt
script:
- python -m mypy bin
- python -m mypy client
- python -m mypy myproject
- python -m pycodestyle bin
- python -m pycodestyle client --ignore=E402
- python -m pycodestyle myproject
- python manage.py check
- python manage.py test myproject.tests --verbosity=2
after_success:
- sonar-scanner --debug