Skip to content

Commit 1c3b8ca

Browse files
committed
WIP CI
1 parent ac4106c commit 1c3b8ca

File tree

2 files changed

+33
-28
lines changed

2 files changed

+33
-28
lines changed

.github/workflows/lint_test.yml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,47 @@ on:
44
branches: [main]
55
pull_request:
66

7-
defaults:
8-
run:
9-
working-directory: django
10-
117
jobs:
128
all:
139
runs-on: ubuntu-latest
1410
env:
11+
PYTHONPATH: ${{ github.workspace }}/django/
1512
DJANGO_SETTINGS_MODULE: config.settings.test
13+
TEST_PGUSER: postgres
14+
TEST_PGPASSWORD: postgres
15+
TEST_PGPORT: 5431
16+
TEST_PGDATABASE: test_docurba
1617
SECRET_KEY: test_secret_key
17-
# Default supabase URL: https://supabase.com/docs/guides/local-development/cli/getting-started?queryGroups=access-method&access-method=postgres
18-
DATABASE_URL: postgresql://postgres:postgres@localhost:54322/postgres
1918
UPSTREAM_NUXT: http://localhost:3000
2019

2120
steps:
22-
- uses: actions/checkout@v4
23-
24-
- name: 🛠️ Installation de la CLI Supabase
25-
uses: supabase/setup-cli@b60b5899c73b63a2d2d651b1e90db8d4c9392f51
26-
with:
27-
version: 2.60.0
21+
- name: Set docker image env var
22+
run: |
23+
echo "TEST_DATABASE_URL=postgres://${TEST_PGUSER}:${TEST_PGPASSWORD}@127.0.0.1:${TEST_PGPORT}/${TEST_PGDATABASE}" >> $GITHUB_ENV
2824
29-
- run: supabase db start
25+
- uses: actions/checkout@v4 # TODO use sha
3026

31-
- uses: actions/setup-python@v5
27+
- uses: actions/setup-python@v5 # TODO usa sha
3228
with:
3329
python-version-file: django/.python-version
34-
- uses: astral-sh/setup-uv@v6
30+
31+
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
3532
with:
3633
activate-environment: true
37-
- run: uv sync --locked --all-extras --dev --active
38-
- run: pytest --create-db
39-
- run: ruff format --diff .
40-
- run: ruff check --output-format=github .
41-
- run: python -m django makemigrations --check --dry-run --noinput || (echo "⚠ Migration manquante ⚠"; exit 1)
34+
35+
- run: uv sync --locked --all-extras --dev --active --project=django/
36+
37+
- uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
38+
with:
39+
version: 2025.11.4 # [default: latest] mise version to install
40+
install: true # [default: true] run `mise install`
41+
cache: true # [default: true] cache mise using GitHub's cache
42+
experimental: true # [default: false] enable experimental features
43+
44+
- name: 🛠️ Initialize the test database
45+
run: mise start:tests
46+
47+
- run: pytest django/tests/
48+
- run: ruff format --diff django/
49+
- run: ruff check --output-format=github django/
50+
- run: django-admin makemigrations --check --dry-run --noinput || (echo "⚠ Migration manquante ⚠"; exit 1)

django/config/settings/test.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@
99
CREATE_UNMANAGED_TABLES = True
1010
DATABASES = {
1111
"default": {
12-
"ENGINE": "django.db.backends.postgresql",
13-
"NAME": env.str("TEST_PGDATABASE", "test_postgres"),
14-
"USER": env.str("TEST_PGUSER", "postgres"),
15-
"CONN_MAX_AGE": 3600,
16-
"PASSWORD": env.str("TEST_PGPASSWORD", "postgres"),
17-
"HOST": env.str("TEST_PGHOST", "127.0.0.1"),
18-
"PORT": env.str("TEST_PGPORT", "5431"),
12+
**env.db("TEST_DATABASE_URL"),
13+
"CONN_MAX_AGE": env.int("CONN_MAX_AGE", 0),
14+
"CONN_HEALTH_CHECK": True,
1915
"TEST": {
20-
"MIRROR": "default", # ✅ Forces Django to use the existing database
16+
"MIRROR": "default",
2117
},
2218
},
2319
}

0 commit comments

Comments
 (0)