Python Tests and Publish #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Tests and Publish | |
on: | |
push: | |
branches: [ atspm-aggregation ] | |
pull_request: | |
branches: [ atspm-aggregation ] | |
release: | |
types: [created] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest] | |
python-version: ['3.11'] | |
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 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@v3 | |
with: | |
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }} | |
path: pytest-results.xml | |
if: ${{ always() }} | |
publish: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' | |
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/* |