Skip to content

Commit 6bd8eb3

Browse files
authored
ci: workflow improvements and repo hygiene (#18)
1 parent 8633de5 commit 6bd8eb3

8 files changed

Lines changed: 78 additions & 123 deletions

File tree

.github/workflows/docs.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
name: ci
1+
name: Docs
2+
23
on:
34
push:
45
branches:
5-
- master
66
- main
7+
paths:
8+
- "docs/**"
9+
- "mkdocs.yml"
10+
- "polars_iptools/**"
11+
- ".github/workflows/docs.yml"
12+
713
permissions:
814
contents: write
15+
916
jobs:
1017
deploy:
1118
runs-on: ubuntu-latest
1219
steps:
13-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v6
1421
- name: Configure Git Credentials
1522
run: |
1623
git config user.name github-actions[bot]
@@ -20,7 +27,7 @@ jobs:
2027
with:
2128
python-version: "3.12"
2229
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
23-
- uses: actions/cache@v4
30+
- uses: actions/cache@v6
2431
with:
2532
key: mkdocs-material-${{ env.cache_id }}
2633
path: .cache

.github/workflows/publish_to_pypi.yml

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1-
name: CI
1+
name: Build & Release
22

33
on:
44
push:
55
branches:
66
- main
77
tags:
88
- "*" # Trigger on tag push for release
9+
paths:
10+
- "src/**"
11+
- "Cargo.toml"
12+
- "Cargo.lock"
13+
- "pyproject.toml"
14+
- "polars_iptools/**"
15+
- "tests/**"
16+
- ".github/workflows/publish_to_pypi.yml"
917
pull_request:
18+
paths:
19+
- "src/**"
20+
- "Cargo.toml"
21+
- "Cargo.lock"
22+
- "pyproject.toml"
23+
- "polars_iptools/**"
24+
- "tests/**"
25+
- ".github/workflows/publish_to_pypi.yml"
1026
workflow_dispatch: # Trigger for manual release run
1127

1228
concurrency:
@@ -16,9 +32,10 @@ concurrency:
1632
permissions:
1733
contents: read # Default read-only permissions
1834

19-
# Treat all Rust warnings as errors; skip debug symbols to reduce compile time/memory
2035
env:
2136
RUSTFLAGS: "-Dwarnings -C debuginfo=0"
37+
CARGO_INCREMENTAL: 0
38+
PYTHONUTF8: 1
2239

2340
jobs:
2441
# ------------------------------------------------------------------
@@ -38,7 +55,7 @@ jobs:
3855
runs-on: ubuntu-latest
3956

4057
steps:
41-
- uses: actions/checkout@v4
58+
- uses: actions/checkout@v6
4259

4360
- name: Set up Rust stable toolchain
4461
uses: dtolnay/rust-toolchain@stable
@@ -79,7 +96,7 @@ jobs:
7996
os: [ubuntu, macos, windows]
8097

8198
steps:
82-
- uses: actions/checkout@v4
99+
- uses: actions/checkout@v6
83100

84101
- name: install rust stable
85102
uses: dtolnay/rust-toolchain@stable
@@ -110,7 +127,7 @@ jobs:
110127
# Build Wheels
111128
# ------------------------------------------------------------------
112129
build-linux:
113-
name: Build Wheels (${{ matrix.platform.runner }}, ${{ matrix.platform.target }})
130+
name: Build Wheels (linux, ${{ matrix.platform.target }})
114131
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
115132
needs: [test-python, test-os]
116133
runs-on: ${{ matrix.platform.runner }}
@@ -127,9 +144,9 @@ jobs:
127144
target: armv7
128145

129146
steps:
130-
- uses: actions/checkout@v4
147+
- uses: actions/checkout@v6
131148

132-
- uses: actions/setup-python@v5
149+
- uses: actions/setup-python@v6
133150
with:
134151
python-version: 3.x
135152

@@ -141,14 +158,20 @@ jobs:
141158
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
142159
manylinux: auto
143160

161+
- name: Smoke test wheel
162+
if: matrix.platform.target == 'x86_64'
163+
run: |
164+
pip install --force-reinstall --verbose dist/*.whl
165+
python -c 'import polars_iptools'
166+
144167
- name: Upload wheels
145168
uses: actions/upload-artifact@v4
146169
with:
147170
name: wheels-linux-${{ matrix.platform.target }}
148171
path: dist
149172

150173
build-musllinux:
151-
name: Build Wheels (${{ matrix.platform.runner }}, ${{ matrix.platform.target }})
174+
name: Build Wheels (musllinux, ${{ matrix.platform.target }})
152175
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
153176
needs: [test-python, test-os]
154177
runs-on: ${{ matrix.platform.runner }}
@@ -165,9 +188,9 @@ jobs:
165188
target: armv7
166189

167190
steps:
168-
- uses: actions/checkout@v4
191+
- uses: actions/checkout@v6
169192

170-
- uses: actions/setup-python@v5
193+
- uses: actions/setup-python@v6
171194
with:
172195
python-version: 3.x
173196

@@ -186,7 +209,7 @@ jobs:
186209
path: dist
187210

188211
build-windows:
189-
name: Build Wheels (${{ matrix.platform.runner }}, ${{ matrix.platform.target }})
212+
name: Build Wheels (windows, ${{ matrix.platform.target }})
190213
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
191214
needs: [test-python, test-os]
192215
runs-on: ${{ matrix.platform.runner }}
@@ -201,9 +224,9 @@ jobs:
201224
target: x86
202225

203226
steps:
204-
- uses: actions/checkout@v4
227+
- uses: actions/checkout@v6
205228

206-
- uses: actions/setup-python@v5
229+
- uses: actions/setup-python@v6
207230
with:
208231
python-version: 3.x
209232
architecture: ${{ matrix.platform.target }}
@@ -215,14 +238,20 @@ jobs:
215238
args: --release --out dist
216239
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
217240

241+
- name: Smoke test wheel
242+
if: matrix.platform.target == 'x64'
243+
run: |
244+
pip install --force-reinstall --verbose dist/*.whl
245+
python -c 'import polars_iptools'
246+
218247
- name: Upload wheels
219248
uses: actions/upload-artifact@v4
220249
with:
221250
name: wheels-windows-${{ matrix.platform.target }}
222251
path: dist
223252

224253
build-macos:
225-
name: Build Wheels (${{ matrix.platform.runner }}, ${{ matrix.platform.target }})
254+
name: Build Wheels (macos, ${{ matrix.platform.target }})
226255
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
227256
needs: [test-python, test-os]
228257
runs-on: ${{ matrix.platform.runner }}
@@ -231,15 +260,15 @@ jobs:
231260
fail-fast: false
232261
matrix:
233262
platform:
234-
- runner: macos-14
263+
- runner: macos-15-intel
235264
target: x86_64
236265
- runner: macos-15
237266
target: aarch64
238267

239268
steps:
240-
- uses: actions/checkout@v4
269+
- uses: actions/checkout@v6
241270

242-
- uses: actions/setup-python@v5
271+
- uses: actions/setup-python@v6
243272
with:
244273
python-version: 3.x
245274

@@ -250,6 +279,11 @@ jobs:
250279
args: --release --out dist
251280
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
252281

282+
- name: Smoke test wheel
283+
run: |
284+
pip install --force-reinstall --verbose dist/*.whl
285+
python -c 'import polars_iptools'
286+
253287
- name: Upload wheels
254288
uses: actions/upload-artifact@v4
255289
with:
@@ -264,7 +298,7 @@ jobs:
264298
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
265299
runs-on: ubuntu-latest
266300
steps:
267-
- uses: actions/checkout@v4
301+
- uses: actions/checkout@v6
268302
- name: Build sdist
269303
uses: PyO3/maturin-action@v1
270304
with:
@@ -296,15 +330,15 @@ jobs:
296330
attestations: write
297331
steps:
298332
- uses: actions/download-artifact@v4
333+
with:
334+
path: dist
335+
merge-multiple: true
299336
- name: Generate artifact attestation
300337
uses: actions/attest-build-provenance@v2
301338
with:
302-
subject-path: "wheels-*/*"
339+
subject-path: "dist/*"
303340
- name: Publish to PyPI
304341
if: ${{ startsWith(github.ref, 'refs/tags/') }}
305-
uses: PyO3/maturin-action@v1
306-
env:
307-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
342+
uses: pypa/gh-action-pypi-publish@release/v1
308343
with:
309-
command: upload
310-
args: --non-interactive --skip-existing wheels-*/*
344+
skip-existing: true

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.7.2
4+
rev: v0.15.1
55
hooks:
66
# Run the linter.
77
- id: ruff

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polars-iptools"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55
license = "MIT"
66
repository = "https://github.com/erichutchins/polars_iptools"

Makefile

Lines changed: 0 additions & 37 deletions
This file was deleted.

justfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ install: setup require-maturin
3333
install-release: setup require-maturin
3434
unset CONDA_PREFIX && source .venv/bin/activate && maturin develop --uv --release
3535

36-
# Run pre-commit checks
37-
pre-commit: setup
38-
uv run pre-commit install
39-
uv run pre-commit run --all-files
40-
uv run mypy polars_iptools tests
36+
# Install prek git hooks
37+
hooks:
38+
prek install
39+
40+
# Run all pre-commit hooks
41+
lint:
42+
prek run --all-files
4143

4244
# Clean up build artifacts
4345
clean:
@@ -72,8 +74,3 @@ run-release: install-release
7274
# Test mkdocs locally
7375
docs-serve:
7476
uv run --group docs mkdocs serve
75-
76-
# Lint and format python code
77-
lint:
78-
uv run --no-sync ruff format src tests
79-
uv run --no-sync ruff check --fix src tests

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ dev = [
6262
"hatch>=1.14.0",
6363
"maturin>=1.0,<2.0",
6464
"mypy>=1.11.2",
65-
"pre-commit>=4.1.0",
6665
"pytest>=8.3.3",
6766
"ruff>=0.9.6",
6867
]

0 commit comments

Comments
 (0)