Skip to content

Merge pull request #57 from mammo0/dependabot/pip/pytest-8.3.1 #190

Merge pull request #57 from mammo0/dependabot/pip/pytest-8.3.1

Merge pull request #57 from mammo0/dependabot/pip/pytest-8.3.1 #190

Workflow file for this run

name: PyPI package
on:
push:
branches:
- master
tags:
- v*
pull_request:
jobs:
test:
name: Test package
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
# checkout the repo
- uses: actions/checkout@v4
# setup python environment
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v3
# install the test dependencies
- name: Install test dependencies
run: |
poetry install
- name: Test package
run: |
poetry run pytest
build-publish:
name: Build and publish package
if: ${{ github.event_name == 'push' }}
needs: test
runs-on: ubuntu-latest
# needed for publishing on PyPi with OIDC
permissions:
id-token: write
steps:
# checkout the repo
- uses: actions/checkout@v4
with:
# fetch complete history because it's needed by Poetry
fetch-depth: 0
# setup python environment
- name: Set up Python
uses: actions/setup-python@v5
- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-plugins: "poetry-dynamic-versioning[plugin]"
# build the package
- name: Build package
run: |
poetry build
# on a regular push (not pull request) publish the package to test PyPI repo
- name: Publish package distributions to TestPyPI
if: github.event_name != 'pull_request'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
# on a release push publish the package to the regular PyPI repo
- name: Publish package distributions to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1