- .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>
60 lines
1.4 KiB
YAML
60 lines
1.4 KiB
YAML
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
|
|
uses: lycheeverse/lychee-action@v2
|
|
with:
|
|
args: --verbose --no-progress --max-concurrency 4 './**/*.md'
|
|
fail: false
|
|
continue-on-error: true
|