-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (120 loc) · 3.67 KB
/
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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Test
on:
pull_request:
paths:
- '.github/workflows/test.yml'
- 'pyproject.toml'
- '**.py'
types:
- "opened"
- "synchronize"
push:
branches:
- "master"
paths:
- '.github/workflows/test.yml'
- 'pyproject.toml'
- '**.py'
workflow_dispatch:
jobs:
test:
name: Test aio-ld2410 with pytest
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.9 was removed from this matrix due to an issue with the test framework.
# This is not worth investigating more since it will be unsupported "soon".
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install testing dependencies
run: make install-testing
- name: PyTest
run: pytest --cov=aio_ld2410 -v -s --junit-xml=pytest.xml --cov-report=term --cov-report=xml
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: Test results (Python ${{ matrix.python-version }})
path: pytest.xml
- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: Coverage results (Python ${{ matrix.python-version }})
path: coverage.xml
- name: Publish coverage results to Codecov
uses: codecov/codecov-action@v4
with:
name: Coverage with Python ${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: PYTHON
fail_ci_if_error: true
file: ./coverage.xml
disable_search: true
flags: unittests
verbose: true
publish-test-results:
name: Publish tests results
needs:
- test
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "artifacts/**/pytest.xml"
mypy:
name: Check typing with MyPy
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install linting dependencies
run: make install-package install-linting
- name: MyPy
run: mypy --junit-xml=mypy.xml
- name: Upload type checking results
uses: actions/upload-artifact@v4
with:
name: Type checking results (Python ${{ matrix.python-version }})
path: mypy.xml
ruff:
name: Check linting and formating with ruff
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install linting dependencies
run: make install-linting
- name: Run ruff with linting checks
run: ruff check --output-format=github
- name: Run ruff with format checks
run: ruff format --check --diff