zpack 0.1.17

A fast, configurable package manager which builds programs from source
Documentation
name: Python CI

on:
  push:
    branches:
      - edge
      - master
    tags:
      - '*'
  pull_request:
  release:
    types: [published]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  build_wheels:
    name: Build Wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest]

    env:
      CIBW_BEFORE_ALL_LINUX: |
        if command -v apk &> /dev/null; then
          apk add --no-cache build-base clang llvm-dev clang-dev curl bash
        elif command -v apt-get &> /dev/null; then
          apt-get update && apt-get install -y build-essential clang llvm-dev libclang-dev curl
        elif command -v yum &> /dev/null; then
          yum groupinstall -y 'Development Tools' && yum install -y clang llvm-devel clang-devel curl
        elif command -v dnf &> /dev/null; then
          dnf groupinstall -y 'Development Tools' && dnf install -y clang llvm-devel clang-devel curl
        else
          echo "Error: No supported package manager found" >&2
          exit 1
        fi

        curl -sSf https://sh.rustup.rs | sh -s -- -y

      CIBW_BEFORE_ALL_WINDOWS: "rustup target add i686-pc-windows-msvc"

      CIBW_ENVIRONMENT_LINUX: >-
        Z3_SYS_BUNDLED_DIR_OVERRIDE=/project/z3_git_source
        MATURIN_PEP517_ARGS='--features=default,pyo3/extension-module,z3_bundled'
        PATH=$HOME/.cargo/bin:$PATH

      CIBW_ENVIRONMENT_MACOS: >-
        Z3_SYS_BUNDLED_DIR_OVERRIDE=${{ github.workspace }}/z3_git_source
        MATURIN_PEP517_ARGS='--features=default,pyo3/extension-module,z3_bundled'
        MACOSX_DEPLOYMENT_TARGET=10.12

      CIBW_ENVIRONMENT_WINDOWS: >-
        Z3_SYS_BUNDLED_DIR_OVERRIDE='${{ github.workspace }}/z3_git_source'
        MATURIN_PEP517_ARGS='--features=default,pyo3/extension-module,z3_bundled'

    steps:
      - uses: actions/checkout@v5

      - name: Install Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.13'

      - name: Clone Z3
        uses: actions/checkout@v5
        with:
          repository: Z3Prover/z3
          path: z3_git_source
          ref: z3-4.15.3

      - name: Install cibuildwheel
        run: python -m pip install cibuildwheel==3.2.0

      - name: Build wheels
        run: python -m cibuildwheel --output-dir wheelhouse

      - uses: actions/upload-artifact@v4
        with:
          name: wheels-${{ matrix.os }}-${{ strategy.job-index }}
          path: ./wheelhouse/*.whl

  sdist:
    runs-on: ubuntu-latest
    env:
      CFLAGS_s390x_unknown_linux_gnu: '-march=z10'
    steps:
      - uses: actions/checkout@v4
      - name: Build sdist
        uses: PyO3/maturin-action@v1
        with:
          command: sdist
          args: --out dist
      - name: Upload sdist
        uses: actions/upload-artifact@v4
        with:
          name: wheels-sdist
          path: dist

  release:
    name: Release
    runs-on: ubuntu-latest
    env:
      CFLAGS_s390x_unknown_linux_gnu: '-march=z10'
    if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
    needs: [build_wheels, sdist]
    permissions:
      id-token: write
      contents: write
      attestations: write
    steps:
      - uses: actions/download-artifact@v4
      - name: Generate artifact attestation
        uses: actions/attest-build-provenance@v2
        with:
          subject-path: 'wheels-*/*'
      - name: Publish to PyPI
        if: ${{ startsWith(github.ref, 'refs/tags/') }}
        uses: PyO3/maturin-action@v1
        env:
          MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
        with:
          command: upload
          args: --non-interactive --skip-existing wheels-*/*