Skip to content

🔧 Build uv-ffi Wheels #132

🔧 Build uv-ffi Wheels

🔧 Build uv-ffi Wheels #132

Workflow file for this run

name: "🔧 Build uv-ffi Wheels"
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build (e.g. v0.10.7)'
required: false
default: ''
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Check PyPI for existing wheel
id: pypi_check
shell: bash
run: |
VERSION="${{ github.event.inputs.tag }}"
VERSION="${VERSION#v}"
if [ -z "$VERSION" ]; then
VERSION=$(grep -m1 '^version' crates/uv-ffi/pyproject.toml | sed 's/version = "\(.*\)"/\1/')
fi
WHEEL="uv_ffi-${VERSION}-cp38-abi3-manylinux_2_28_${{ matrix.target }}.whl"
echo "Checking PyPI for $WHEEL..."
STATUS=$(curl -s "https://pypi.org/pypi/uv-ffi/$VERSION/json" | python3 -c "
import sys, json
data = json.load(sys.stdin)
files = [f['filename'] for f in data.get('urls', [])]
print('found' if '${WHEEL}' in files else 'missing')
" 2>/dev/null)
if [ "$STATUS" = "found" ]; then
echo "Wheel $WHEEL already on PyPI - skipping"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Build wheel
if: steps.pypi_check.outputs.skip == 'false'
uses: PyO3/maturin-action@v1
with:
working-directory: crates/uv-ffi
target: ${{ matrix.target }}
manylinux: "2_28"
args: --release --out ${{ github.workspace }}/wheels/
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
- uses: actions/upload-artifact@v4
if: steps.pypi_check.outputs.skip == 'false'
with:
name: wheels-linux-${{ matrix.target }}
path: wheels/
build-macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
wheel_suffix: macosx_11_0_arm64
- os: macos-14
wheel_suffix: macosx_11_0_arm64
- os: macos-15-intel
wheel_suffix: macosx_10_12_x86_64
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Check PyPI for existing wheel
id: pypi_check
shell: bash
run: |
VERSION="${{ github.event.inputs.tag }}"
VERSION="${VERSION#v}"
if [ -z "$VERSION" ]; then
VERSION=$(grep -m1 '^version' crates/uv-ffi/pyproject.toml | sed 's/version = "\(.*\)"/\1/')
fi
WHEEL="uv_ffi-${VERSION}-cp38-abi3-${{ matrix.wheel_suffix }}.whl"
echo "Checking PyPI for $WHEEL..."
STATUS=$(curl -s "https://pypi.org/pypi/uv-ffi/$VERSION/json" | python3 -c "
import sys, json
data = json.load(sys.stdin)
files = [f['filename'] for f in data.get('urls', [])]
print('found' if '${WHEEL}' in files else 'missing')
" 2>/dev/null)
if [ "$STATUS" = "found" ]; then
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Build wheel
if: steps.pypi_check.outputs.skip == 'false'
uses: PyO3/maturin-action@v1
with:
working-directory: crates/uv-ffi
args: --release --out ${{ github.workspace }}/wheels/
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
- uses: actions/upload-artifact@v4
if: steps.pypi_check.outputs.skip == 'false'
with:
name: wheels-${{ matrix.os }}
path: wheels/
build-windows:
runs-on: [self-hosted, windows, x64]
timeout-minutes: 30
strategy:
fail-fast: false
max-parallel: 1
steps:
- name: Checkout (attempt 1)
id: checkout1
continue-on-error: true
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Checkout (attempt 2)
id: checkout2
if: steps.checkout1.outcome == 'failure'
continue-on-error: true
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Checkout (attempt 3)
if: steps.checkout2.outcome == 'failure'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Add MSVC to PATH
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
set >> %GITHUB_ENV%
- name: Check PyPI for existing wheel
id: pypi_check
shell: powershell
run: |
$tag = "${{ github.event.inputs.tag }}"
$version = if ($tag) { $tag.TrimStart("v") } else {
(Select-String -Path "crates\uv-ffi\pyproject.toml" -Pattern '^version = "([^"]+)"' | Select-Object -First 1).Matches.Groups[1].Value
}
$wheel = "uv_ffi-${version}-cp38-abi3-win_amd64.whl"
Write-Host "Checking PyPI for $wheel..."
try { $response = Invoke-RestMethod "https://pypi.org/pypi/uv-ffi/$version/json" -ErrorAction Stop } catch { $response = $null }
$files = if ($response) { $response.urls.filename } else { @() }
if ($files -contains $wheel) {
"skip=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} else {
"skip=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
}
- name: Build wheel
if: steps.pypi_check.outputs.skip == 'false'
shell: powershell
run: |
$env:RUSTUP_HOME = "C:\rustup-home"
$env:CARGO_HOME = "C:\cargo-home"
$env:PATH = "C:\cargo-home\bin;C:\Python312;" + $env:PATH
C:\Python312\python.exe -m maturin build --release --out "${{ github.workspace }}\wheels" --manifest-path crates/uv-ffi/Cargo.toml --interpreter C:\Python312\python.exe
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
- uses: actions/upload-artifact@v4
if: steps.pypi_check.outputs.skip == 'false'
with:
name: wheels-windows-x64
path: wheels/
build-windows-arm64:
runs-on: windows-11-arm
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Check PyPI for existing wheel
id: pypi_check
shell: powershell
run: |
$tag = "${{ github.event.inputs.tag }}"
$version = if ($tag) { $tag.TrimStart("v") } else {
(Select-String -Path "crates\uv-ffi\pyproject.toml" -Pattern '^version = "([^"]+)"' | Select-Object -First 1).Matches.Groups[1].Value
}
$wheel = "uv_ffi-${version}-cp38-abi3-win_arm64.whl"
Write-Host "Checking PyPI for $wheel..."
try { $response = Invoke-RestMethod "https://pypi.org/pypi/uv-ffi/$version/json" -ErrorAction Stop } catch { $response = $null }
$files = if ($response) { $response.urls.filename } else { @() }
if ($files -contains $wheel) {
"skip=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} else {
"skip=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
}
- name: Build wheel
if: steps.pypi_check.outputs.skip == 'false'
shell: powershell
run: |
python -m pip install maturin
python -m maturin build --release --out "${{ github.workspace }}\wheels" --manifest-path crates/uv-ffi/Cargo.toml
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
- uses: actions/upload-artifact@v4
if: steps.pypi_check.outputs.skip == 'false'
with:
name: wheels-windows-arm64
path: wheels/