-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.41 KB
/
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
name: Test
on:
pull_request:
branches:
- master
- production
schedule:
- cron: '0 0 * * 0'
jobs:
test:
name: Run unit tests
runs-on: ubuntu-20.04
services:
postgres:
image: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_PASSWORD: ${{ secrets.TEST_DATABASE_PASSWORD }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Cache installed dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/test.txt') }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox==3.23.1
- name: Test with pytest and write coverage to XML file
run: tox -e test-cov-xml
env:
DJANGO_SETTINGS_MODULE: mtdj.settings.test
MTDJ_ENV_FILE: test
DJANGO_SECRET_KEY: ${{ secrets.TEST_DJANGO_SECRET_KEY }}
MTDJ_DATABASE_PASSWORD: ${{ secrets.TEST_DATABASE_PASSWORD }}
MTDJ_DATABASE_USER: postgres
- name: Check test coverage
run: tox -e diff-cover