Skip to content

Unpin numpy from dependencies and test multiple versions in CI #21

Unpin numpy from dependencies and test multiple versions in CI

Unpin numpy from dependencies and test multiple versions in CI #21

Workflow file for this run

name: Test
on:
- push
- pull_request
jobs:
test:
name: Test
runs-on: ubuntu-20.04
env:
OS: Linux
strategy:
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- 'pypy-3.7'
- 'pypy-3.8'
- 'pypy-3.9'
- 'pypy-3.10'
numpy-version:
- '1.0'
- '2.0'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install CI requirements
run: python -m pip install -r .github/workflows/requirements.txt
- name: Install NumPy ${{ matrix.numpy-version }}
run: python -m pip install -U 'numpy ~=${{ matrix.numpy-version }}' --prefer-binary
- name: Install test requirements
run: python -m pip install -r tests/requirements.txt --prefer-binary
- name: Test with coverage
run: python -m coverage run -m unittest discover -vv
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
flags: ${{ matrix.python-version }}
name: test-python-${{ matrix.python-version }}
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
wheel:
runs-on: ubuntu-latest
name: Build universal wheel
needs:
- test
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install build requirements
run: python -m pip install -r .github/workflows/requirements.txt
- name: Build wheel
run: python -m build --wheel --outdir dist
- name: Store built wheels
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*
sdist:
runs-on: ubuntu-latest
name: Build source distribution
needs:
- test
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install build requirements
run: python -m pip install -r .github/workflows/requirements.txt
- name: Build distribution
run: python -m build --sdist --outdir dist
- name: Store built wheels
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*
upload:
environment: PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
name: Upload
needs:
- sdist
- wheel
steps:
- name: Download source distribution
uses: actions/download-artifact@v4
with:
name: sdist
path: dist/
merge-multiple: true
- name: Download wheel distributions
uses: actions/download-artifact@v4
with:
pattern: wheel
path: dist/
merge-multiple: true
- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
release:
environment: GitHub Releases
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/v')"
name: Release
needs: upload
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Release a Changelog
uses: rasmus-saks/[email protected]
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'