-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (45 loc) · 1.38 KB
/
unit_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: unit tests
on:
push:
branches:
- "**"
paths:
- 'undate/**'
- 'tests/**'
pull_request:
env:
# python version used to calculate and submit code coverage
COV_PYTHON_VERSION: "3.10"
jobs:
python-unit:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: '**/setup.cfg'
- name: Install package with dependencies
run: |
pip install -e ".[dev]"
python -m pip install tox tox-gh-actions
if: steps.python-cache.outputs.cache-hit != 'true'
# for all versions but the one we use for code coverage, run normally
- name: Run unit tests normally
run: tox
if: ${{ matrix.python != env.COV_PYTHON_VERSION }}
# run code coverage in one version only
- name: Run unit tests with code coverage reporting
run: tox -e coverage
if: ${{ matrix.python == env.COV_PYTHON_VERSION }}
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v3
if: ${{ matrix.python == env.COV_PYTHON_VERSION }}