Skip to content

build

build #23

Workflow file for this run

name: build
on: workflow_dispatch
env:
MATURIN_VERSION: 1.3.0
PY_ALL: 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 pypy3.10
jobs:
wheels:
name: wheel ${{ matrix.platform || matrix.os }}(${{ matrix.target }}) - ${{ matrix.manylinux || 'auto' }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
target: [x86_64, aarch64]
manylinux: [auto]
include:
- os: ubuntu
platform: linux
- os: ubuntu
platform: linux
target: x86_64
manylinux: auto
interpreter: pypy3.8 pypy3.9 pypy3.10
- os: macos
target: x86_64
interpreter: pypy3.8 pypy3.9 pypy3.10
- os: macos
target: aarch64
interpreter: 3.8 3.9 pypy3.8 pypy3.9 pypy3.10
- os: ubuntu
platform: linux
target: aarch64
container: messense/manylinux_2_24-cross:aarch64
- os: ubuntu
platform: linux
target: x86_64
manylinux: musllinux_1_1
- os: ubuntu
platform: linux
target: aarch64
manylinux: musllinux_1_1
- os: windows
target: x86_64
interpreter: pypy3.8 pypy3.9 pypy3.10
exclude:
- os: windows
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: pyo3/maturin-action@v1
with:
maturin-version: v${{ env.MATURIN_VERSION }}
rust-toolchain: stable
command: build
args: --release --out dist --interpreter ${{ matrix.interpreter || env.PY_ALL }}
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
container: ${{ matrix.container }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
wheels-pgo:
name: pgo-wheel ${{ matrix.os }} (${{ matrix.interpreter}})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-latest-xlarge, windows-latest]
manylinux: [auto]
interpreter: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- os: ubuntu-latest
platform: linux
exclude:
- os: macos-latest-xlarge
interpreter: '3.8'
- os: macos-latest-xlarge
interpreter: '3.9'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.interpreter }}
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- run: |
RUST_HOST=$(rustc -Vv | grep host | cut -d ' ' -f 2) rustup run stable bash -c 'echo LLVM_PROFDATA=$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/$RUST_HOST/bin/llvm-profdata >> "$GITHUB_ENV"'
shell: bash
- name: Build initial wheel
uses: PyO3/maturin-action@v1
with:
maturin-version: v${{ env.MATURIN_VERSION }}
rust-toolchain: stable
command: build
args: --release --out pgo_wheel --interpreter ${{ matrix.interpreter }}
manylinux: ${{ matrix.manylinux || 'auto' }}
env:
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata"
- name: Install project
uses: PyO3/maturin-action@v1
with:
maturin-version: v${{ env.MATURIN_VERSION }}
rust-toolchain: stable
command: develop
args: --extras test
- name: Generate PGO data
run: |
pip install granian --no-index --no-deps --find-links pgo_wheel --force-reinstall
PGO_RUN=y pytest tests
- name: merge PGO data
run: ${{ env.LLVM_PROFDATA }} merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata
- name: Build PGO wheel
uses: PyO3/maturin-action@v1
with:
maturin-version: v${{ env.MATURIN_VERSION }}
command: build
args: --release --out dist --interpreter ${{ matrix.interpreter }}
manylinux: ${{ matrix.manylinux || 'auto' }}
rust-toolchain: stable
env:
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata"
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: dist
path: dist