-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (32 loc) · 846 Bytes
/
ci.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
name: Run Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test_with_db:
runs-on: ubuntu-latest
services:
db:
image: postgres:14-alpine
env:
POSTGRES_USER: vguser
POSTGRES_PASSWORD: supersecretdbpassword
POSTGRES_DB: voterguide
ports:
- 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@v3
- name: Build API image
run: docker build -t api:ci .
- name: Run tests
run: docker run -e DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }} --env-file .env.ci --network host api:ci pytest