diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66cd54e7..58ccb1bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/tests/test.env b/tests/test.env index b8f1399d..8b5669fd 100644 --- a/tests/test.env +++ b/tests/test.env @@ -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