Skip to content

Complete meson-python build system migration with test fixes #179

Complete meson-python build system migration with test fixes

Complete meson-python build system migration with test fixes #179

Workflow file for this run

name: Build Wheels
on:
push:
branches: [ public, mesonify ]
tags:
- v*
pull_request:
branches: [ public, mesonify ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# macos-13 is x86_64, macos-14 is arm64
os: [ubuntu-latest, macos-13, macos-14]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.21.1
- name: Determine architecture
id: arch
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
echo "arch=x86_64" >> $GITHUB_OUTPUT
elif [ "$RUNNER_OS" == "macOS" ]; then
# macos-13 is x86_64, macos-14 is arm64
if [[ "${{ matrix.os }}" == "macos-14" ]]; then
echo "arch=arm64" >> $GITHUB_OUTPUT
else
echo "arch=x86_64" >> $GITHUB_OUTPUT
fi
fi
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse quippy
env:
# Skip Python 2.7, 3.5, 3.6, PyPy, and musllinux
CIBW_SKIP: "cp27-* cp35-* cp36-* pp* *musllinux*"
# Use manylinux2014 for Linux
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
# Install system dependencies
CIBW_BEFORE_ALL_LINUX: "yum install -y gcc-gfortran openblas-devel"
CIBW_BEFORE_ALL_MACOS: "brew install gfortran openblas"
# Build with meson-python (already configured in pyproject.toml)
CIBW_BUILD_FRONTEND: "build"
# Architecture setting
CIBW_ARCHS: ${{ steps.arch.outputs.arch }}
# Uncomment to get SSH access for testing
# - name: Setup tmate session
# if: failure()
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
# Combine all wheels and create release
release:
name: Create release
needs: build_wheels
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: wheelhouse
- name: Build source tarball
run: |
pip install git-archive-all
version=$(echo ${{ github.ref }} | sed -e 's|refs/tags/||')
git-archive-all QUIP-$version.tar.gz
- name: Release wheels and source tarball
uses: softprops/action-gh-release@v2
with:
files: |
wheelhouse/*.whl
QUIP-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if production release tag
id: check-tag
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "match=true" >> $GITHUB_OUTPUT
fi
- name: Deploy to PyPI
if: steps.check-tag.outputs.match == 'true'
run: |
pip install twine
twine upload wheelhouse/*.whl
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}