add postgres to github action

This commit is contained in:
Son Nguyen Kim 2021-08-06 08:54:24 +02:00
parent 142dcafb99
commit a13953e13f
2 changed files with 28 additions and 1 deletions

View File

@ -11,6 +11,33 @@ jobs:
matrix:
python-version: [3.7]
# service containers to run with `postgres-job`
services:
# label used to access the service container
postgres:
# Docker Hub image
image: postgres:13
# service environment variables
# `POSTGRES_HOST` is `postgres`
env:
# optional (defaults to `postgres`)
POSTGRES_DB: test
# required
POSTGRES_PASSWORD: test
# optional (defaults to `5432`)
POSTGRES_PORT: 5432
# optional (defaults to `postgres`)
POSTGRES_USER: test
ports:
# maps tcp port 5432 on service container to the host
- 5432:5432
# set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2

View File

@ -16,7 +16,7 @@ DKIM_PRIVATE_KEY_PATH=local_data/dkim.key
# Database
RESET_DB=true
DB_URI=postgresql://db/test
DB_URI=postgresql://test:test@localhost:5432/test
# Flask
FLASK_SECRET=secret