-
Notifications
You must be signed in to change notification settings - Fork 140
212 lines (181 loc) · 5 KB
/
ci.yml
File metadata and controls
212 lines (181 loc) · 5 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
# Changes to the package itself
- src/msgspec/**
- pyproject.toml
- setup.py
- MANIFEST.in
# Changes to CI execution
- .github/workflows/ci.yml
- .github/workflows/prepare-build.yml
- .github/workflows/build-wheels.yml
- .github/workflows/profile.yml
- .github/actions/latest-supported-python/action.yml
- .github/actions/fetch-release-history/action.yml
- .github/actions/load-env/action.yml
- .cibuildwheel.toml
- .justfile
# Changes to testing
- tests/**
- .codecov.yml
- .codespellrc
- .coveragerc
- .pre-commit-config.yaml
- .pytest.toml
- .ruff.toml
release:
types:
- published
jobs:
prepare:
name: Validate build
uses: ./.github/workflows/prepare-build.yml
with:
run-static-analysis: true
fetch-latest-python: true
test:
name: Test Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
needs:
- prepare
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - windows-latest
# - macos-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
# TODO: Enable this once fixed https://github.com/jcrist/msgspec/issues/910
# - "3.13"
- "3.14"
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Load environment file
uses: ./.github/actions/load-env
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: "${{ matrix.python-version }}"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install command runner
run: uv tool install rust-just
- name: Install testing dependencies
env:
MSGSPEC_SANITIZE: "true"
MSGSPEC_COVERAGE: "true"
run: just env-sync test
- name: Run tests with sanitizers
env:
PYTHONMALLOC: "malloc"
ASAN_OPTIONS: "detect_leaks=0"
run: >-
LD_PRELOAD=`gcc -print-file-name=libasan.so`
just env-run test coverage run -m pytest tests/unit -s
- name: Generate coverage files
run: |-
just env-run test coverage xml
gcov -abcu `find build/temp*/ -name *.o`
- name: Upload coverage artifacts
uses: actions/upload-artifact@v5
with:
name: coverage-${{ matrix.python-version }}-${{ matrix.os }}
path: |-
coverage.xml
_core.c.gcov
atof.h.gcov
ryu.h.gcov
if-no-files-found: error
upload-coverage:
name: Upload coverage files to Codecov
needs:
- test
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Download coverage artifacts
uses: actions/download-artifact@v5
with:
pattern: coverage-*
path: coverage-files
- name: See the coverage files
run: tree -sh coverage-files
- name: Upload Codecov
uses: codecov/codecov-action@v5
with:
use_oidc: true
directory: coverage-files
test-integration:
name: Run integration tests
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Load environment file
uses: ./.github/actions/load-env
- name: Install Python
uses: actions/setup-python@v6
with:
python-version-file: pyproject.toml
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install command runner
run: uv tool install rust-just
- name: Install testing dependencies
run: just env-sync test
- name: Run doctests
run: just test-doc
- name: Run type checker compatibility tests
run: just test-typing
build-wheels:
name: Build wheels ${{ github.event_name == 'release' && 'for release' || '' }}
needs:
- test
- prepare
uses: ./.github/workflows/build-wheels.yml
with:
sdist-name: "${{ needs.prepare.outputs.sdist-name }}"
build-all: ${{ github.event_name == 'release' }}
profile:
name: Run profiling tests on Python ${{ needs.prepare.outputs.latest-supported-python }}
needs:
- prepare
- build-wheels
uses: ./.github/workflows/profile.yml
with:
python: "${{ needs.prepare.outputs.latest-supported-python }}"
upload-pypi:
name: Upload artifacts to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs:
- prepare
- build-wheels
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v6
with:
pattern: artifact-*
merge-multiple: true
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1