-
Notifications
You must be signed in to change notification settings - Fork 5
146 lines (126 loc) · 3.85 KB
/
run_tests.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: "_Tests"
on:
workflow_call:
defaults:
run:
shell: bash
jobs:
unit_tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:15-3.3-alpine
env:
POSTGRES_USER: qfdmo
POSTGRES_PASSWORD: qfdmo # pragma: allowlist secret
POSTGRES_DB: qfdmo
options: >-
--health-cmd pg_isready
--health-interval 1s
--health-timeout 1s
--health-retries 50
ports:
- 6543:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: "pip"
python-version: "3.12.1"
- name: Install GIS Packages
run: |
sudo apt-get update
sudo apt-get install gdal-bin
- name: Install Dependencies
run: pip install --require-hashes --no-deps -r airflow-requirements.txt -r requirements.txt -r dev-requirements.txt
- name: Run unit tests
run: pytest unit_tests
- name: Run integration tests
run: pytest integration_tests
- name: Run data tests
run: pytest dags_unit_tests
- name: Check code formatting
run: black --check --diff .
- uses: chartboost/ruff-action@v1
- name: Check for missing migrations
run: python manage.py makemigrations --check --no-input --settings=core.test_settings
env:
SECRET_KEY: votre_blanquette_est_bonne # pragma: allowlist secret
DATABASE_URL: "postgres://fakeusername:fakepassword@postgres:5432/database" # pragma: allowlist secret
frontend_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".tool-versions"
cache: "npm"
- name: Build assets
run: |
npm ci
npm run build
- name: Check code formatting
run: npm run lint
- name: Run tests
run: npm run test
e2e:
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
services:
postgres:
image: postgis/postgis:15-3.3-alpine
env:
POSTGRES_USER: qfdmo
POSTGRES_PASSWORD: qfdmo # pragma: allowlist secret
POSTGRES_DB: qfdmo
options: >-
--health-cmd pg_isready
--health-interval 1s
--health-timeout 1s
--health-retries 50
ports:
- 6543:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".tool-versions"
cache: "npm"
- name: Build assets
run: |
npm ci
npm run build
- uses: actions/setup-python@v5
with:
cache: "pip"
python-version: "3.12.1"
- name: Install GIS Packages
run: |
sudo apt-get update
sudo apt-get install gdal-bin
- name: Install Dependencies
run: pip install --require-hashes --no-deps -r requirements.txt -r dev-requirements.txt
- name: Set env variables
run: cp .env.template .env
- name: Migrate database
run: |
python manage.py createcachetable
python manage.py migrate
- name: Populate database
run: |
python manage.py loaddata actions acteur_services acteur_types categories objets produits synonymes
- name: Run serveur
run: |
python manage.py runserver &
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test --reporter=list --update-snapshots --shard=${{ matrix.shard }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30