Skip to content

[v0.10.0a1] Rust x2 speed up #37

[v0.10.0a1] Rust x2 speed up

[v0.10.0a1] Rust x2 speed up #37

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [ published ]
jobs:
build:
name: 📦 Build wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
arch: x86_64
libc: manylinux
- os: ubuntu-latest
arch: x86_64
libc: musllinux
- os: ubuntu-24.04-arm
arch: aarch64
libc: manylinux
- os: ubuntu-24.04-arm
arch: aarch64
libc: musllinux
- os: windows-latest
arch: AMD64
- os: macos-14
arch: arm64
steps:
- uses: actions/checkout@v5
# Set up the environment for the extension build on macOS and Windows
# This OS doesn't compile the extension for `{many,musl}linux` distributions in containers
- name: Set up 'BUILD_RUST_IMPL' environment variable
if: runner.os == 'Windows' || runner.os == 'macOS'
shell: bash
run: echo "BUILD_RUST_IMPL=1" >> $GITHUB_ENV
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14"
version: "latest"
activate-environment: "true"
- name: Rust cache
uses: Swatinem/rust-cache@v2
- name: Prepare the project
shell: bash
run: uv sync --all-extras --verbose
- name: Build and fix wheels (Windows)
if: runner.os == 'Windows' && matrix.arch == 'AMD64'
shell: bash
env:
CIBW_BUILD: "cp314-win_amd64"
run: |
uv run cibuildwheel --config-file pyproject.toml --output-dir wheelhouse --platform windows
for wheel in wheelhouse/*.whl; do
uv run wheel tags --python-tag py3 --abi-tag none --remove $wheel
done
for wheel in wheelhouse/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- ftl --version
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl --version
done
- name: Build, fix and test wheels (macOS arm64)
if: runner.os == 'macOS' && matrix.arch == 'arm64'
shell: bash
env:
CIBW_BUILD: "cp314-macosx_arm64"
run: |
uv run cibuildwheel --config-file pyproject.toml --output-dir wheelhouse --platform macos
for wheel in wheelhouse/*.whl; do
uv run wheel tags --python-tag py3 --abi-tag none --remove $wheel
done
for wheel in wheelhouse/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- ftl --version
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl --version
done
- name: Build, fix and test wheels (Linux manylinux)
if: runner.os == 'Linux' && matrix.libc == 'manylinux'
shell: bash
run: |
export CIBW_MANYLINUX_$(echo ${{ matrix.arch }} | tr '[:lower:]' '[:upper:]')_IMAGE="quay.io/pypa/manylinux_2_28_${{ matrix.arch }}"
export CIBW_BUILD="cp314-manylinux_${{ matrix.arch }}"
uv run cibuildwheel --config-file pyproject.toml --archs ${{ matrix.arch }} --output-dir wheelhouse --platform linux
for wheel in wheelhouse/*.whl; do
uv run wheel tags --python-tag py3 --abi-tag none --remove $wheel
done
for wheel in wheelhouse/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl --version
done
- name: Build, fix and test wheels (Linux musllinux)
if: runner.os == 'Linux' && matrix.libc == 'musllinux'
shell: bash
run: |
export CIBW_MUSLLINUX_$(echo ${{ matrix.arch }} | tr '[:lower:]' '[:upper:]')_IMAGE="quay.io/pypa/musllinux_1_2_${{ matrix.arch }}"
export CIBW_BUILD="cp314-musllinux_${{ matrix.arch }}"
uv run cibuildwheel --config-file pyproject.toml --archs ${{ matrix.arch }} --output-dir wheelhouse --platform linux
for wheel in wheelhouse/*.whl; do
uv run wheel tags --python-tag py3 --abi-tag none --remove $wheel
done
for wheel in wheelhouse/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl --version
done
- name: Build sdist
if: runner.os == 'Linux' && matrix.arch == 'x86_64' && matrix.libc == 'manylinux'
shell: bash
run: uv build --sdist --out-dir wheelhouse
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: ftl_extract-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.libc }}-${{ github.run_id }}
if-no-files-found: error
path: wheelhouse/*
publish:
name: 🐍 Publish distribution 📦
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: List artifacts
run: ls -lah dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1