Run Postgres 10 during testing.

This commit is contained in:
Jannis Leidel 2020-11-29 14:51:26 +01:00
parent 24c196ebe3
commit 5b3672b980
No known key found for this signature in database
GPG key ID: C795956FB489DCA9
3 changed files with 27 additions and 4 deletions

View file

@ -11,6 +11,21 @@ jobs:
matrix:
python-version: ['3.6', '3.7', '3.8']
services:
postgres:
image: postgres:10
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
@ -41,6 +56,12 @@ jobs:
- name: Tox tests
run: |
tox -v -- --cov --cov-append --cov-report term-missing --cov-report xml
env:
DB_NAME: postgres
DB_USER: postgres
DB_PASSWORD: postgres
DB_HOST: localhost
DB_PORT: 5432
- name: Upload coverage
uses: codecov/codecov-action@v1

View file

@ -7,10 +7,11 @@ INSTALLED_APPS = (
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": os.environ.get("DJANGO_DATABASE_NAME_POSTGRES", "modelutils"),
"USER": os.environ.get("DJANGO_DATABASE_USER_POSTGRES", 'postgres'),
"PASSWORD": os.environ.get("DJANGO_DATABASE_PASSWORD_POSTGRES", ""),
"HOST": os.environ.get("DJANGO_DATABASE_HOST_POSTGRES", ""),
"NAME": os.environ.get("DB_NAME", "modelutils"),
"USER": os.environ.get("DB_USER", 'postgres'),
"PASSWORD": os.environ.get("DB_PASSWORD", ""),
"HOST": os.environ.get("DB_HOST", ""),
"PORT": os.envrion.get("DB_PORT", 5432)
},
}
SECRET_KEY = 'dummy'

View file

@ -23,6 +23,7 @@ ignore_outcome =
passenv =
CI
GITHUB_*
DB_*
usedevelop = True
commands =
pytest {posargs}