diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 843893e..9f62e00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,26 @@ jobs: python-build: name: Python 3.12 runs-on: ubuntu-latest + + services: + postgres: + # Docker Hub image + image: postgres:14 + # Provide the credentials + env: + POSTGRES_USER: github + POSTGRES_PASSWORD: github + POSTGRES_DB: github_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + steps: - name: Checkout code uses: actions/checkout@v4 @@ -29,3 +49,5 @@ jobs: run: | coverage run manage.py test coverage report + env: + DJANGO_SETTINGS_MODULE: 'chowist.settings.test' diff --git a/chowist/settings/base.py b/chowist/settings/base.py index d061138..7979fa6 100644 --- a/chowist/settings/base.py +++ b/chowist/settings/base.py @@ -4,10 +4,10 @@ Generated by 'django-admin startproject' using Django 2.0.1. For more information on this file, see -https://docs.djangoproject.com/en/4.1/topics/settings/ +https://docs.djangoproject.com/en/5.1/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/4.1/ref/settings/ +https://docs.djangoproject.com/en/5.1/ref/settings/ """ import os @@ -18,7 +18,7 @@ # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.getenv("DJANGO_SECRET", "dummy") @@ -78,7 +78,7 @@ # Password validation -# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ {"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"}, @@ -89,7 +89,7 @@ # Internationalization -# https://docs.djangoproject.com/en/4.1/topics/i18n/ +# https://docs.djangoproject.com/en/5.1/topics/i18n/ LANGUAGE_CODE = "en-us" @@ -103,7 +103,7 @@ # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/4.1/howto/static-files/ +# https://docs.djangoproject.com/en/5.1/howto/static-files/ STATIC_URL = "/static/" STATICFILES_DIRS = [os.path.join(BASE_DIR, "staticfiles")] @@ -111,13 +111,13 @@ # Authentication -# https://docs.djangoproject.com/en/4.1/topics/auth/default/ +# https://docs.djangoproject.com/en/5.1/topics/auth/default/ LOGIN_REDIRECT_URL = "portal:home" # Logging -# https://docs.djangoproject.com/en/4.1/topics/logging/ +# https://docs.djangoproject.com/en/5.1/topics/logging/ LOGGING = { "version": 1, @@ -173,7 +173,7 @@ # Auto field -# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field +# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.AutoField" diff --git a/chowist/settings/dev.py b/chowist/settings/dev.py index 55c6d91..9d1074f 100644 --- a/chowist/settings/dev.py +++ b/chowist/settings/dev.py @@ -7,13 +7,12 @@ # Database -# https://docs.djangoproject.com/en/4.1/ref/settings/#databases +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "NAME": "postgres", - "DATABASE": "postgres", "USER": "postgres", "HOST": "db", "PORT": 5432, diff --git a/chowist/settings/local.py b/chowist/settings/local.py index bd57431..b00292d 100644 --- a/chowist/settings/local.py +++ b/chowist/settings/local.py @@ -3,13 +3,13 @@ from chowist.settings.base import * # noqa # Password validation -# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [] # Database -# https://docs.djangoproject.com/en/4.1/ref/settings/#databases +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases DATABASES = { "default": { @@ -20,5 +20,5 @@ # Email Backend -# https://docs.djangoproject.com/en/4.1/topics/email/#email-backends +# https://docs.djangoproject.com/en/5.1/topics/email/#email-backends EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" diff --git a/chowist/settings/test.py b/chowist/settings/test.py index 1105d74..538898d 100644 --- a/chowist/settings/test.py +++ b/chowist/settings/test.py @@ -1,15 +1,15 @@ from chowist.settings.base import * # noqa # Database -# https://docs.djangoproject.com/en/4.1/ref/settings/#databases +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", - "NAME": "circle_test", + "NAME": "github_test", + "USER": "github", + "PASSWORD": "github", "HOST": "127.0.0.1", "PORT": "5432", - "USERNAME": "circleci", - "PASSWORD": "circleci", } }