Skip to content

Migrate to a full native extension wrapping protovalidate-cc #58

Migrate to a full native extension wrapping protovalidate-cc

Migrate to a full native extension wrapping protovalidate-cc #58

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
pull_request:
paths:
- .github/workflows/release.yaml
permissions:
id-token: write
attestations: write
contents: write
jobs:
ext-linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-24.04
target: x86_64
- runner: ubuntu-24.04-arm
target: aarch64
manylinux:
- auto
- musllinux_1_2
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3.x
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .sccache
key: sccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.manylinux }}-${{ github.sha }}
restore-keys: sccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.manylinux }}-
- name: Build wheels
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
env:
RUSTC_WRAPPER: sccache
SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: 100M
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.10 -i 3.14t
before-script-linux: uv tool install "sccache>=0.10.0"
manylinux: ${{ matrix.manylinux }}
# The container runs as root and leaves .sccache unreadable when saving
- name: Fix sccache dir permissions
if: always()
run: test ! -d .sccache || sudo chmod -R a+rX .sccache
- name: Upload wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-linux-${{ matrix.platform.target }}-${{ matrix.manylinux }}
path: dist
ext-windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-2025
target: x86_64
- runner: windows-11-arm
target: aarch64
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .sccache
key: sccache-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
restore-keys: sccache-${{ runner.os }}-${{ runner.arch }}-
- name: Build wheels
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
env:
RUSTC_WRAPPER: sccache
SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: 100M
with:
args: --release --out dist -i 3.10 -i 3.14t --features pyo3/generate-import-lib
- name: Upload wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist
ext-macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-15
target: aarch64
- runner: macos-15-intel
target: x86_64
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: |
3.10
3.14t
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .sccache
key: sccache-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
restore-keys: sccache-${{ runner.os }}-${{ runner.arch }}-
- name: Build wheels
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
env:
RUSTC_WRAPPER: sccache
SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: 100M
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.10 -i 3.14t
- name: Upload wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
ext-sdist:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build sdist
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-sdist
path: dist
release:
runs-on: ubuntu-24.04
environment: ${{ (github.event_name == 'workflow_dispatch' && 'pypi-test') || (github.event_name == 'push' && github.ref_type == 'tag' && 'pypi-release') || null }}
needs:
- ext-linux
- ext-windows
- ext-macos
- ext-sdist
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist/
merge-multiple: true
- name: publish all packages
if: github.event_name != 'pull_request'
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
repository-url: ${{ github.event_name == 'workflow_dispatch' && 'https://test.pypi.org/legacy/' || null }}
skip-existing: true