Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build distribution

on:
release:
types: [created]

jobs:
test:
uses: ./.github/workflows/test.yml
deploy:
needs: test
name: Deploy to PyPI
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: "pip" # caching pip dependencies
- name: Install build dependencies
run: python -m pip install build twine

- name: Build distributions
run: python -m build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
63 changes: 63 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PyTest
on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
pull_request:
paths:
- ".github/workflows/test.yml"
- "src/**"
- "tests/**"
- "pyproject.toml"
- "requirements.txt"

jobs:
test-against-python-matrix:
# Only test all the supported versions when a pull request is made or the workflow is called
if: ${{github.event_name == 'workflow_call'}} || ${{github.event_name == 'pull_request'}}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
- name: Install requirements
run: |
python -m pip install -e .[dev]
- name: Run tests
run: |
python -m pytest

test-against-latest-os:
# Always run against the latest version on both Windows, Linux, MacOS
if: github.event.pull_request.user.login != 'dependabot[bot]'
strategy:
matrix:
os: [windows-latest, macos-latest]
fail-fast: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip" # caching pip dependencies
- name: Install requirements
run: |
python -m pip install -e .[dev]
- name: Run tests
run: |
python -m pytest
- name: coverage
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.os }}
path: .coverage
overwrite: true
Loading