1
1
name : test
2
2
3
- on : pull_request
3
+ on :
4
+ pull_request :
5
+ push :
6
+ branches :
7
+ - master
4
8
5
9
jobs :
6
10
linting :
7
11
runs-on : ubuntu-latest
8
12
steps :
9
- - uses : snok/.github/workflows/linting@main
13
+ - uses : actions/checkout@v2
14
+ - uses : actions/setup-python@v2
15
+ with :
16
+ python-version : " 3.10"
17
+ - uses : actions/cache@v2
18
+ id : cache-venv
19
+ with :
20
+ path : .venv
21
+ key : venv-0 # increment to reset
22
+ - run : |
23
+ pip install virtualenv
24
+ virtualenv .venv
25
+ source .venv/bin/activate
26
+ pip install pre-commit
27
+ if: steps.cache-venv.outputs.cache-hit != 'true'
28
+ - uses : actions/cache@v2
29
+ id : pre-commit-cache
30
+ with :
31
+ path : ~/.cache/pre-commit
32
+ key : key-0
33
+ - run : |
34
+ source .venv/bin/activate
35
+ pre-commit run --all-files
10
36
11
37
get-python-versions :
12
38
runs-on : ubuntu-latest
@@ -17,48 +43,59 @@ jobs:
17
43
id : get-python-versions-action
18
44
with :
19
45
min-version : 3.6
20
- include-prereleases : true
46
+ include-prereleases : false
21
47
22
48
test :
23
- needs : [linting, get-python-versions]
49
+ needs : [get-python-versions]
24
50
runs-on : ubuntu-latest
25
51
strategy :
26
52
fail-fast : false
27
53
matrix :
28
54
python-version : ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
29
55
django-version : [ "2.2", "3.0", "3.1", "3.2" ]
30
56
steps :
31
- - name : Check out repository
32
- uses : actions/checkout@v2
33
- - name : Set up python ${{ matrix.python-version }}
34
- uses : actions/setup-python@v2
57
+ - uses : actions/checkout@v2
58
+ - uses : actions/setup-python@v2
59
+ with :
60
+ python-version : " ${{ matrix.python-version }}"
61
+ - uses : actions/cache@v2
62
+ id : poetry-cache
35
63
with :
36
- python-version : ${{ matrix.python-version }}
64
+ path : ~/.local
65
+ key : key-0
37
66
- name : Install poetry
38
67
uses : snok/install-poetry@v1
39
68
with :
40
69
version : 1.2.0a2
41
- virtualenvs-in-project : true
42
- - name : Load cached venv
43
- uses : actions/cache@v2
70
+ virtualenvs-create : false
71
+ - uses : actions/cache@v2
44
72
id : cache-venv
45
73
with :
46
74
path : .venv
47
- key : ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-4
48
- - name : Install dependencies
49
- run : poetry install --no-interaction --no-root
75
+ key : ${{ hashFiles('**/poetry.lock') }}-0
76
+ - run : |
77
+ pip install virtualenv
78
+ virtualenv .venv
79
+ source .venv/bin/activate
80
+ pip install pip setuptools wheel -U
81
+ poetry install --no-interaction --no-root
50
82
if: steps.cache-venv.outputs.cache-hit != 'true'
51
- - name : Install package
52
- run : poetry install --no-interaction
53
- - name : Install django ${{ matrix.django-version }}
54
- run : |
83
+ - run : |
55
84
source .venv/bin/activate
56
- poetry add "Django==${{ matrix.django-version }}"
85
+ pip install "Django==${{ matrix.django-version }}"
57
86
- name : Install DRF 3.11 on Django 2.2
58
87
if : matrix.django-version == '2.2'
59
- run : poetry add "djangorestframework==3.11.1"
88
+ run : pip install "djangorestframework==3.11.1"
89
+ - run : pip install coverage
90
+ if : matrix.python-version == '3.10'
60
91
- name : Run tests
61
92
run : |
62
93
source .venv/bin/activate
63
- poetry run pytest --cov=openapi_tester --verbose --assert=plain
94
+ poetry run pytest --cov=openapi_tester --verbose --assert=plain --cov-report=xml
64
95
poetry run coverage report
96
+ - uses : codecov/codecov-action@v2
97
+ with :
98
+ file : ./coverage.xml
99
+ fail_ci_if_error : true
100
+ token : ${{ secrets.CODECOV_TOKEN }}
101
+ if : matrix.python-version == '3.10'
0 commit comments