Skip to content

Tests

Tests #23

Workflow file for this run

name: Tests
on:
push:
branches: [ main ]
tags: [ "*" ]
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: |
python3 -m pip install --upgrade pip
python3 -m pip install . pytest
- name: Test with pytest
run: |
python3 -m pytest -v
build_wheels:
name: Build wheels
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp{38,39,310,311,312}-manylinux_x86_64
- uses: actions/upload-artifact@v4
with:
name: wheels
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
upload_pypi:
needs: [ build_wheels, build_sdist ]
runs-on: ubuntu-latest
# upload to PyPI on any tag on main
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
# unpack all artifacts into dist/
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_token }}