-
Notifications
You must be signed in to change notification settings - Fork 20
75 lines (65 loc) · 1.96 KB
/
test_server.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: 'Haztrak Server Tests'
# This workflow is responsible for running the Haztrak server tests.
# It spins up a postgres container and runs the tests against it.
env:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password1
POSTGRES_DB: haztrak_db
on:
pull_request:
branches: ['main']
paths:
- 'server/**'
- '.github/workflows/test_server.yaml'
workflow_call:
workflow_dispatch:
defaults:
run:
working-directory: ./server
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 }}
ports:
- 5432/tcp
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Run Tests
env:
HT_SECRET_KEY: 'django-insecure-%btjqoun@6ps$e@8bw$48s+!x1e4aiz&5p2nrf6cmiw4)jsx5d'
HT_CORS_DOMAIN: http://localhost:3000
HT_TIMEZONE: America/New_York
HT_HOST: localhost
HT_RCRAINFO_ENV: preprod
HT_DEBUG: true
HT_DB_ENGINE: django.db.backends.postgresql
HT_DB_HOST: localhost
HT_DB_USER: ${{ env.POSTGRES_USER }}
HT_DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
HT_DB_NAME: ${{ env.POSTGRES_DB }}
HT_DB_PORT: ${{ job.services.postgres.ports[5432] }}
run: |
pytest