Skip to content

Update formatting and linting and add pre-commit #11

Update formatting and linting and add pre-commit

Update formatting and linting and add pre-commit #11

Workflow file for this run

name: Packaging
on:
push:
branches: [main]
tags: ["v*"] # run on version tags
pull_request:
branches: [main] # run on PRs targeting main
release:
types: [published] # run on Github release
jobs:
check:
name: Check ${{ matrix.tox-env }}
runs-on: ubuntu-latest
strategy:
matrix:
tox-env: [format, lint, typecheck]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install tox
run: python -m pip install tox
- name: Run ${{ matrix.tox-env }} check
run: tox -e ${{ matrix.tox-env }}
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install tox tox-gh-actions
- name: Run tests
run: tox
build:
name: Build source distribution
needs: [check, test] # wait for checks and tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install build tools
run: python -m pip install build
- name: Build package
run: python -m build
- uses: actions/upload-artifact@v6
with:
name: dist
path: dist/
publish-pypi:
name: Publish on PyPI
needs: [build] # wait for build
if: github.event_name == 'release' # only on release
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/django-webmention
permissions:
id-token: write # required for trusted publishing
steps:
- uses: actions/download-artifact@v7
with:
name: dist
path: dist/
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-pypi-test:
name: Publish on Test PyPI
needs: [build] # wait for build
if: startsWith(github.ref, 'refs/tags/') # only on tags
runs-on: ubuntu-latest
environment:
name: pypi-test
url: https://test.pypi.org/p/django-webmention
permissions:
id-token: write # required for trusted publishing
steps:
- uses: actions/download-artifact@v7
with:
name: dist
path: dist/
- name: Upload package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/