Skip to content

Adding testing to CI #91

Adding testing to CI

Adding testing to CI #91

name: Publish Python Package to PyPi
on: push
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: startsWith(github.ref, 'refs/tags')
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04, macos-13, macos-14, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.19.1
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp3*"
- uses: actions/upload-artifact@v4
with:
name: artifact-cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*.tar.gz
test-wheels:
name: Test wheels on ${{ matrix.os }}
needs: [build_wheels]
runs-on: ${{ matrix.os }}
if: startsWith(github.ref, 'refs/tags')
strategy:
matrix:
python-version: ["3.10", "3.12"]
os: [ubuntu-latest, ubuntu-24.04, macos-13, macos-14, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download Python wheels
uses: actions/download-artifact@v4
with:
pattern: artifact-cibw-wheels-${{ matrix.os }}-*
merge-multiple: true
path: ./wheels
- name: Setup UV
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Install wheel
shell: bash
run: |
uv pip install texterrors --find-links ./wheels/
- name: Run tests
shell: bash
run: |
pytest -v .
upload_pypi:
needs: [build_wheels, build_sdist, test-wheels]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
path: dist
merge-multiple: true
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}