-
Notifications
You must be signed in to change notification settings - Fork 4
166 lines (139 loc) · 4.8 KB
/
ci.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: CI
on:
push:
branches:
- main
pull_request:
paths-ignore:
- README.md
concurrency:
# auto-cancel any in-progress job *on the same branch*
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 3.14-dev
include:
- os: macos-latest
python-version: '3.10'
- os: macos-latest
python-version: '3.13'
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.13'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- name: Build (without coverage)
if: matrix.os != 'ubuntu-latest'
run: uv sync --python-preference=only-system --group test --no-editable
- name: Build (with coverage)
if: matrix.os == 'ubuntu-latest'
run: uv sync --python-preference=only-system --group test --group covcheck --no-editable
- run: uv pip list
- name: Run tests (without coverage)
if: matrix.os != 'ubuntu-latest'
run: |
uv run --no-project pytest --color=yes --doctest-modules
- name: Run tests (with coverage)
if: matrix.os == 'ubuntu-latest'
run: |
uv run --no-project coverage run --parallel-mode \
-m pytest --color=yes --doctest-modules
- name: Upload coverage data
# only using reports from ubuntu because
# combining reports from multiple platforms is tricky (or impossible ?)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
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.13'
- 3.14-dev
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- name: Build
run: uv sync --python-preference=only-system --group test --group concurrency --no-editable
- run: uv pip list
- run: uv run --no-project pytest --color=yes --count 100 tests/test_concurrent.py
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@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- run: uv sync --only-group covcheck
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: inifix_coverage_data-*
merge-multiple: true
- name: Check coverage
run: |
uv run --no-project coverage combine
uv run --no-project coverage html --skip-covered --skip-empty
uv run --no-project coverage report --fail-under=100
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: inifix_coverage_report
path: htmlcov
if: ${{ failure() }}
type-check:
strategy:
matrix:
python-version:
- '3.10'
- '3.13'
runs-on: ubuntu-latest
name: type check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}-typecheck
cancel-in-progress: true
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- name: Build
run: uv sync -p ${{ matrix.python-version }} --group typecheck --no-editable
- name: Run mypy
run: uv run mypy src/inifix
check-readme:
runs-on: ubuntu-latest
name: check README.md
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- run: uv run scripts/check_readme.py