Skip to content

Skbuild

Skbuild #43

Workflow file for this run

name: Publish package
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # such that setuptools_scm can do its job correctly
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # such that setuptools_scm can do its job correctly
# this will set the system compiler;
- name: Set Windows env
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- uses: pypa/[email protected]
env:
# Cross-compile on macOS
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
# skip windows 32-bit, musllinux, i686, and s390x
CIBW_SKIP: "*-win32 *-musllinux* *_i686 *_s390x"
# skip testing PyPy builds
CIBW_TEST_SKIP: "pp*"
# install Eigen
CIBW_BEFORE_ALL_LINUX: >
yum install -y cmake &&
curl -sL https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.bz2 | tar xj &&
cd eigen-3.4.0 &&
cmake -S. -Bbuild &> /dev/null &&
cmake --build build --target install &> /dev/null &&
yum remove -y cmake
CIBW_ENVIRONMENT_LINUX: >
Eigen3_ROOT="/usr/local/share/eigen3/cmake"
SKBUILD_CMAKE_ARGS="-DENABLE_ARCH_FLAGS=OFF;-DENABLE_OPENMP=OFF"
CIBW_BEFORE_ALL_MACOS: >
brew update &&
brew install eigen
CIBW_ENVIRONMENT_MACOS: >
SKBUILD_CMAKE_ARGS="-DENABLE_ARCH_FLAGS=OFF;-DENABLE_OPENMP=OFF"
CIBW_BEFORE_ALL_WINDOWS: >
choco install eigen
CIBW_ENVIRONMENT_WINDOWS: >
Eigen3_ROOT="C:\\ProgramData\\chocolatey\\lib\\eigen"
SKBUILD_CMAKE_ARGS="-GNinja;-DCMAKE_CXX_COMPILER=clang-cl;-DENABLE_ARCH_FLAGS=OFF;-DENABLE_OPENMP=OFF"
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
upload_all:
name: Upload if release
needs:
- build_wheels
- build_sdist
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/setup-python@v4
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1
with:
user: __token__
password: ${{ secrets.pypi_password }}