Skip to content

Merge pull request #48 from lgray/patch-1 #80

Merge pull request #48 from lgray/patch-1

Merge pull request #48 from lgray/patch-1 #80

Workflow file for this run

name: Build
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U -r requirements_dev.txt
pip install tox tox-gh-actions
- name: Test with tox numpy>=2
run: tox -e latestnpy
- name: Test with tox numpy<2
run: tox -e oldestnpy
build_wheels:
name: Build wheel for ${{ matrix.os }}-cp${{ matrix.python }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python: [38, 39, 310, 311, 312]
arch: [auto64, auto32, universal2]
build: ["cp"]
exclude:
- os: ubuntu-latest
arch: universal2
- os: windows-latest
arch: universal2
- os: macos-latest
arch: auto32
steps:
- name: Checkout mt2
uses: actions/checkout@v4
# Used to host cibuildwheel
- name: Setup Python
uses: actions/setup-python@v5
- uses: pypa/[email protected]
env:
CIBW_BUILD: "${{ matrix.build }}${{ matrix.python }}*"
CIBW_ARCHS: ${{ matrix.arch }}
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.12"
- name: Install numpy and setuptools
run: python -m pip install numpy setuptools
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
with:
path: dist/*.tar.gz
pass:
needs: [test, build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- run: echo "All jobs passed"
upload_pypi:
needs: [build_wheels, build_sdist, test]
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: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/