forked from cfpb/consumerfinance.gov
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (78 loc) · 2.51 KB
/
backend.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: backend
on: pull_request
jobs:
backend:
runs-on: ubuntu-latest
strategy:
matrix:
toxenv:
- lint-current
- validate-migrations
- validate-assets
- validate-translations
- unittest-current
- unittest-future
services:
postgres:
# https://help.github.com/en/actions/configuring-and-managing-workflows/creating-postgresql-service-containers
# https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml
image: postgres
env:
POSTGRES_USER: cfpb
POSTGRES_PASSWORD: cfpb
POSTGRES_DB: cfgov
ports:
- 5432:5432
# 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
# Make sure we have gettext installed for the translation validation
- run: |
sudo apt-get install gettext
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/ci.txt
- name: Run tox -e ${{ matrix.toxenv }}
run: |
tox -e ${{ matrix.toxenv }}
env:
TEST_RUNNER: core.testutils.runners.StdoutCapturingTestRunner
- name: Prepare test coverage
if: matrix.toxenv == 'unittest-current'
run: coverage xml
- name: Store test coverage
# Submit coverage from our prefered tox run only
if: matrix.toxenv == 'unittest-current'
uses: actions/upload-artifact@v1
with:
name: backend_coverage
path: ./coverage.xml
coverage:
runs-on: ubuntu-latest
needs:
- backend
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/ci.txt
- name: Retrieve backend coverage
uses: actions/download-artifact@v1
with:
name: backend_coverage
- name: Check backend test coverage
run: |
diff-cover backend_coverage/coverage.xml --compare-branch=origin/main --fail-under=100