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
172 changes: 65 additions & 107 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -1,141 +1,99 @@
name: Packaging

on:
- push
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:
format:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run black
run: tox -e format

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run flake8
run: tox -e lint

typecheck:
name: Type check
check:
name: Check ${{ matrix.tox-env }}
runs-on: ubuntu-latest
strategy:
matrix:
tox-env: [format, lint, typecheck]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"

python-version: "3.14"
- name: Install tox
run: python -m pip install tox

- name: Run mypy
run: tox -e typecheck
- name: Run ${{ matrix.tox-env }} check
run: tox -e ${{ matrix.tox-env }}

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python:
- version: "3.13"
toxenv: "py313"
- version: "3.12"
toxenv: "py312"
- version: "3.11"
toxenv: "py311"
- version: "3.10"
toxenv: "py310"
- version: "3.9"
toxenv: "py39"
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python.version }}

- name: Install tox
run: python -m pip install tox

- name: Run pytest
run: tox -e ${{ matrix.python.toxenv }}
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install tox tox-gh-actions
- name: Run tests
run: tox

build_source_dist:
build:
name: Build source distribution
needs: [check, test] # wait for checks and tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install build
python-version: "3.14"
- name: Install build tools
run: python -m pip install build

- name: Run build
run: python -m build --sdist

- uses: actions/upload-artifact@v4
- name: Build package
run: python -m build
- uses: actions/upload-artifact@v6
with:
path: dist/*.tar.gz
name: dist
path: dist/

publish:
needs: [format, lint, typecheck, test]
if: startsWith(github.ref, 'refs/tags')
publish-pypi:
name: Publish on PyPI
needs: [build] # wait for build
if: github.event_name == 'release' # only on release
runs-on: ubuntu-latest
environment: release
environment:
name: pypi
url: https://pypi.org/p/django-webmention
permissions:
id-token: write
contents: write
id-token: write # required for trusted publishing
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/download-artifact@v7
with:
python-version: 3.9

- name: Install pypa/build
run: python -m pip install build

- name: Build distribution
run: python -m build --outdir dist/

- name: Publish distribution to Test PyPI
name: dist
path: dist/
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution to PyPI
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

- name: Publish distribution to GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
dist/django_webmention-*.whl
dist/django_webmention-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repository-url: https://test.pypi.org/legacy/
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

Loading