Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,25 @@ jobs:
build:
name: Execute tests
runs-on: ubuntu-latest

services:
postgres:
image: postgres:17
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

env:
DJANGO_SETTINGS_MODULE: pythonie.settings.tests
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db

steps:
- uses: actions/checkout@v2
- name: Set Up Python 3.12
Expand All @@ -16,7 +33,7 @@ jobs:
- name: Install the dependencies
run: |
python -m pip install --upgrade pip setuptools uv
python -m uv pip install -r requirements/main.txt -r requirements/dev.txt
python -m uv pip install -r requirements/main.txt -r requirements/dev.txt -r requirements/production.txt
- name: Run the tests
run: |
python pythonie/manage.py test pythonie --verbosity=2
1 change: 1 addition & 0 deletions pythonie/pythonie/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.postgres",
"compressor",
"taggit",
"modelcluster",
Expand Down
16 changes: 10 additions & 6 deletions pythonie/pythonie/settings/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

# SQLite (simplest install)
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": join(PROJECT_ROOT, "db.sqlite3"),
# Use PostgreSQL if DATABASE_URL is set (for CI), otherwise use SQLite (for local tests)
if os.getenv("DATABASE_URL"):
DATABASES = {"default": dj_database_url.config(conn_max_age=500)}
else:
# SQLite (simplest install for local development)
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": join(PROJECT_ROOT, "db.sqlite3"),
}
}
}

LOGGING.update(
{
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defusedxml==0.7.1
# via
# -c requirements/main.txt
# py-serializable
django==5.2.9
django==6.0
# via
# -c requirements/main.txt
# django-debug-toolbar
Expand Down
1 change: 1 addition & 0 deletions requirements/main.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ django-storages
django-taggit
gunicorn
pandas
psycopg[binary]
pydantic
python-dateutil
pytz
Expand Down
7 changes: 6 additions & 1 deletion requirements/main.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dj-database-url==3.0.1
# via -r requirements/main.in
dj-static==0.0.6
# via -r requirements/main.in
django==5.2.9
django==6.0
# via
# -r requirements/main.in
# dj-database-url
Expand Down Expand Up @@ -123,6 +123,10 @@ pillow==12.0.0
# wagtail
pillow-heif==1.1.1
# via willow
psycopg==3.3.2
# via -r requirements/main.in
psycopg-binary==3.3.2
# via psycopg
pydantic==2.12.5
# via -r requirements/main.in
pydantic-core==2.41.5
Expand Down Expand Up @@ -167,6 +171,7 @@ typing-extensions==4.15.0
# beautifulsoup4
# django-stubs-ext
# django-tasks
# psycopg
# pydantic
# pydantic-core
# typing-inspection
Expand Down
6 changes: 2 additions & 4 deletions requirements/production.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --output-file requirements/production.in requirements/production.txt
-c main.txt
psycopg[binary]
# production.in
-c main.txt
8 changes: 0 additions & 8 deletions requirements/production.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --output-file requirements/production.txt requirements/production.in
psycopg==3.2.13
# via -r requirements/production.in
psycopg-binary==3.2.13
# via psycopg
typing-extensions==4.15.0
# via
# -c requirements/main.txt
# psycopg