-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (81 loc) · 2.38 KB
/
unit_tests.yml
File metadata and controls
83 lines (81 loc) · 2.38 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Unit tests
on:
workflow_call:
inputs:
testing:
required: true
type: boolean
jobs:
src_unit_tests:
name: Test sources
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install wheel
run: pip install --upgrade wheel
- name: Install requirements
run: pip install -r ./requirements.txt -r ./requirements-dev.txt
- name: Run tests
run: coverage run -m pytest -x ./tests
- name: Generate report
if: inputs.testing
run: |
coverage xml
coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
if: inputs.testing
with:
env_vars: ${{ matrix.os }},${{ matrix.python-version }}
package_unit_tests:
name: Test package
needs: src_unit_tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install wheel
run: pip install --upgrade wheel
- name: Install requirements
run: pip install -r ./requirements-dev.txt
- name: Install build
run: pip install --upgrade build
- name: Build package
run: python -m build
- name: Install built package
run: pip install --force-reinstall ./dist/*.whl
- name: Remove source
run: |
rm -rf ./dist
rm -rf ./src
- name: Run tests for installed package
run: pytest -x ./tests