Add CI on Gitea Actions: pytest and ruff on every PR
.gitea/workflows/ci.yaml runs on PRs into main and on pushes to main. It installs uv, runs `uv sync --locked` with Python 3.12 (the lowest version requires-python allows), then pytest, `ruff check` and `ruff format --check`. ruff is pinned in the dev group (0.17.3). The repo has no ruff config, so the rules are ruff's defaults for that version; pinning makes CI and local runs check the same rules. The setup follows the workflow that already runs green on this Gitea instance (ubuntu-latest, pinned checkout SHA, uv via the official script). The README gets a CI badge and the lint commands. Closes #11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #22.
This commit is contained in:
1 parent
ec35a4c996
commit
8c2b48a04c
4 files changed
+84
-1
No files matched your search
@@ -0,0 +1,50 @@
|
||||
name: CI
|
||||
|
||||
# Tests and lint for every PR into main, and a status for each commit on main.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
# Reads the repository only.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# A newer push to the same ref makes an in-flight run obsolete.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: pytest and ruff
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
|
||||
# Same uv as local development; the official script keeps the job free of
|
||||
# third-party actions beyond checkout.
|
||||
- name: Install uv
|
||||
run: |
|
||||
curl -LsSf https://astral.sh/uv/0.13.6/install.sh | sh
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
|
||||
# --locked: fail if uv.lock does not match pyproject.toml. Python 3.12 is the
|
||||
# lowest version requires-python allows.
|
||||
- name: Install dependencies
|
||||
run: uv sync --locked --python 3.12
|
||||
|
||||
# The tests mock cv4pve-cli: no binary and no cluster access needed.
|
||||
- name: Tests
|
||||
run: uv run pytest -q
|
||||
|
||||
# ruff is pinned in the dev group, so CI checks the same rules as local runs
|
||||
# (no config file: ruff's own defaults for that version).
|
||||
- name: Lint
|
||||
run: uv run ruff check src tests
|
||||
|
||||
- name: Format
|
||||
run: uv run ruff format --check src tests
|
||||
Reference in new issue
Block a user