Skip to content

cmake: modernize CMake infrastructure; adds modules, bindings; build Windows wheels #31

cmake: modernize CMake infrastructure; adds modules, bindings; build Windows wheels

cmake: modernize CMake infrastructure; adds modules, bindings; build Windows wheels #31

Workflow file for this run

name: Wheels
on:
workflow_dispatch:
pull_request:
branches: [ master ]
release:
types: [ published ]
jobs:
build_wheels:
name: Build wheels for ${{ matrix.build }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# macos-15-intel for x86_64 (min macOS 15.0), macos-14 for ARM (min macOS 14.0)
- os: macos-15-intel
python: '3.12'
build: 'cp*-macosx_x86_64'
target: '15.0'
prefix: /usr/local
- os: macos-14
python: '3.12'
build: 'cp*-macosx_arm64'
target: '14.0'
prefix: /opt/homebrew
- os: ubuntu-latest
python: '3.12'
build: 'cp*-manylinux_x86_64'
prefix: /usr
- os: windows-latest
python: '3.12'
build: 'cp*-win_amd64'
prefix: 'C:\Program Files'
steps:
- name: Setup environment
run: echo "PREFIX=${{ matrix.prefix }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
# Used to host cibuildwheel
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Setup macOS environment
if: runner.os == 'macOS'
run: |
echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.target }}" >> $GITHUB_ENV
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.3.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse bindings/python
env:
CIBW_BUILD: ${{ matrix.build }}
CIBW_SKIP: cp38*
CIBW_BEFORE_ALL_LINUX: >
yum install -y cmake bzip2-devel flac-devel xz-devel pcre-devel zziplib-devel
CIBW_BEFORE_ALL_MACOS: >
brew install --quiet cmake bzip2 flac xz pcre libzzip
CIBW_BEFORE_ALL_WINDOWS: >
choco install cmake --no-progress
CIBW_BEFORE_BUILD: >
python -m pip install "scikit-build-core>=0.5" "numpy>=2.0"
CIBW_BEFORE_BUILD_WINDOWS: >
pip install delvewheel "scikit-build-core>=0.5" "numpy>=2.0"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
delvewheel show {wheel} && delvewheel repair -vv -w {dest_dir} {wheel}
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_COMMAND_LINUX: >
python -c "import pygetdata; print(f'pygetdata version: {pygetdata.__version__}')" &&
cd {project}/bindings/python/test &&
python big_test.py
CIBW_TEST_COMMAND_MACOS: >
python -c "import pygetdata; print(f'pygetdata version: {pygetdata.__version__}')" &&
cd {project}/bindings/python/test &&
python big_test.py
CIBW_TEST_COMMAND_WINDOWS: >
python -c "import pygetdata; print(f'pygetdata version: {pygetdata.__version__}')" &&
cd /d {project}\bindings\python\test &&
python big_test.py
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cibw-wheel-${{ matrix.os }}
path: ./wheelhouse/pygetdata*.whl
upload_pypi:
needs: [build_wheels]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1