Skip to content

Python Tests and Publish #12

Python Tests and Publish

Python Tests and Publish #12

Workflow file for this run

name: Python Tests and Publish
on:
push:
branches: [ atspm-package ]
pull_request:
branches: [ atspm-package ]
release:
types: [created]
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install pytest build pandas pyarrow
pip install .
- name: Build package
run: python -m build
- name: Run tests
run: pytest --junitxml=pytest-results.xml
- name: Upload pytest results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
path: pytest-results.xml
if: ${{ always() }}
publish:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'release' && success()
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*