Skip to content

Merge pull request #95 from fwilliams/dependabot/github_actions/dot-g… #316

Merge pull request #95 from fwilliams/dependabot/github_actions/dot-g…

Merge pull request #95 from fwilliams/dependabot/github_actions/dot-g… #316

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:
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
env:
# Skip 32-bit builds, MUSL libc, and pypy
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*"
CIBW_BEFORE_BUILD_LINUX: yum -y install gcc-gfortran lapack-devel blas-devel
CIBW_ARCHS_LINUX: "auto"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" # delocate-listdeps --all {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
# CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
uses: pypa/[email protected]
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v2
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.event.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/[email protected]
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/
#name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
#on: push
#jobs:
# build-n-publish:
# name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
# runs-on: ubuntu-latest
# steps:
# - name: Checkout main branch
# uses: actions/checkout@master
#
# - name: Set up Python
# uses: actions/setup-python@v1
# with:
# python-version: 3.9
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install twine
#
# - name: Build manylinux wheels
# uses: RalfG/[email protected]
# with:
# python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
#
# - name: Publish wheels to test PyPI
# env:
# TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
# run: |
# twine upload --repository testpypi dist/*-manylinux*.whl