Merge pull request #32 from maykinmedia/release/0.2.0 #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code quality checks | |
# Run this workflow every time a new commit pushed to your repository | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '**.py' | |
- '**.yml' | |
pull_request: | |
paths: | |
- '**.py' | |
- '**.yml' | |
workflow_dispatch: | |
jobs: | |
isort: | |
name: Code imports | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: 'requirements/*.txt' | |
- name: Install dependencies | |
run: pip install -r requirements/ci.txt | |
- name: Run isort | |
run: isort --check-only --diff . | |
black: | |
name: Code format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: 'requirements/*.txt' | |
- name: Install dependencies | |
run: pip install -r requirements/ci.txt | |
- name: Run black | |
run: black --check --diff src docs | |
flake8: | |
name: Code style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: 'requirements/*.txt' | |
- name: Install dependencies | |
run: pip install -r requirements/ci.txt | |
- name: Run flake8 | |
run: flake8 src | |
migrations: | |
name: Check for model changes not present in the migrations | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgis/postgis:12-2.5 | |
env: | |
POSTGRES_HOST_AUTH_METHOD: trust | |
ports: | |
- 5432:5432 | |
# Needed because the postgres container does not provide a healthcheck | |
options: | |
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: 'requirements/*.txt' | |
- name: Install system packages | |
run: | | |
sudo apt-get update \ | |
&& sudo apt-get install -y --no-install-recommends \ | |
libgdal-dev \ | |
gdal-bin | |
- name: Install dependencies | |
run: pip install -r requirements/ci.txt | |
- name: Check for missing migrations | |
run: src/manage.py makemigrations --check --dry-run | |
env: | |
DJANGO_SETTINGS_MODULE: referentielijsten.conf.ci | |
SECRET_KEY: dummy | |
DB_USER: postgres | |
DB_NAME: postgres | |
DB_PASSWORD: '' |