forked from paulscherrerinstitute/alphafold-on-fire
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (73 loc) · 2.22 KB
/
test-backend.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
76
77
78
79
---
name: Test Backend
on:
push:
branches: [main]
paths:
- "backend/**"
- "!backend/README.md"
- ".github/workflows/test-backend.yaml"
pull_request:
branches: [main]
paths:
- "backend/**"
- "!backend/README.md"
- ".github/workflows/test-backend.yaml"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
name: Test Code
runs-on: ubuntu-latest
container: python:3.9
defaults:
run:
# Step into backend
working-directory: ./backend
# Service containers to run with `container-job`
strategy:
matrix:
postgres: [13-alpine, 14-alpine]
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:${{ matrix.postgres }}
# Provide the password for postgres
env:
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
POSTGRES_DB: aof
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry install --no-interaction --no-ansi
- name: Run tests
env:
VERSION: test
RELEASEID: test
DB_URI: postgresql+asyncpg://admin:admin@postgres/aof
run: |
coverage run --concurrency=thread,greenlet --source=app -m pytest
coverage xml
# https://github.com/nedbat/coveragepy/issues/1082
# pytest-cov doesn't seem to support the `concurrency` flag so
# using coverage commands
- name: Codecov
# You may pin to the exact commit or the version.
# uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
uses: codecov/codecov-action@v2
with:
# Flag upload to group coverage metrics (e.g. unittests, integration)
flags: backend # optional