Skip to content

Commit

Permalink
chore(ci): add separate job for package linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Oct 15, 2024
1 parent f42d4ac commit 9257c7d
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ permissions:
jobs:
setup:
runs-on: ubuntu-24.04
name: Test manual install

env:
PYTHONUNBUFFERED: 1
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:

pip:
runs-on: ubuntu-24.04
name: Test pip install

env:
PYTHONUNBUFFERED: 1
Expand Down Expand Up @@ -89,6 +91,7 @@ jobs:

dist:
runs-on: ubuntu-24.04
name: Build packages
env:
PYTHONUNBUFFERED: 1
PYTHONWARNINGS: default,ignore:unclosed:ResourceWarning
Expand All @@ -106,10 +109,6 @@ jobs:
python-version: '3.12'
- name: build
run: uv build
- name: Twine check
run: uvx twine check --strict dist/*
- name: pydistcheck
run: uvx pydistcheck --inspect dist/*
- name: Sign the dists with Sigstore
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/weblate')
uses: sigstore/[email protected]
Expand All @@ -121,13 +120,34 @@ jobs:
with:
subject-path: dist/*
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/weblate')
with:
path: dist/*
name: dist

lint:
runs-on: ubuntu-24.04
name: Lint packages
env:
PYTHONUNBUFFERED: 1
needs:
- dist
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- uses: actions/download-artifact@v4
- name: Cleanup dist
# Remove files not supported on PyPI (eg. Sigstore signatures)
run: find dist -mindepth 1 -not -name '*.tar.gz' -not -name '*.whl' -delete
- name: twine check
run: uvx twine check --strict dist/*
- name: pydistcheck
run: uvx pydistcheck --inspect dist/*
- name: pyroma
run: uvx pyroma dist/*.tar.gz

notes:
runs-on: ubuntu-24.04
name: Build release notes
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
Expand Down Expand Up @@ -158,13 +178,15 @@ jobs:
name: notes

publish_pypi:
name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/weblate')
permissions:
# this permission is mandatory for trusted publishing
id-token: write
needs:
- notes
- dist
- lint
runs-on: ubuntu-24.04
steps:
- uses: actions/download-artifact@v4
Expand All @@ -175,13 +197,15 @@ jobs:
- run: uv publish --trusted-publishing always

publish_github:
name: Publish to GitHub
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/weblate')
permissions:
# this permission is mandatory for creating a release
contents: write
needs:
- notes
- dist
- lint
runs-on: ubuntu-24.04
steps:
- uses: actions/download-artifact@v4
Expand Down

0 comments on commit 9257c7d

Please sign in to comment.