Skip to content

Commit c3d1f6c

Browse files
committed
Add GitHub actions for testing, type checking and code formatting.
1 parent 6159662 commit c3d1f6c

File tree

4 files changed

+73
-12
lines changed

4 files changed

+73
-12
lines changed

.github/workflows/main.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
8+
jobs:
9+
pytest:
10+
runs-on: ubuntu-latest
11+
services:
12+
postgres:
13+
image: postgres
14+
env:
15+
POSTGRES_PASSWORD: postgres
16+
options: >-
17+
--health-cmd pg_isready
18+
--health-interval 10s
19+
--health-timeout 5s
20+
--health-retries 5
21+
ports:
22+
- 5432:5432
23+
steps:
24+
- uses: actions/checkout@v6
25+
- uses: astral-sh/setup-uv@v6
26+
- run: uv run pytest
27+
env:
28+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/dreng_tests
29+
POSTGRES_PORT: 5432
30+
31+
mypy:
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
python-version:
37+
- "3.13"
38+
steps:
39+
- uses: actions/checkout@v6
40+
- uses: astral-sh/setup-uv@v6
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
- run: uv run mypy
44+
45+
ruff-format:
46+
runs-on: ubuntu-latest
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
python-version:
51+
- "3.13"
52+
steps:
53+
- uses: actions/checkout@v6
54+
- uses: astral-sh/setup-uv@v6
55+
with:
56+
python-version: ${{ matrix.python-version }}
57+
- run: uv run ruff format --check
58+
59+
ruff-check:
60+
runs-on: ubuntu-latest
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
python-version:
65+
- "3.13"
66+
steps:
67+
- uses: actions/checkout@v6
68+
- uses: astral-sh/setup-uv@v6
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
- run: uv run ruff check

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dist/
33
*.egg-info/
44
.venv
55
.*_cache/
6+
uv.lock

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ warn_unused_ignores = true
5959
django_settings_module = "example_django_project.settings"
6060

6161
[tool.pytest.ini_options]
62-
addopts = "--ds='tests_django_project.settings.postgresql'"
62+
DJANGO_SETTINGS_MODULE = "tests_django_project.settings.postgresql"
6363
python_files = "tests/*.py"
6464

6565
[tool.ruff]

tests_django_project/settings/base.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,6 @@
8080
WSGI_APPLICATION = "tests_django_project.wsgi.application"
8181

8282

83-
# Database
84-
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
85-
86-
DATABASES = {
87-
"default": {
88-
"ENGINE": "django.db.backends.postgresql",
89-
"NAME": "dreng_tests",
90-
}
91-
}
92-
93-
9483
# Password validation
9584
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
9685

0 commit comments

Comments
 (0)