Repository navigation
274 lines (261 loc) · 9.12 KB
/
Copy pathci.yml
File metadata and controls
274 lines (261 loc) · 9.12 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: ci
on:
push:
branches: [main, 'run-ci/**', '**/run-ci/**']
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
UV_NO_INDEX: '1'
defaults:
run:
shell: bash
jobs:
# Keep newly announced advisories visible without blocking unrelated PRs.
# This job is deliberately omitted from tests-pass below, as in gitoxide.
cargo-deny-advisories:
name: Dependency advisories
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check RustSec advisories
uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
with:
command: check advisories
arguments: --workspace --all-features --locked
rust-version: stable
cargo-deny:
name: Dependency bans, licenses, and sources
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check dependency policy
uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
with:
command: check bans licenses sources
arguments: --workspace --all-features --locked
rust-version: stable
lint:
name: Rust formatting, clippy, and unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust
run: rustup toolchain install stable --profile minimal --component rustfmt,clippy
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check formatting
run: cargo +stable fmt --all -- --check
- name: Check release validation
run: python3 etc/test_check_release.py
- name: Check local build selection
run: python3 etc/test_build.py
- name: Check clippy
run: cargo +stable clippy --locked --all-targets -- -D warnings
- name: Run Rust unit tests
run: cargo +stable test --locked --lib
test:
name: Python ${{ matrix.python }} on ${{ matrix.os }} / ${{ matrix.features || 'default' }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
python: '3.11'
features: abi3
- os: macos-latest
python: '3.12'
features: abi3
- os: macos-latest
python: '3.13'
features: abi3
- os: macos-latest
python: '3.14'
features: abi3
- os: macos-15-intel
python: '3.14'
features: abi3
- os: windows-latest
python: '3.14'
features: abi3
- os: macos-latest
python: '3.14'
features: sha1,abi3
minimal: true
- os: macos-latest
python: '3.14'
features: sha256,abi3
minimal: true
- os: ubuntu-latest
python: '3.14t'
features: ''
gil: '0'
- os: macos-latest
python: '3.14t'
features: ''
gil: '0'
- os: windows-latest
python: '3.14t'
features: ''
gil: '0'
runs-on: ${{ matrix.os }}
env:
PYTHON_VERSION: ${{ matrix.python }}
BUILD_FEATURES: ${{ matrix.features }}
MINIMAL_BUILD: ${{ matrix.minimal && '1' || '0' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
version: '0.12.13'
enable-cache: false
- name: Install Python
run: uv python install "$PYTHON_VERSION"
- name: Install Rust
run: rustup toolchain install stable --profile minimal
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: python-${{ matrix.python }}
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build extension
run: |
args=()
if [[ "$MINIMAL_BUILD" == 1 ]]; then
args+=(--no-default-features)
fi
if [[ -n "$BUILD_FEATURES" ]]; then
args+=(--features "$BUILD_FEATURES")
fi
uv run --no-project --offline --python "$PYTHON_VERSION" python etc/build.py "${args[@]}"
- name: Check free-threaded runtime
if: endsWith(matrix.python, 't')
env:
PYTHON_GIL: '0'
run: uv run --no-project --offline --python "$PYTHON_VERSION" python -c 'import sys; assert not sys._is_gil_enabled()'
- name: Run Python integration tests
env:
PYTHONPATH: python
PYTHON_GIL: ${{ matrix.gil || '1' }}
run: uv run --no-project --offline --python "$PYTHON_VERSION" python -m unittest discover -s tests
features:
name: Rust ${{ matrix.rust }} / ${{ matrix.features }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- rust: '1.89'
features: max-pure
- rust: stable
features: sha1
- rust: stable
features: sha256
- rust: stable
features: sha1,sha256,revision,index
- rust: stable
features: sha1,sha256,http
env:
RUST_VERSION: ${{ matrix.rust }}
BUILD_FEATURES: ${{ matrix.features }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust
run: rustup toolchain install "$RUST_VERSION" --profile minimal
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: ${{ matrix.rust }}-${{ matrix.features }}
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check selected configuration
run: cargo "+$RUST_VERSION" check --locked --no-default-features --features "$BUILD_FEATURES"
no-c:
name: Build without a C or C++ compiler
runs-on: macos-latest
env:
CC: /usr/bin/false
CXX: /usr/bin/false
CARGO_TARGET_DIR: target/no-c
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust
run: rustup toolchain install stable --profile minimal
- name: Compile default dependencies from scratch
run: cargo +stable build --locked
packaging:
name: Rebuild and test the source distribution
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
version: '0.12.13'
enable-cache: false
- name: Install Python
run: uv python install 3.11
- name: Install Rust
run: rustup toolchain install stable --profile minimal
- name: Install maturin
uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
with:
tool: maturin@1.15.0
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: sdist
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build wheel from the source archive
run: maturin build --sdist --locked --compatibility pypi --out dist --interpreter "$(uv python find 3.11)"
- name: Verify archive and wheel contents
run: uv run --no-project --offline --python 3.11 python etc/check_artifact.py dist/*.tar.gz dist/*.whl
- name: Install rebuilt wheel without an index
run: |
uv venv --python 3.11 .artifact-venv
uv pip install --python .artifact-venv --no-index --no-deps dist/*.whl
- name: Test installed source build
run: uv run --no-project --offline --python .artifact-venv python -m unittest discover -s tests
tests-pass:
name: Tests pass
if: always()
needs: [cargo-deny, lint, test, features, no-c, packaging]
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Require every check to pass
env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
for result in $RESULTS; do
[[ "$result" == success ]] || exit 1
done