Skip to content

Event rate

Event rate #220

Workflow file for this run

name: Build
on:
push:
pull_request:
release:
types:
- published
env:
CIBW_SKIP: cp36-* cp37-* cp38-* pp* *i686 *win32
# cibuildhweel macOS configuration
CIBW_ARCHS_MACOS: native
# cibuildhweel linux configuration
CIBW_ARCHS_LINUX: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
# On Linux, wheels are built inside a container on the GitHub runner (unlike macOS and Windows which use the GitHub runner directly)
# Any build dependencies must thus be installed on the container (using CIBW_BEFORE_ALL_LINUX), *not* on the runner with the regular workflow
# This command must be compatible with manylinux_2_28 (AlmaLinux 8) and musllinux_1_2 (Alpine Linux 3.20)
CIBW_BEFORE_ALL_LINUX: dnf install -y clang nasm; apk add clang-dev nasm; curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=stable --profile=minimal -y
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH"'
# cibuildhweel Windows configuration
CIBW_ARCHS_WINDOWS: AMD64
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an Intel runner, macos-latest is an ARM runner
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: python -m pip install cibuildwheel==2.21.3
- run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1-2)" >> $GITHUB_ENV
if: startsWith(matrix.os, 'macos')
- run: |
brew install nasm
python -m cibuildwheel
if: startsWith(matrix.os, 'macos-13')
- run: python -m cibuildwheel
if: startsWith(matrix.os, 'macos-latest')
- run: python -m cibuildwheel
if: startsWith(matrix.os, 'ubuntu-latest')
- run: |
choco install nasm
set "PATH=C:\Program Files\NASM;%PATH%"
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
python -m cibuildwheel
shell: cmd
if: startsWith(matrix.os, 'windows')
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: wheelhouse
test_library:
name: Test library on ${{ matrix.os }} with Python ${{ matrix.python }} and numpy ${{ matrix.numpy }}
runs-on: ${{ matrix.os }}
needs: [build_wheels]
strategy:
matrix:
numpy: ["==1.26.4", ">=2"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
# macos-13 is an Intel runner, macos-latest is an ARM runner
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
exclude:
# this configuration yields 'Windows fatal exception: access violation'
# this may get fixed in a maintenance upgrade of 1.26.x (x > 4)
- numpy: ==1.26.4
os: windows-latest
python: 3.13
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}
path: wheelhouse
- run: python -m pip install toml
- run: python -m pip install 'numpy${{ matrix.numpy }}'
- run: python .github/workflows/install_dependencies.py
- run: ls wheelhouse
- run: python -m pip install --no-index --find-links wheelhouse faery
- run: python -m pytest tests/
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*.tar.gz
upload_pypi:
name: Upload wheels and sidst to PyPI
runs-on: ubuntu-latest
needs: [build_wheels, test_library, build_sdist]
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
path: wheelhouse
pattern: "*"
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- run: mv wheelhouse/* dist/
- uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}