Skip to content

Switch extension building to setuptools #223

Switch extension building to setuptools

Switch extension building to setuptools #223

Workflow file for this run

---
name: Build
on:
push:
branches:
- main
tags:
- v**
pull_request:
types: [opened, synchronize]
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Apply patches
run: cat $(ls patches/*.patch | sort) | patch -p1 -N
- name: Build sdist
run: pip3 install build && python3 -m build -s .
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
name: sdist
build_wheels:
needs: [build_sdist]
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15, windows-2019]
steps:
- uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Decompress sdist (windows)
if: startsWith(matrix.os, 'windows-')
run: tar --strip-components=1 -xf $(dir dist/*.tar.gz | % {$_.FullName})
- name: Decompress sdist
if: "! startsWith(matrix.os, 'windows-')"
run: tar --strip-components=1 -xf dist/*.tar.gz
- name: Build wheel
uses: joerick/[email protected]
env:
CIBW_SKIP: cp2* cp35* pp*
CIBW_TEST_COMMAND: pytest --regression {package}/tests
CIBW_BEFORE_TEST: pip install pytest dials-data
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
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/download-artifact@v4
with:
name: sdist
path: dist
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}