Run lint, format, pyright, pytest and pre-commit on every PR to main. uv is installed from a hash-pinned requirements file, not by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7c1567e4ec
commit
f9ccaace89
3 files changed
+84
No files matched your search
@@ -0,0 +1,60 @@
|
||||
# Checks every pull request against main: locked environment, ruff lint and
|
||||
# format, pyright (strict), pytest and the pre-commit hooks.
|
||||
#
|
||||
# Triggered only by `pull_request`: no `push` (branches are checked once, in
|
||||
# their PR) and never `pull_request_target`, which would run with repository
|
||||
# secrets on code from the PR.
|
||||
#
|
||||
# The container image is named explicitly so the Python version does not
|
||||
# depend on the runner's defaults. uv is installed from a hashed requirements
|
||||
# file (.gitea/ci/uv-requirements.txt) so that nothing is installed by name
|
||||
# only; all project tools then come from uv.lock.
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
checks:
|
||||
runs-on: linux-docker
|
||||
container:
|
||||
image: python:3.14-slim-trixie
|
||||
env:
|
||||
UV_PYTHON_DOWNLOADS: never
|
||||
UV_LINK_MODE: copy
|
||||
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
||||
steps:
|
||||
# nodejs must come before checkout: act_runner runs the JavaScript
|
||||
# action actions/checkout with node inside the job container.
|
||||
# pyright needs node as well.
|
||||
- name: System dependencies
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y --no-install-recommends nodejs git ca-certificates
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Install uv
|
||||
run: pip install --root-user-action=ignore --require-hashes -r .gitea/ci/uv-requirements.txt
|
||||
|
||||
- name: Sync locked environment
|
||||
run: uv sync --locked
|
||||
|
||||
- name: Ruff lint
|
||||
run: uv run ruff check
|
||||
|
||||
- name: Ruff format
|
||||
run: uv run ruff format --check
|
||||
|
||||
- name: Pyright
|
||||
run: uv run pyright
|
||||
|
||||
- name: Pytest
|
||||
run: uv run pytest
|
||||
|
||||
- name: Pre-commit hooks
|
||||
run: |
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
uv run pre-commit run --all-files --show-diff-on-failure
|
||||
Reference in new issue
Block a user