Skip to content
Merged
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
50 changes: 32 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,26 @@ jobs:
SESSION_SECRET_KEY: supersecretkeyforunittests
AUTHENTIK_DISABLE_AUTHENTICATION: 1

services:
postgis:
image: postgis/postgis:17-3.5
# don't test against latest. be explicit in version being tested to avoid breaking changes
# image: postgis/postgis:latest
env:
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POSTGRES_PORT here is set as an environment variable inside the service container, but it does not configure Postgres’ listen port (Postgres listens on 5432 by default) and it is not exported to the job steps. If the tests/app need POSTGRES_PORT, set it under the job-level env: instead; otherwise, remove it to avoid implying it has an effect. (Same issue in the duplicated block in the bdd-tests job.)

Suggested change
POSTGRES_PORT: 5432

Copilot uses AI. Check for mistakes.
options: >-
--health-cmd pg_isready
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The healthcheck pg_isready is more reliable when explicit about user/database (to avoid passing in scenarios where auth/db selection would fail later). Consider using an explicit command (e.g., include -U and -d) consistent with how the app connects.

Suggested change
--health-cmd pg_isready
--health-cmd pg_isready -U postgres -d postgres

Copilot uses AI. Check for mistakes.
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
Comment on lines +34 to +48
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PostGIS service configuration is duplicated in both unit-tests and bdd-tests. To reduce drift, consider factoring this into a reusable workflow (workflow_call) or using YAML anchors (if accepted in this repo’s workflow style) so the service definition is maintained in one place.

Copilot uses AI. Check for mistakes.

steps:
- name: Check out source repository
uses: actions/checkout@v6.0.2

- name: Start database (PostGIS)
run: |
docker compose build db
docker compose up -d db

- name: Wait for database readiness
run: |
for i in {1..60}; do
Expand Down Expand Up @@ -91,10 +102,6 @@ jobs:
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}

- name: Stop database
if: always()
run: docker compose down -v

bdd-tests:
runs-on: ubuntu-latest

Expand All @@ -116,15 +123,26 @@ jobs:
AUTHENTIK_DISABLE_AUTHENTICATION: 1
DROP_AND_REBUILD_DB: 1

services:
postgis:
image: postgis/postgis:17-3.5
# don't test against latest. be explicit in version being tested to avoid breaking changes
# image: postgis/postgis:latest
env:
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Check out source repository
uses: actions/checkout@v6.0.2

- name: Start database (PostGIS)
run: |
docker compose build db
docker compose up -d db

- name: Wait for database readiness
run: |
for i in {1..60}; do
Expand Down Expand Up @@ -169,7 +187,3 @@ jobs:

- name: Run BDD tests
run: uv run behave tests/features --tags="@backend and @production and not @skip" --no-capture

- name: Stop database
if: always()
run: docker compose down -v