Workflow file for this run
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: Upload Python Package | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- 'v*' | |
permissions: | |
contents: read | |
jobs: | |
test: | |
name: Test | |
strategy: | |
matrix: | |
python-version: [3.11.x, 3.12.x] | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{matrix.platform}} | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pipenv | |
pipenv install --dev --deploy --system | |
- name: Run tests | |
env: | |
PYTHONPATH: "${{ github.workspace }}/src" | |
run: | |
pytest -v --random-order | |
release: | |
name: Release | |
if: github.ref_type == 'tag' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
- name: Build package | |
run: python -m build | |
- name: Publish Test | |
if: endsWith(github.ref, 'test') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TESTPYPI_API_TOKEN }} | |
run: | |
twine upload --repository testpypi dist/* | |
- name: Publish | |
if: ${{ !endsWith(github.ref, 'test') }} | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | |
twine upload dist/* |