-
Notifications
You must be signed in to change notification settings - Fork 4
197 lines (175 loc) · 5.61 KB
/
Copy pathci.yml
File metadata and controls
197 lines (175 loc) · 5.61 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
name: CI
on:
push:
branches:
- main
pull_request:
paths-ignore:
- README.md
- CHANGELOG.md
workflow_dispatch:
jobs:
unit-tests:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- '3.11'
- '3.12'
- '3.13'
include:
- os: ubuntu-22.04
python-version: 3.10.0
label: oldestdeps
- os: macos-latest
python-version: 3.10.0
- os: macos-latest
python-version: '3.13'
- os: windows-latest
python-version: 3.10.0
- os: windows-latest
python-version: '3.13'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
prune-cache: false
cache-suffix: covcheck
- if: ${{ matrix.label == 'oldestdeps' }}
run: echo "UV_RESOLUTION=lowest-direct" >> $GITHUB_ENV
- name: Run tests (without coverage)
if: ${{ ! startswith( matrix.os, 'ubuntu' ) }}
shell: bash # for windows portability
run: |
uv run --frozen --no-editable --group test \
pytest --color=yes
- name: Run tests (with coverage)
if: ${{ startswith( matrix.os, 'ubuntu' ) }}
run: |
uv run --group covcheck \
coverage run --parallel-mode -m pytest --color=yes
- name: Upload coverage data
# only using reports from ubuntu because
# combining reports from multiple platforms is tricky (or impossible ?)
if: ${{ startswith( matrix.os, 'ubuntu' ) }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: inifix_coverage_data-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
if-no-files-found: ignore
include-hidden-files: true
concurrency-tests:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- 3.10.0
- '3.13'
- 3.13t
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
prune-cache: false
cache-suffix: concurrency
- run: uv sync --frozen --no-editable --group concurrency
- run: |
uv run --no-sync \
pytest --color=yes --count 100 -k concurrency
coverage:
name: Combine & check coverage
runs-on: ubuntu-latest
needs: unit-tests
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
with:
python-version: '3.13'
activate-environment: true
enable-cache: true
prune-cache: false
cache-suffix: covcheck
- run: uv sync --group covcheck
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: inifix_coverage_data-*
merge-multiple: true
- name: Check coverage
run: |
coverage combine
coverage html --skip-covered --skip-empty
coverage report --fail-under=100
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: inifix_coverage_report
path: htmlcov
if: ${{ failure() }}
type-check:
strategy:
matrix:
python-version:
- '3.10'
- '3.13'
typechecker:
- mypy
- pyright
- basedpyright
runs-on: ubuntu-latest
name: type check
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
enable-cache: true
prune-cache: false
cache-suffix: typecheck
- run: uv sync --frozen --group typecheck
- name: Typecheck source code (inifix-cli)
run: ${{ matrix.typechecker }} src
- name: Typecheck source code (inifix)
run: ${{ matrix.typechecker }} lib/inifix/src typechecks
- name: Verify Types (pyright only)
if: ${{ startsWith( matrix.typechecker , 'pyright' ) }}
run: ${{ matrix.typechecker }} --verifytypes inifix
optimized_python:
runs-on: ubuntu-latest
name: optimized Python
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
with:
python-version: '3.13'
enable-cache: true
prune-cache: false
cache-suffix: test
- run: uv sync --frozen --no-editable --group test
- name: Run pytest with PYTHONOPTIMIZE=2
run: uv run --no-sync pytest --color=yes
env:
PYTHONOPTIMIZE: 2
pre-publish-checks:
runs-on: ubuntu-latest
name: pre-publication checks
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
with:
enable-cache: true
prune-cache: false
cache-suffix: pre-publish-checks
- run: uv run scripts/pre_publish_checks.py