Skip to content

wip

wip #98

Workflow file for this run

name: CI
on: push
jobs:
build:
runs-on: ubuntu-latest
env:
DJANGO_SETTINGS_MODULE: config.settings.test
DJANGO_SECRET_KEY: foo
DATABASE_URL: postgresql://postgres@localhost:5432/dora
MINIO_SECRET_KEY: minio-secret-key
# Voir définition des conteneurs s3 et redis
REDIS_URL: redis://localhost:6379
AWS_S3_ENDPOINT_URL: http://localhost:9000
AWS_SECRET_ACCESS_KEY: $MINIO_SECRET_KEY
REQUIREMENTS_PATH: requirements/test.txt
concurrency:
# Voir: https://docs.github.com/en/actions/using-jobs/using-concurrency
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
services:
s3:
image: bitnami/minio:latest
env:
MINIO_SERVER_ACCESS_KEY: minio-access-key
MINIO_SERVER_SECRET_KEY: $MINIO_SECRET_KEY
ports:
- 9000:9000
redis:
image: redis:alpine
ports:
- 6379:6379
postgres:
# Notre instance tourne en PG14 pour l'instant
image: postgis/postgis:14-3.4
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
# boucle d'attente du démarrage de postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Installation de GDAL et psql
run: sudo apt update && sudo apt install -y gdal-bin postgresql-client
- name: Checkout du projet
uses: actions/checkout@v4
- name: Création de la base de données
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_HOST: localhost
run: |
psql -h $POSTGRES_HOST -U $POSTGRES_USER $POSTGRES_DB <<EOL
DROP DATABASE IF EXISTS dora;
CREATE DATABASE dora;
EOL
- name: Installation de Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: $REQUIREMENTS_PATH
- name: Installation des dépendences
run: pip install -r $REQUIREMENTS_PATH
- name: Vérification de la compilation des sources Python
run: python -m compileall -q .
- name: Linting et formatage du code Python
run: ruff check dora config
- name: Vérification Django (check et migrations)
run: |
./manage.py check
./manage.py makemigrations --check --dry-run --noinput
- name: Vérification des fichiers SQL
run: sqlfluff lint queries
- name: Vérification des fichier HTML et templates
run: djhtml -t 2 -c dora
- name: Tests
run: pytest