Repository navigation
198 lines (163 loc) · 5.63 KB
/
Copy pathtests.yml
File metadata and controls
198 lines (163 loc) · 5.63 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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# SPDX-FileCopyrightText: 2026 calendaring-sync contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Tests
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
workflow_call:
concurrency:
group: tests-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changelog:
name: Check for a news fragment
if: >-
github.event_name == 'pull_request' &&
!contains(github.event.pull_request.labels.*.name, 'skip-changelog')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.15"
pip-version: "26.2.2"
- name: Install towncrier
run: pip install towncrier==26.9.0
- name: Check for a news fragment
run: towncrier check --compare-with origin/${GITHUB_BASE_REF}
lint:
name: Lint with Ruff
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.15"
pip-version: "26.2.2"
- name: Install ruff
run: pip install ruff==0.17.2
- name: Lint code
run: ruff check .
- name: Check code format
run: ruff format --check .
vale:
name: Check docs prose with Vale
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.15"
pip-version: "26.2.2"
- name: Install docutils
run: pip install docutils==0.23
- name: Install Vale
run: |
curl -sL https://github.com/errata-ai/vale/releases/download/v3.25.1/vale_3.25.1_Linux_64-bit.tar.gz | tar -xz -C /usr/local/bin vale
- name: Sync Vale styles
run: vale sync
- name: Lint docs
run: vale --no-exit docs/
docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
# Read the Docs builds with 3.14, its newest Python.
python-version: "3.14"
pip-version: "26.2.2"
- name: Install dependencies
run: pip install -e ".[docs]"
- name: Build docs
run: sphinx-build -W -b html docs docs/_build/html
- name: Check links
run: sphinx-build -b linkcheck docs docs/_build/linkcheck
mypy:
name: Type check with mypy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.15"
pip-version: "26.2.2"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Type check
# Its settings are in pyproject.toml.
run: python -m mypy src/calendaring_sync docs/examples tests/docker
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # required for tokenless Codecov upload via OIDC
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
pip-version: "26.2.2"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run tests
run: |
pytest --cov --cov-branch --cov-report=xml \
--junitxml=junit.xml -o junit_family=legacy \
src/calendaring_sync/tests --ignore-glob="*_integration.py"
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
use_oidc: true
files: ./coverage.xml
flags: python-${{ matrix.python-version }}
skip_validation: true
fail_ci_if_error: false
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
use_oidc: true
files: ./junit.xml
flags: python-${{ matrix.python-version }}
report_type: test_results
skip_validation: true
fail_ci_if_error: false