Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ on:
pull_request:
branches: [main]

# Cancel in-progress runs for the same branch/PR
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
# ---------------------------------------------------------------------------
# Lint (Python + Rust)
# Lint (Python + Rust) — fast, no compilation
# ---------------------------------------------------------------------------
lint:
runs-on: ubuntu-latest
Expand All @@ -25,6 +30,11 @@ jobs:
with:
components: clippy, rustfmt

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: lint

- name: Rust fmt check
run: cargo fmt --check

Expand All @@ -38,15 +48,24 @@ jobs:
ruff format --check python/

# ---------------------------------------------------------------------------
# Test across Python versions
# Test — reduced matrix (ubuntu + latest Python is the core gate)
# ---------------------------------------------------------------------------
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
include:
# Core: Linux with min and max Python
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.13"
# Spot-check other OS with one Python version
- os: macos-14
python-version: "3.12"
- os: windows-latest
python-version: "3.12"
steps:
- uses: actions/checkout@v4

Expand All @@ -58,6 +77,11 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: test-${{ matrix.os }}

- name: Install package and test deps
run: |
python -m pip install --upgrade pip
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
paths:
- "pyproject.toml"

# Cancel in-progress runs for the same branch
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true

jobs:
# ---------------------------------------------------------------------------
# 1. Check if the version actually changed
Expand Down Expand Up @@ -51,28 +56,29 @@ jobs:
fi

# ---------------------------------------------------------------------------
# 2. Run tests before building wheels
# 2. Quick smoke test (single Python, Linux only — full matrix done in CI)
# ---------------------------------------------------------------------------
test:
needs: check-version
if: needs.check-version.outputs.version_changed == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: "3.12"

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: publish-test

- name: Install package and test deps
run: |
python -m pip install --upgrade pip
Expand All @@ -82,7 +88,7 @@ jobs:
run: python -m pytest -v --tb=short

# ---------------------------------------------------------------------------
# 3. Build native wheels for all platforms
# 3. Build native wheels for all platforms (parallel with sdist)
# ---------------------------------------------------------------------------
build-wheels:
needs: [check-version, test]
Expand Down Expand Up @@ -122,12 +128,16 @@ jobs:
target: ${{ matrix.target }}
args: --release --out dist --interpreter 3.10 3.11 3.12 3.13
manylinux: ${{ matrix.manylinux }}
rust-toolchain: stable
sccache: "true"
before-script-linux: |
# Ensure Perl is available for vendored OpenSSL build (openssl-src)
# Install OpenSSL dev headers (for native-tls) and Perl (for openssl-src fallback)
if command -v yum &> /dev/null; then
yum install -y perl-IPC-Cmd perl-core
yum install -y openssl-devel perl-IPC-Cmd perl-core
elif command -v apk &> /dev/null; then
apk add --no-cache perl make
apk add --no-cache openssl-dev perl make
elif command -v apt-get &> /dev/null; then
apt-get update && apt-get install -y libssl-dev pkg-config perl
fi

- name: Upload wheels
Expand All @@ -137,7 +147,7 @@ jobs:
path: dist/*.whl

# ---------------------------------------------------------------------------
# 4. Build sdist (source distribution)
# 4. Build sdist (source distribution) — runs parallel with wheels
# ---------------------------------------------------------------------------
build-sdist:
needs: [check-version, test]
Expand Down
Loading
Loading