Skip to content

Update CI scripts

Update CI scripts #75

Workflow file for this run

name: Build and upload to PyPI
# Build on every branch push, tag push, and pull request change:
# on: [push, pull_request]
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
on:
push:
pull_request:
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Note: builds on these are backward compatible
# (Linux builds use manylinux Docker containers)
# (macOS builds target old versions by default)
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
# to supply options, put them in 'env', like:
# env:
# CIBW_SOME_OPTION: value
env:
# List of platforms to build on
CIBW_BUILD: cp3{8,9,10,11}-manylinux_x86_64 cp3{8,9,10,11}-macosx_x86_64 cp3{8,9,10,11}-macosx_arm64 cp3{8,9,10,11}-win_amd64
# Install Eigen and pybind11 on manylinux images (no brew, need Eigen >= 3.4)
CIBW_BEFORE_ALL_LINUX: >
yum install -y wget &&
wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz &&
tar xzf eigen-3.4.0.tar.gz &&
cd eigen-3.4.0 &&
mkdir build &&
cd build &&
cmake .. &&
make install &&
cd ../..
CIBW_BEFORE_BUILD_LINUX: pip install pybind11[global]
# Install Eigen and pybind11 on macOS
CIBW_BEFORE_ALL_MACOS: brew install eigen pybind11
# Install Eigen and pybind11 on Windows
CIBW_BEFORE_ALL_WINDOWS: choco install eigen
CIBW_BEFORE_BUILD_WINDOWS: pip install pybind11[global] delvewheel
# cibuildwheel doesn't yet ship a default repair command for Windows
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
# Install test dependencies and run tests
CIBW_TEST_REQUIRES: numpy
CIBW_TEST_COMMAND: python {project}/tests/test_multistart.py
- 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: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.pypi_password }}
# To test: repository_url: https://test.pypi.org/legacy/