Skip to content

Commit fe7e76e

Browse files
committed
Make CI environment require DATABASE_URL
This allows using the CI environment in Azure Pipelines for running deploy mid-hooks, which make database our migrations.
1 parent 5a753df commit fe7e76e

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,16 @@ jobs:
107107
run: poetry run python manage.py makemigrations --check --no-color --no-input --dry-run
108108
env:
109109
DJANGO_SETTINGS_ENVIRONMENT: CI
110+
DATABASE_URL: postgis://tvp:tvp@localhost:5432/tvp
110111

111112
- name: "Test for missing translation"
112113
run: poetry run python -m tilavarauspalvelu.hooks.translations_done
113114
env:
114115
DJANGO_SETTINGS_ENVIRONMENT: CI
116+
DATABASE_URL: postgis://tvp:tvp@localhost:5432/tvp
115117

116118
- name: "Run pytest with coverage"
117-
run: poetry run pytest --cov=. --cov-report=xml --cov-branch --disable-warnings
119+
run: poetry run pytest --cov=. --cov-report=xml --cov-branch --disable-warnings --skip-slow
118120
env:
119121
DJANGO_SETTINGS_ENVIRONMENT: AutomatedTests
120122

tilavarauspalvelu/settings.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import zoneinfo
33
from pathlib import Path
44

5-
import dj_database_url
65
from django.utils.translation import gettext_lazy
76
from env_config import Environment, values
87
from helusers.defaults import SOCIAL_AUTH_PIPELINE
@@ -790,12 +789,12 @@ class Build(EmptyDefaults, Common, use_environ=True):
790789

791790

792791
class CI(EmptyDefaults, Common, use_environ=True):
793-
"""Settings for non-test commands in GitHub Actions CI environment."""
792+
"""Settings for commands in GitHub Actions and Azure Pipelines CI environment."""
794793

795-
DEBUG = True
794+
DEBUG = False
796795

797-
# Migration check requires the database
798-
DATABASES = {"default": dj_database_url.parse(url="postgis://tvp:tvp@localhost:5432/tvp")}
796+
# Migrations require the database
797+
DATABASES = values.DatabaseURLValue()
799798

800799

801800
class Platta(Common, use_environ=True):

0 commit comments

Comments
 (0)