1
1
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
2
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
3
4
- name : Unit Tests
4
+ name : CI
5
5
6
6
on :
7
7
push :
11
11
12
12
jobs :
13
13
tests :
14
+ name : pytest on ${{ matrix.python-version }}
14
15
runs-on : ubuntu-latest
15
16
strategy :
16
17
matrix :
17
18
python-version : ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"]
18
19
19
20
steps :
20
- - uses : actions/checkout@v3
21
- - uses : actions/setup-python@v3
21
+ - name : Checkout Code
22
+ uses : actions/checkout@v3
23
+ - name : Setup Python
24
+ uses : actions/setup-python@v3
22
25
with :
23
26
python-version : ${{ matrix.python-version }}
24
-
25
27
- name : Upgrade pip
26
28
run : |
27
29
python -m pip install --upgrade pip
28
-
29
- - name : Install requirements (python 3)
30
+ - name : Install requirements (Python 3)
30
31
if : matrix.python-version != '2.7'
31
32
run : |
32
33
pip install -r requirements/ci.txt
33
- - name : Install requirements (python 2)
34
+ - name : Install requirements (Python 2)
34
35
if : matrix.python-version == '2.7'
35
36
run : |
36
- pip install pillow pytest pytest-cov
37
-
38
- - name : Install module
37
+ pip install pillow pytest coverage
38
+ - name : Install PyPDF2
39
39
run : |
40
40
pip install .
41
-
42
41
- name : Test with flake8
43
42
run : |
44
43
flake8 . --ignore=E203,W503,W504,E,F403,F405
45
44
if : matrix.python-version != '2.7'
46
-
47
45
- name : Test with pytest
48
46
run : |
49
- pytest Tests --cov --cov-report term-missing --cov-report xml -vv
50
-
51
- - name : Upload Coverage to Codecov
52
- uses : codecov/codecov-action@v2
47
+ python -m coverage run --parallel-mode -m pytest Tests -vv
48
+ - name : Upload coverage data
49
+ uses : actions/upload-artifact@v3
53
50
with :
54
- files : ./coverage.xml
51
+ name : coverage-data
52
+ path : .coverage.*
53
+ if-no-files-found : ignore
54
+
55
55
package :
56
56
name : Build & verify package
57
57
runs-on : ubuntu-latest
67
67
- run : ls -l dist
68
68
- run : check-wheel-contents dist/*.whl
69
69
- name : Check long_description
70
- run : python -m twine check dist/*
70
+ run : python -m twine check dist/*
71
+
72
+ coverage :
73
+ name : Combine & check coverage.
74
+ runs-on : ubuntu-latest
75
+ needs : tests
76
+
77
+ steps :
78
+ - uses : actions/checkout@v3
79
+ - uses : actions/setup-python@v3
80
+ with :
81
+ # Use latest Python, so it understands all syntax.
82
+ python-version : ${{env.PYTHON_LATEST}}
83
+
84
+ - run : python -m pip install --upgrade coverage[toml]
85
+
86
+ - uses : actions/download-artifact@v3
87
+ with :
88
+ name : coverage-data
89
+
90
+ - name : Combine coverage & create xml report
91
+ run : |
92
+ python -m coverage combine
93
+ python -m coverage xml
94
+ - name : Upload Coverage to Codecov
95
+ uses : codecov/codecov-action@v2
96
+ with :
97
+ token : ${{ secrets.CODECOV_TOKEN }}
98
+ files : ./coverage.xml
0 commit comments