1
- name : Run linter and tests
2
- on : [push, pull_request]
1
+ name : Test
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
3
7
4
8
jobs :
5
- test :
9
+ test_coverage :
6
10
runs-on : ubuntu-latest
7
- strategy :
8
- fail-fast : false
9
- matrix :
10
- python-version :
11
- - " 3.5"
12
- - " 3.6"
13
- - " 3.7"
14
- - " 3.8"
15
- - " 3.9"
16
- django-version :
17
- - " 2.2"
18
- - " 3.1"
19
- - " 3.2"
20
- drf-version :
21
- - " 3.10"
22
- - " 3.11"
23
- - " 3.12"
24
- exclude :
25
- - python-version : " 3.5"
26
- django-version : " 3.1"
27
- - python-version : " 3.5"
28
- django-version : " 3.2"
29
- # DRF 3.10 imports FieldDoesNotExist from django.db.models,
30
- # which has been moved to django.core.exceptions as of Django 3.1
31
- - django-version : " 3.1"
32
- drf-version : " 3.10"
33
- - django-version : " 3.2"
34
- drf-version : " 3.10"
35
11
36
12
steps :
37
- - uses : actions/checkout@v2
38
-
39
- - name : Set up Python ${{ matrix.python-version }}
40
- uses : actions/setup-python@v2
41
- with :
42
- python-version : ${{ matrix.python-version }}
43
-
44
- - name : Install dependencies
45
- run : |
46
- python -m pip install --upgrade pip
47
- pip install flake8 codecov
48
-
49
- - name : Lint with flake8
50
- run : |
51
- # stop the build if there are Python syntax errors or undefined names
52
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
53
- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
54
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
55
-
56
- - name : Install Django version
57
- run : |
58
- python -m pip install "Django==${{ matrix.django-version }}.*"
59
-
60
- - name : Install DRF version
61
- run : |
62
- python -m pip install "djangorestframework==${{ matrix.drf-version }}.*"
63
-
64
- - name : Python, Django and DRF versions
65
- run : |
66
- echo "Python ${{ matrix.python-version }} -> Django ${{ matrix.django-version }} -> DRF ${{ matrix.drf-version }}"
67
- python --version
68
- echo "Django: `django-admin --version`"
69
- echo "DRF: `pip show djangorestframework|grep Version|sed s/Version:\ //`"
70
-
71
- - name : Setup environment
72
- run : |
73
- pip install -e .
74
- python setup.py install
75
-
76
- - name : Run tests
77
- run : |
78
- # prepare Django project: link all necessary data from the test project into the root directory
79
- # Hint: Simply changing the directory does not work (leads to missing files in coverage report)
80
- ln -s ./tests/test test
81
- ln -s ./tests/manage.py manage.py
82
- ln -s ./tests/settings.py settings.py
83
- ln -s ./tests/urls.py urls.py
84
-
85
- # run tests with coverage
86
- coverage run --source='./django_rest_passwordreset' manage.py test
87
- coverage xml
88
-
89
- - name : Upload coverage to Codecov
90
- uses : codecov/codecov-action@v1
13
+ - uses : actions/checkout@v2
14
+ - name : Set up Python
15
+ uses : actions/setup-python@v1
16
+ with :
17
+ python-version : 3.8
18
+ - name : Install Flit
19
+ run : pip install flit
20
+ - name : Install Dependencies
21
+ run : flit install --symlink
22
+ - name : Test
23
+ run : pytest --cov=ninja_jwt --cov-report=xml tests
24
+ - name : Coverage
25
+ uses : codecov/codecov-action@v1
0 commit comments