ci: add Forgejo Actions workflow with ruff, pytest, JSON + link checks
- .forgejo/workflows/ci.yml: four jobs (lint, test, validate-json,
markdown-links) running on push to main and on pull requests
- pyproject.toml: project metadata, flask dep, dev extras (ruff, pytest),
ruff config (E/F/I/W/B/UP rulesets, 100-char lines, py311 target),
pytest config (pythonpath=webinstaller so tests can import drives)
- tests/test_drives.py: 11 unit tests covering parse_size_gb (TB/GB/MB,
European comma decimal, empty input, unknown units), drive type
scoring (nvme/ssd/hdd), size scoring bands, and score_device summing
- .gitignore: ignore .pytest_cache, *.egg-info, .ruff_cache
- webinstaller/drives.py: refactor subprocess.run to capture_output
kwarg (ruff UP022) — drops four lines, same behavior
- webinstaller/app.py: ruff-sorted imports (isort)
All checks pass locally: ruff check + format, pytest 11/11, JSON valid.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 20:24:05 +02:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches: [main]
|
|
|
|
|
tags: ['**']
|
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
lint:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
|
with:
|
|
|
|
|
python-version: '3.11'
|
|
|
|
|
- name: Install ruff
|
|
|
|
|
run: pip install ruff
|
|
|
|
|
- name: Lint
|
|
|
|
|
run: ruff check .
|
|
|
|
|
- name: Format check
|
|
|
|
|
run: ruff format --check .
|
|
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
|
with:
|
|
|
|
|
python-version: '3.11'
|
|
|
|
|
- name: Install project with dev extras
|
|
|
|
|
run: pip install -e ".[dev]"
|
|
|
|
|
- name: Run pytest
|
|
|
|
|
run: pytest -v
|
|
|
|
|
|
|
|
|
|
validate-json:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
|
with:
|
|
|
|
|
python-version: '3.11'
|
|
|
|
|
- name: Validate all JSON files
|
|
|
|
|
run: |
|
|
|
|
|
set -e
|
|
|
|
|
for f in $(find . -name '*.json' -not -path './.venv/*' -not -path './node_modules/*'); do
|
|
|
|
|
echo "Validating $f"
|
|
|
|
|
python -m json.tool "$f" > /dev/null
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
markdown-links:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
- name: Check markdown links
|
2026-04-14 18:37:54 +02:00
|
|
|
# Fully-qualified URL because forgejo's default action mirror
|
|
|
|
|
# (data.forgejo.org) doesn't carry lycheeverse/lychee-action.
|
|
|
|
|
uses: https://github.com/lycheeverse/lychee-action@v2
|
ci: add Forgejo Actions workflow with ruff, pytest, JSON + link checks
- .forgejo/workflows/ci.yml: four jobs (lint, test, validate-json,
markdown-links) running on push to main and on pull requests
- pyproject.toml: project metadata, flask dep, dev extras (ruff, pytest),
ruff config (E/F/I/W/B/UP rulesets, 100-char lines, py311 target),
pytest config (pythonpath=webinstaller so tests can import drives)
- tests/test_drives.py: 11 unit tests covering parse_size_gb (TB/GB/MB,
European comma decimal, empty input, unknown units), drive type
scoring (nvme/ssd/hdd), size scoring bands, and score_device summing
- .gitignore: ignore .pytest_cache, *.egg-info, .ruff_cache
- webinstaller/drives.py: refactor subprocess.run to capture_output
kwarg (ruff UP022) — drops four lines, same behavior
- webinstaller/app.py: ruff-sorted imports (isort)
All checks pass locally: ruff check + format, pytest 11/11, JSON valid.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 20:24:05 +02:00
|
|
|
with:
|
|
|
|
|
args: --verbose --no-progress --max-concurrency 4 './**/*.md'
|
|
|
|
|
fail: false
|
|
|
|
|
continue-on-error: true
|