-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (92 loc) · 3.11 KB
/
back-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Dora Back CI
on:
push:
paths:
- 'back/**'
- '.github/workflows/**'
pull_request:
paths:
- 'back/**'
- '.github/workflows/**'
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
REDIS_URL: redis://localhost:6379
AWS_S3_ENDPOINT_URL: http://localhost:9000
AWS_SECRET_ACCESS_KEY: $MINIO_SECRET_KEY
REQUIREMENTS_PATH: requirements/test.txt # Pas besoin de préciser 'back' ici, car le 'working-directory' sera 'back'
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:
image: postgis/postgis:14-3.4
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
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
# On spécifie que toutes les étapes suivantes se feront dans le répertoire 'back'
- name: Création de la base de données
working-directory: back
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: back/$REQUIREMENTS_PATH
- name: Installation des dépendences
working-directory: back
run: pip install -r $REQUIREMENTS_PATH
- name: Vérification de la compilation des sources Python
working-directory: back
run: python -m compileall -q .
- name: Linting et formatage du code Python
working-directory: back
run: ruff check dora config
- name: Vérification Django (check et migrations)
working-directory: back
run: |
./manage.py check
./manage.py makemigrations --check --dry-run --noinput
- name: Vérification des fichiers SQL
working-directory: back
run: sqlfluff lint queries
- name: Vérification des fichier HTML et templates
working-directory: back
run: djhtml -t 2 -c dora
- name: Tests
working-directory: back
run: pytest