-
Notifications
You must be signed in to change notification settings - Fork 19
68 lines (60 loc) · 1.88 KB
/
pycon-backend-test.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
67
68
name: Backend tests
on:
pull_request:
paths:
- "backend/**/*"
- "backend/*"
- ".github/workflows/backend-test.yml"
jobs:
unit-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432/tcp
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9.15"
- run: pip install poetry==1.4.2
- name: Cache Poetry
uses: actions/cache@v1
id: cache
with:
path: ~/.virtualenvs
key: poetry-${{ hashFiles('**/poetry.lock') }}-v2
restore-keys: |
poetry-${{ hashFiles('**/poetry.lock') }}-v2
- name: Set Poetry config
run: |
poetry config virtualenvs.create false
poetry config virtualenvs.path ~/.virtualenvs
- name: Install python dependencies
working-directory: backend
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'
- name: Install codecov
working-directory: backend
run: pip install codecov
- name: pytest
working-directory: backend
run: |
set +e
OUTPUT=$(poetry run pytest --cov-report xml --cov=. --cov-fail-under 88)
STATUS=$?
echo "$OUTPUT"
cd ..
codecov
exit $STATUS
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:${{ job.services.postgres.ports['5432'] }}/postgres
STRIPE_SECRET_KEY: fake-key
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}