Skip to content

Merge pull request #89 from muon-spectroscopy-computational-project/i… #97

Merge pull request #89 from muon-spectroscopy-computational-project/i…

Merge pull request #89 from muon-spectroscopy-computational-project/i… #97

Workflow file for this run

name: Build pip wheels
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- .github/workflows/build-docs.yml
- .github/workflows/citation-cff.yml
- .github/workflows/build.yml
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macOS-11 pinned here due to usage of $(brew --prefix llvm@15)
# macOS-12 will become macOS-latest in the near future but
# is currently still unstable
os: [ubuntu-latest, macOS-11, windows-latest]
steps:
- uses: actions/checkout@v3
# Required for aarch64
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
# aarch64 and arm64 are both ARM architectures
# defined here to allow them to be built on the Intel based runners
CIBW_ARCHS_WINDOWS: auto # ARM64 - ignore for now, seems numpy causes issues here
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64 arm64
# Build with OpenMP
CIBW_ENVIRONMENT: MUSPINSIM_WITH_OPENMP=1
# Default compiler on macOS doesn't support OpenMP, so force the usage
# of homebrew's llvm see
# https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md
CIBW_ENVIRONMENT_MACOS: CC="$(brew --prefix llvm@15)/bin/clang" CXX="$(brew --prefix llvm@15)/bin/clang++"
# Run tests of the installed wheels (skipping ARM as they wont run here)
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest --pyargs muspinsim
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64"
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
run: |
python -m pip install build
python -m build --sdist
# Ensure source distribution is actually buildable (in case any files are missing)
- name: Test sdist
run: |
mkdir ./muspinsim-sdist
tar -xf ./dist/muspinsim-*.tar.gz -C ./muspinsim-sdist --strip-components 1
pip install ./muspinsim-sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz