Skip to content

fix: use macos-14 (ARM64) and macos-15-intel with deployment target 14.0 #96

fix: use macos-14 (ARM64) and macos-15-intel with deployment target 14.0

fix: use macos-14 (ARM64) and macos-15-intel with deployment target 14.0 #96

name: build_and_publish
on:
push:
tags:
branches:
pull_request:
branches:
repository_dispatch:
types: build
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_type }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
run_cpp_tests:
name: "Run C++ tests"
runs-on: ubuntu-24.04
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: "Install dependencies"
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -qq --yes >/dev/null
sudo apt-get install -qq --yes build-essential gsl-bin libboost-all-dev libgsl-dev >/dev/null
- name: "Build C++ tests"
run: |
make tests
- name: "Run C++ tests"
run: |
make run-tests
build_wheels:
name: "Build wheel (${{ matrix.os }}, py${{ matrix.python-version }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, macos-14, macos-15-intel ]
python-version: [ 310, 311 ]
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: "Build wheel (${{ matrix.os }}, py${{ matrix.python-version }})"
uses: pypa/[email protected]
with:
config-file: cibuildwheel.toml
env:
CIBW_BUILD: "cp${{ matrix.python-version}}-*"
# Override deployment target to 14.0 for all macOS runners
MACOSX_DEPLOYMENT_TARGET: "14.0"
# Skip cross-architecture testing to avoid brew/Rosetta issues
CIBW_TEST_SKIP: >-
${{
matrix.os == 'macos-14' && '*macosx_x86_64* *aarch64* *ppc64* *s390x*' ||
matrix.os == 'macos-15-intel' && '*macosx_arm64* *aarch64* *ppc64* *s390x*' ||
'*aarch64* *arm64* *ppc64* *s390x*'
}}
- name: "Upload build artifacts (${{ matrix.os }}, py${{ matrix.python-version }})"
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-py${{ matrix.python-version }}
path: ./wheelhouse/*.whl
make_sdist:
name: "Make source distribution"
runs-on: ubuntu-24.04
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: "Build sdist"
run: |
pip3 install pipx ppsetuptools
pipx run build --sdist
- name: "Upload build artifacts"
uses: actions/upload-artifact@v4
with:
name: "dist-sdist"
path: "dist/*.tar.gz"
publish_to_pypi:
name: "Publish to PyPI"
if: startsWith(github.ref, 'refs/tags')
needs: [ run_cpp_tests, build_wheels, make_sdist ]
runs-on: ubuntu-24.04
strategy:
fail-fast: true
steps:
- name: "Download build artifacts"
uses: actions/download-artifact@v4
with:
path: "artifacts"
- name: "Collect all artifacts into dist folder"
run: |
mkdir -p dist
find artifacts -type f \( -name '*.whl' -o -name '*.tar.gz' \) -exec cp {} dist/ \;
- name: "Publish to PyPI"
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}