Skip to content

Adapt to numpy 2.0 #121

Adapt to numpy 2.0

Adapt to numpy 2.0 #121

Workflow file for this run

name: Build, test, and publish Python distributions to PyPI
# My strategy is test, build, and (try to) publish on all push events. The
# publish step fails silently if the pypi version already exists.
on:
push:
branches: [main]
# tags: "v*.*.*" # Tag push is not associated with a branch, so OR this.
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Validate code
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python-version: ['3.10', '3.x']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install any requirements
run: pip install .[dev]
- name: Run tests including doctest
run: |
python -m pip install pytest
pytest --doctest-modules ./resampler
- name: Run mypy
if: false # mypy is slow (5 minutes) and has problems with numpy.
run: |
python -m pip install mypy
# Omit "--strict" because numpy on github has type stubs.
mypy --exclude 'build/|setup.py' .
publish:
name: Publish to PyPI
# if: github.repository == 'hhoppe/some_repo'
# if: startsWith(github.ref, 'refs/tags/v')
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 30
needs: validate
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Build a binary wheel and a source tarball
run: |
python -m pip install build --user
python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
continue-on-error: true # Ignore if pypi already has this version.