Skip to content

Fix wheels workflow failures: smoke_test path and FFTW package name #24

Fix wheels workflow failures: smoke_test path and FFTW package name

Fix wheels workflow failures: smoke_test path and FFTW package name #24

Workflow file for this run

name: ci-and-release
on:
pull_request:
push:
branches: [ main ]
tags: [ "v*" ]
workflow_dispatch:
concurrency:
group: ci-and-release-${{ github.ref }}
cancel-in-progress: true
jobs:
# =========================
# Build & test on PR/push
# =========================
build-test:
name: Build & Test (${{ matrix.os }} / py${{ matrix.python }})
strategy:
fail-fast: false
matrix:
include:
- { runner: ubuntu-latest, os: Linux, python: "3.10" }
- { runner: ubuntu-latest, os: Linux, python: "3.11" }
- { runner: ubuntu-latest, os: Linux, python: "3.12" }
- { runner: macos-15-intel, os: macOS-Intel, python: "3.10" }
- { runner: macos-15-intel, os: macOS-Intel, python: "3.11" }
- { runner: macos-15-intel, os: macOS-Intel, python: "3.12" }
- { runner: macos-15, os: macOS-ARM, python: "3.10" }
- { runner: macos-15, os: macOS-ARM, python: "3.11" }
- { runner: macos-15, os: macOS-ARM, python: "3.12" }
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
# ---------- System deps ----------
- name: Install system deps (Linux)
if: startsWith(matrix.os, 'Linux')
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libfftw3-dev cmake ninja-build pkg-config libboost-dev
- name: Install toolchain (macOS Intel)
if: matrix.os == 'macOS-Intel'
env: { HOMEBREW_NO_AUTO_UPDATE: "1" }
run: brew install fftw cmake ninja libomp boost || true
# ---------- Apple Silicon: build & cache FFTW in ~/.local ----------
- name: Cache FFTW (macOS ARM)
if: matrix.os == 'macOS-ARM'
uses: actions/cache@v4
with:
path: |
~/.local/include/fftw3.h
~/.local/lib/libfftw*
~/.local/lib/pkgconfig/fftw3*.pc
key: fftw-macos-arm-${{ hashFiles('ci/macos_arm_fftw.sh') }}
- name: Install toolchain & build FFTW (macOS ARM)
if: matrix.os == 'macOS-ARM'
env: { HOMEBREW_NO_AUTO_UPDATE: "1" }
run: |
brew install libomp boost cmake ninja || true
if [ ! -f "$HOME/.local/lib/libfftw3.dylib" ]; then
bash ci/macos_arm_fftw.sh
fi
# Help local *PR* builds find user-local FFTW during configure
{
echo "PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH"
echo "CMAKE_PREFIX_PATH=$HOME/.local:$CMAKE_PREFIX_PATH"
echo "LIBRARY_PATH=$HOME/.local/lib:$HOME/.local/lib64:$LIBRARY_PATH"
echo "CPATH=$HOME/.local/include:$CPATH"
} >> "$GITHUB_ENV"
# ---------- Build wheel via scikit-build-core ----------
- name: Build wheel
run: |
python -m pip install -U pip numpy build
python -m build -w
- name: Install wheel
run: python -m pip install dist/*.whl
# ---------- Smoke test ----------
- name: Smoke test
working-directory: ${{ github.workspace }}
env:
# Ensure the loader can see FFTW/OMP in CI for local wheels
DYLD_FALLBACK_LIBRARY_PATH: ${{ matrix.os == 'macOS-ARM' && format('{0}:{1}', env.HOME, '/.local/lib') || '/opt/homebrew/lib:/usr/local/lib' }}
run: |
ls ci/smoke_test.py
python "$GITHUB_WORKSPACE/ci/smoke_test.py"
- name: Upload test wheels (optional)
uses: actions/upload-artifact@v4
with:
name: ci-wheels-${{ matrix.os }}-py${{ matrix.python }}
path: dist/*.whl
if-no-files-found: warn
# ==========================================
# Release wheels (cibuildwheel) — tags only
# ==========================================
wheels:
name: Wheels (${{ matrix.name }})
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ${{ matrix.runner }}
permissions: { contents: read }
strategy:
fail-fast: false
matrix:
include:
- { name: linux-x86_64, runner: ubuntu-latest }
- { name: linux-aarch64, runner: ubuntu-24.04-arm }
- { name: macos-intel, runner: macos-15-intel }
- { name: macos-arm, runner: macos-15 }
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
# macOS prep (host environment for cibuildwheel)
- name: macOS toolchain (Intel)
if: matrix.name == 'macos-intel'
env: { HOMEBREW_NO_AUTO_UPDATE: "1" }
run: brew install fftw libomp boost cmake ninja || true
- name: macOS toolchain + FFTW from source (ARM)
if: matrix.name == 'macos-arm'
env: { HOMEBREW_NO_AUTO_UPDATE: "1" }
run: |
set -eux
brew install libomp boost cmake ninja || true
bash ci/macos_arm_fftw.sh
- name: Build wheels with cibuildwheel
uses: pypa/cibuildwheel@v2.21.3
# All config lives in pyproject.toml now
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: dist-wheels-${{ matrix.name }}
path: wheelhouse/*
if-no-files-found: error
# ==========================
# Source dist — tags only
# ==========================
sdist:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions: { contents: read }
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: python -m pip install -U pip build
- run: python -m build -s
- uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist/*
if-no-files-found: error
# ==========================
# Publish — tags only
# ==========================
publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build-test, wheels, sdist]
runs-on: ubuntu-latest
environment: cpp_hf_env
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/