11# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33
4- name : Unit Tests
4+ name : CI
55
66on :
77 push :
1111
1212jobs :
1313 tests :
14+ name : pytest on ${{ matrix.python-version }}
1415 runs-on : ubuntu-latest
1516 strategy :
1617 matrix :
1718 python-version : ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"]
1819
1920 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
2225 with :
2326 python-version : ${{ matrix.python-version }}
24-
2527 - name : Upgrade pip
2628 run : |
2729 python -m pip install --upgrade pip
28-
29- - name : Install requirements (python 3)
30+ - name : Install requirements (Python 3)
3031 if : matrix.python-version != '2.7'
3132 run : |
3233 pip install -r requirements/ci.txt
33- - name : Install requirements (python 2)
34+ - name : Install requirements (Python 2)
3435 if : matrix.python-version == '2.7'
3536 run : |
36- pip install pillow pytest pytest-cov
37-
38- - name : Install module
37+ pip install pillow pytest coverage
38+ - name : Install PyPDF2
3939 run : |
4040 pip install .
41-
4241 - name : Test with flake8
4342 run : |
4443 flake8 . --ignore=E203,W503,W504,E,F403,F405
4544 if : matrix.python-version != '2.7'
46-
4745 - name : Test with pytest
4846 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
5350 with :
54- files : ./coverage.xml
51+ name : coverage-data
52+ path : .coverage.*
53+ if-no-files-found : ignore
54+
5555 package :
5656 name : Build & verify package
5757 runs-on : ubuntu-latest
6767 - run : ls -l dist
6868 - run : check-wheel-contents dist/*.whl
6969 - 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