-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (56 loc) · 1.44 KB
/
run-pytest.yml
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
name: Backend unit tests
on:
push:
branches: [ "staging", "production"]
pull_request:
paths:
- backend/**
- docker/Dockerfile.postgres
defaults:
run:
working-directory: ./backend
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: backendapp
POSTGRES_PASSWORD: password
POSTGRES_DB: instruct_multilingual
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 2
steps:
- uses: actions/checkout@v3
- name: build and run postgres docker container
uses: docker/build-push-action@v2
with:
context: ./docker/
file: ./docker/Dockerfile.postgres
push: false
tags: database:latest
- name: set up python 3.10
id: pythonsetup
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: install dependencies
if: steps.pythonsetup.outcome == 'success'
id: dependencies
run: |
pip install -U pip
pip install poetry
poetry install --with dev
- name: run pytest unit tests
if: steps.dependencies.outcome == 'success'
run: |
ENVIRONMENT=test poetry run pytest