-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (71 loc) · 2.2 KB
/
tests.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
name: tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.9']
django:
- 'Django>=3.2,<3.3'
- 'Django>=4.0,<4.1'
experimental: [false]
include:
- python: '3.9'
django: 'https://github.com/django/django/archive/refs/heads/stable/4.2.x.zip#egg=Django'
experimental: true
# NOTE this job will appear to pass even when it fails because of
# `continue-on-error: true`. Github Actions apparently does not
# have this feature, similar to Travis' allow-failure, yet.
# https://github.com/actions/toolkit/issues/399
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
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: ${{ matrix.python }}
- name: Setup
run: |
python --version
pip install --upgrade pip wheel
pip install "${{ matrix.django }}" psycopg2-binary pynose flake8 coverage
- name: Run tests
env:
DB_SETTINGS: >-
{
"ENGINE":"django.db.backends.postgresql_psycopg2",
"NAME":"field_audit",
"USER":"postgres",
"PASSWORD":"postgres",
"HOST":"localhost",
"PORT":"5432"
}
run: pynose -v --with-coverage --cover-branches --cover-package=field_audit
continue-on-error: ${{ matrix.experimental }}
- name: Check migrations
run: |
./example/manage.py makemigrations field_audit
git add ./field_audit/migrations
trap 'git reset --hard HEAD' EXIT # discard changes on exit (needed for continue-on-error)
git diff --cached --exit-code
continue-on-error: ${{ matrix.experimental }}
- name: Check style
run: flake8 --config=setup.cfg