Update pre-commit hook PyCQA/doc8 to v2 #2716
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "*" | |
env: | |
UV_FROZEN: "true" | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
include: | |
- python-version: "3.9" | |
postgres-version: "13" | |
- python-version: "3.10" | |
postgres-version: "14" | |
- python-version: "3.11" | |
postgres-version: "15" | |
- python-version: "3.12" | |
postgres-version: "16" | |
- python-version: "3.13" | |
postgres-version: "17" | |
name: "py${{ matrix.python-version }}" | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:${{ matrix.postgres-version }} | |
# Set health checks to wait until postgres has started | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run tests | |
run: uv run pytest --cov=procrastinate --cov-branch | |
env: | |
COVERAGE_FILE: ".coverage.${{ matrix.python-version }}" | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
- name: Store coverage file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.python-version }} | |
path: .coverage.${{ matrix.python-version }} | |
include-hidden-files: true | |
acceptance-tests: | |
strategy: | |
matrix: | |
mode: | |
- "current_version_without_post_migration" | |
- "stable_version_without_post_migration" | |
name: "e2e ${{ matrix.mode }}" | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:17 | |
# Set health checks to wait until postgres has started | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6 | |
with: | |
python-version: "3.13" | |
- name: Get latest tag | |
id: get-latest-tag | |
run: gh release list --limit 1 --json tagName --jq '"latest_tag="+.[0].tagName' >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run tests | |
run: uvx nox -s ${{ matrix.mode }} | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
LATEST_TAG: ${{ steps.get-latest-tag.outputs.latest_tag }} | |
static-typing: | |
name: Run Pyright | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: uv sync --all-extras --group=types | |
- name: Activate virtualenv | |
run: echo ".venv/bin" >> $GITHUB_PATH | |
- name: Extract pyright version from pre-commit | |
id: pre-commit-pyright-version | |
run: > | |
yq '.repos | |
| filter(.repo == "https://github.com/RobertCraigie/pyright-python").0.rev | |
| "pyright-version="+sub("^v", "") | sub(".post\d+$"; "")' | |
.pre-commit-config.yaml >> $GITHUB_OUTPUT | |
- uses: jakebailey/pyright-action@v2 | |
with: | |
version: ${{ steps.pre-commit-pyright-version.outputs.pyright-version }} | |
coverage: | |
name: Coverage | |
runs-on: ubuntu-latest | |
needs: [tests] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: coverage-* | |
merge-multiple: true | |
- name: Display coverage | |
uses: ewjoachim/python-coverage-comment-action@v3 | |
with: | |
MERGE_COVERAGE_FILES: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Store Pull Request comment to be posted | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-coverage-comment-action | |
path: python-coverage-comment-action.txt | |
benchmark: | |
name: Benchmark | |
runs-on: ubuntu-latest | |
permissions: | |
deployments: write | |
contents: write | |
services: | |
postgres: | |
image: postgres:17 | |
# Set health checks to wait until postgres has started | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6 | |
with: | |
python-version: "3.13" | |
- name: Run benchmarks | |
run: uv run pytest -m "benchmark" --benchmark-json output.json | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
- name: Store benchmark result | |
if: github.event_name == 'push' && github.ref_type == 'branch' | |
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1 | |
with: | |
name: Procrastinate Benchmarks | |
tool: "pytest" | |
output-file-path: output.json | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
auto-push: true | |
publish: | |
name: Publish package to PyPI | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
id-token: write | |
needs: | |
- tests | |
- static-typing | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-tags: true | |
ref: ${{ github.ref }} | |
- name: Build wheel & sdist | |
run: pipx run uv build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |