Skip to content

Commit a77cbfc

Browse files
Merge branch 'main' into add-backlink-on-iframes
2 parents 700c2f3 + 9d82e0e commit a77cbfc

File tree

99 files changed

+4868
-1821
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+4868
-1821
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ on:
44
workflow_call:
55

66
jobs:
7-
87
backend_linter:
98
name: 📝 Backend Linter
109
runs-on: ubuntu-latest
1110
steps:
1211
- uses: actions/checkout@v5
13-
- uses: actions/setup-python@v5
12+
- uses: actions/setup-python@v6
1413
with:
1514
cache: "pip"
1615
- name: Install poetry
@@ -40,7 +39,7 @@ jobs:
4039
runs-on: ubuntu-latest
4140
steps:
4241
- uses: actions/checkout@v5
43-
- uses: actions/setup-node@v4
42+
- uses: actions/setup-node@v5
4443
with:
4544
node-version-file: ".tool-versions"
4645
cache: "npm"
@@ -70,7 +69,7 @@ jobs:
7069

7170
steps:
7271
- uses: actions/checkout@v5
73-
- uses: actions/setup-python@v5
72+
- uses: actions/setup-python@v6
7473
with:
7574
cache: "pip"
7675
- name: Install GIS Packages
@@ -103,7 +102,7 @@ jobs:
103102
runs-on: ubuntu-latest
104103
steps:
105104
- uses: actions/checkout@v5
106-
- uses: actions/setup-node@v4
105+
- uses: actions/setup-node@v5
107106
with:
108107
node-version-file: ".tool-versions"
109108
cache: "npm"
@@ -118,9 +117,6 @@ jobs:
118117
name: tests de bout-en-bout
119118
runs-on: ubuntu-latest
120119
if: ${{ github.ref_name == 'main' || (github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'frontend')) }}
121-
strategy:
122-
matrix:
123-
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
124120
services:
125121
postgres:
126122
image: postgis/postgis:15-3.3-alpine
@@ -142,8 +138,9 @@ jobs:
142138
run: |
143139
cp .env.template .env
144140
echo BASE_URL=http://localhost:8000 >> .env
141+
echo DEBUG=false >> .env
145142
146-
- uses: actions/setup-node@v4
143+
- uses: actions/setup-node@v5
147144
with:
148145
node-version-file: ".tool-versions"
149146
cache: "npm"
@@ -153,7 +150,7 @@ jobs:
153150
npm ci
154151
npm run build
155152
156-
- uses: actions/setup-python@v5
153+
- uses: actions/setup-python@v6
157154
with:
158155
cache: "pip"
159156

@@ -172,12 +169,11 @@ jobs:
172169
- name: Install the project dependencies
173170
run: poetry sync --with dev --no-root
174171

175-
- name: Migrate database
172+
- name: Prepare django, migrate, collect static files...
176173
run: |
177174
make createcachetable
178175
make migrate
179-
env:
180-
PYTEST_CURRENT_TEST: "ongoing"
176+
make collectstatic
181177
182178
- name: Populate database
183179
run: |
@@ -195,7 +191,14 @@ jobs:
195191
run: make init-playwright
196192

197193
- name: Run Playwright tests
198-
run: npx playwright test --reporter=list --update-snapshots --shard=${{ matrix.shard }}
194+
run: npx playwright test --update-snapshots
195+
196+
- uses: actions/upload-artifact@v4
197+
if: ${{ !cancelled() }}
198+
with:
199+
name: playwright-report
200+
path: playwright-report/
201+
retention-days: 30
199202

200203
# Address actions/missing-workflow-permissions rule in
201204
# code scanning alerts

.github/workflows/publish-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Check out the code
1818
uses: actions/checkout@v5
1919

20-
- uses: actions/setup-python@v5
20+
- uses: actions/setup-python@v6
2121
with:
2222
cache: "pip"
2323
- name: Install poetry

.github/workflows/review.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ on:
55
pull_request:
66
types: [opened, synchronize]
77

8+
89
defaults:
910
run:
1011
shell: bash
1112

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
1217
jobs:
1318
ci:
1419
name: 🤖 CI
@@ -41,4 +46,3 @@ jobs:
4146
# code scanning alerts
4247
permissions:
4348
contents: read
44-

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
python 3.12
2-
nodejs 20.17.0
2+
nodejs 20.19.0

Makefile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ DJANGO_ADMIN := $(PYTHON) manage.py
1010
PYTEST := poetry run pytest
1111
HONCHO := poetry run honcho
1212
DB_URL := postgres://webapp:webapp@localhost:6543/webapp# pragma: allowlist secret
13-
ASSISTANT_URL := quefairedemesdechets.ademe.local
14-
LVAO_URL := lvao.ademe.local
13+
BASE_DOMAIN := quefairedemesdechets.ademe.local
1514
FIXTURES_OPTIONS := --indent 4 --natural-foreign --natural-primary
1615

1716
# Makefile config
@@ -23,7 +22,11 @@ check:
2322

2423
.PHONY: init-certs
2524
init-certs:
26-
docker run -ti -v ./nginx-local-only/certs:/app/certs -w /app/certs --rm alpine/mkcert $(LVAO_URL) $(ASSISTANT_URL)
25+
@which mkcert > /dev/null || { echo "mkcert is not installed. Please install it first: brew install mkcert (macOS) or visit https://github.com/FiloSottile/mkcert"; exit 1; }
26+
mkcert -install
27+
mkcert $(BASE_DOMAIN)
28+
mv *.pem ./nginx-local-only/certs/
29+
docker compose restart lvao-proxy
2730

2831
.PHONY: init-playwright
2932
init-playwright:
@@ -46,7 +49,7 @@ init-dev:
4649
cp ./dags/.env.template ./dags/.env
4750
# prepare django
4851
make run-all
49-
make create_remote_db_server
52+
make create-remote-db-server
5053
make migrate
5154
make createcachetable
5255
make createsuperuser
@@ -78,6 +81,10 @@ run-all:
7881
migrate:
7982
$(DJANGO_ADMIN) migrate
8083

84+
.PHONY: collectstatic
85+
collectstatic:
86+
$(DJANGO_ADMIN) collectstatic --noinput
87+
8188
.PHONY: shell
8289
shell:
8390
$(DJANGO_ADMIN) shell
@@ -99,8 +106,8 @@ createcachetable:
99106
clearsessions:
100107
$(DJANGO_ADMIN) clearsessions
101108

102-
.PHONY: create_remote_db_server
103-
create_remote_db_server:
109+
.PHONY: create-remote-db-server
110+
create-remote-db-server:
104111
$(DJANGO_ADMIN) create_remote_db_server
105112

106113
.PHONY: createsuperuser
@@ -158,11 +165,11 @@ dags-test:
158165

159166
.PHONY: e2e-test
160167
e2e-test:
161-
npx playwright test --update-snapshots
168+
npx playwright test --update-snapshots all
162169

163170
.PHONY: e2e-test-ui
164171
e2e-test-ui:
165-
npx playwright test --update-snapshots --ui
172+
npx playwright test --update-snapshots all --ui
166173

167174
.PHONY: a11y
168175
a11y:
@@ -209,6 +216,9 @@ dump-production:
209216
sh scripts/infrastructure/backup-db.sh
210217

211218
# We need to create extensions because they are not restored by pg_restore
219+
.PHONY: create-sql-extensions
220+
create_sql_extensions:
221+
212222
.PHONY: load-production-dump
213223
load-production-dump:
214224
@DUMP_FILE=$$(find tmpbackup -type f -name "*.custom" -print -quit); \
@@ -222,7 +232,7 @@ db-restore:
222232
make create-schema-public
223233
make load-production-dump
224234
make migrate
225-
make create_remote_db_server
235+
make create-remote-db-server
226236

227237
.PHONY: db-restore-for-tests
228238
db-restore-for-tests:
@@ -239,4 +249,4 @@ build-docs:
239249
.PHONY: fmt-infra
240250
fmt-infra:
241251
tofu fmt -recursive infrastructure
242-
terragrunt hcl fmt infrastructure
252+
terragrunt hcl fmt infrastructure

bin/post_deploy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/env bash
22

3-
make createcachetable
4-
make migrate
5-
make clearsessions
6-
make clear-cache
7-
make create_remote_db_server
3+
python manage.py createcachetable
4+
python manage.py migrate
5+
python manage.py clearsessions
6+
python manage.py clear_cache --all
7+
python manage.py create_remote_db_server

core/jinja2_handler.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
from math import sqrt
22

33
from django.http import HttpRequest
4-
from django.templatetags.static import static
5-
from django.urls import reverse
6-
from django.utils.html import linebreaks
74

8-
from core.templatetags.share_tags import get_sharer_content
95
from core.utils import get_direction
10-
from jinja2 import Environment
116
from qfdmo.models import DisplayedActeur
127
from qfdmo.models.action import get_actions_by_direction
138

@@ -65,20 +60,3 @@ def distance_to_acteur(request, acteur):
6560
return f"({round(distance_meters / 1000, 1)} km)".replace(".", ",")
6661
else:
6762
return f"({round(distance_meters / 10) * 10} m)"
68-
69-
70-
def environment(**options):
71-
env = Environment(**options)
72-
env.globals.update(
73-
{
74-
"action_by_direction": action_by_direction,
75-
"hide_object_filter": hide_object_filter,
76-
"distance_to_acteur": distance_to_acteur,
77-
"display_exclusivite_reparation": display_exclusivite_reparation,
78-
"url": reverse,
79-
"static": static,
80-
"sharer": get_sharer_content,
81-
}
82-
)
83-
env.filters.update({"linebreaks": linebreaks})
84-
return env

core/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@
174174

175175
def show_toolbar_callback(request):
176176
path_is_not_excluded = not any(p in request.path for p in patterns_to_exclude)
177-
# view_is_not_in_iframe_mode = "iframe" not in request.GET
177+
178+
if request.headers.get("Sec-Fetch-Dest") == "iframe":
179+
# Hide in iframe
180+
return False
181+
178182
return path_is_not_excluded
179183

180184
patterns_to_exclude = [

0 commit comments

Comments
 (0)