Skip to content

Commit

Permalink
Db service in ci tests (#488)
Browse files Browse the repository at this point in the history
* add postgres service to test_server.yaml

* add paths filter to docs.yaml workflow

* include the test workflow files in path filter so if our workflows change the new workflow is run
  • Loading branch information
dpgraham4401 authored May 24, 2023
1 parent 0afd266 commit 740d80b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
- name: Login to GitHub Image Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: 'Deploy Documentation'
on:
push:
branches: ['main']
paths:
- 'docs/**'
workflow_dispatch:

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: ['main']
paths:
- 'client/**'
- '.github/workflows/test_client.yaml'
workflow_call:
workflow_dispatch:

Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test_server.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: 'Haztrak Server Tests'

env:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: postgres
POSTGRES_DB: haztrak

on:
pull_request:
branches: ['main']
paths:
- 'server/**'
- '.github/workflows/test_server.yaml'
workflow_call:
workflow_dispatch:

Expand All @@ -15,10 +21,24 @@ defaults:
jobs:
run_server_tests:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ['3.10', '3.11']

services:
postgres:
image: postgres:14
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3

Expand All @@ -41,5 +61,8 @@ jobs:
HT_HOST: localhost
HT_RCRAINFO_ENV: preprod
HT_DEBUG: true
HT_DB_USER: ${{ env.POSTGRES_USER }}
HT_DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
HT_DB_NAME: ${{ env.POSTGRES_DB }}
run: |
pytest

0 comments on commit 740d80b

Please sign in to comment.