6
6
branch : dev
7
7
8
8
jobs :
9
- build :
9
+ verify :
10
10
runs-on : ubuntu-latest
11
11
strategy :
12
12
matrix :
13
13
python : [3.8]
14
- name : Build project with Python ${{ matrix.python }}
14
+ name : Verify project with Python ${{ matrix.python }}
15
15
steps :
16
16
- name : Source checkout
17
17
uses : actions/checkout@v2
41
41
run : |
42
42
pip install --upgrade pip poetry
43
43
poetry config virtualenvs.create false --local
44
- poetry install -vv -E "checkers" -E "tests"
44
+ poetry install -vv -E "checkers"
45
45
46
46
- name : Lint yaml files
47
47
run : yamllint --config-file .yamllint --format colored --strict .
@@ -64,17 +64,73 @@ jobs:
64
64
- name : Check static typing with mypy
65
65
run : mypy --follow-imports silent --ignore-missing-imports src/ tests/ docs/
66
66
67
- - name : Perform unit tests with coverage report
68
- run : pytest -vs --cov --cov-config=.coveragerc --cov-report=xml:coverage_report/coverage.xml
67
+ test :
68
+ runs-on : ubuntu-latest
69
+ strategy :
70
+ matrix :
71
+ python : [3.6, 3.7, 3.8]
72
+ name : Test project with Python ${{ matrix.python }}
73
+ steps :
74
+ - name : Source checkout
75
+ uses : actions/checkout@v2
69
76
70
- - name : Push coverage report to CodeCov
71
- uses : codecov/codecov-action @v1
77
+ - name : Cache pip repository
78
+ uses : actions/cache @v1
72
79
with :
73
- file : ./coverage_report/coverage.xml
74
- fail_ci_if_error : true
80
+ path : ~/.cache/pypoetry
81
+ key : ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python }}
82
+ restore-keys : |
83
+ ${{ runner.os }}-${{ matrix.python }}-pip-
84
+
85
+ - name : Cache poetry repository
86
+ uses : actions/cache@v1
87
+ with :
88
+ path : ~/.cache/pypoetry
89
+ key : ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python }}
90
+ restore-keys : |
91
+ ${{ runner.os }}-${{ matrix.python }}-poetry-
92
+
93
+ - name : Set up Python ${{ matrix.python }}
94
+ uses : actions/setup-python@v1
95
+ with :
96
+ python-version : ${{ matrix.python }}
97
+
98
+ - name : Install dependencies
99
+ run : |
100
+ pip install --upgrade pip poetry
101
+ poetry config virtualenvs.create false --local
102
+ poetry install -vv -E "tests"
103
+
104
+ - name : Perform unit tests
105
+ if : matrix.python != 3.8
106
+ run : pytest -vs
107
+
108
+ - name : Perform unit tests with coverage report
109
+ if : matrix.python == 3.8
110
+ run : pytest -vs --cov --cov-config=.coveragerc --cov-report=xml:coverage.xml
75
111
76
112
- name : Upload coverage report as artifact
113
+ if : matrix.python == 3.8
77
114
uses : actions/upload-artifact@v1
78
115
with :
79
116
name : coverage-report
80
- path : ./coverage_report/coverage.xml
117
+ path : ./coverage.xml
118
+
119
+ coverage :
120
+ runs-on : ubuntu-latest
121
+ name : Push coverage report to CodeCov
122
+ needs : [verify, test]
123
+ steps :
124
+ - name : Source checkout
125
+ uses : actions/checkout@v2
126
+
127
+ - name : Download coverage report from artifacts
128
+ uses : actions/download-artifact@v1
129
+ with :
130
+ name : coverage-report
131
+
132
+ - name : Push to CodeCov
133
+ uses : codecov/codecov-action@v1
134
+ with :
135
+ file : coverage-report/coverage.xml
136
+ fail_ci_if_error : true
0 commit comments