diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 194450a..240ab95 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,6 +15,26 @@ permissions: contents: read jobs: + lint: + name: Lint & Style Check (Ruff) + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install Ruff + run: | + python -m pip install --upgrade pip + pip install "ruff>=0.4.0" + + - name: Run Ruff Lint + run: ruff check . + test: name: Test (${{ matrix.os }}, py${{ matrix.python-version }}) runs-on: ${{ matrix.os }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 51be3f3..7850e9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +- **CI Matrix Hardening (Path A)**: Added a dedicated, fast-failing `lint` job running `ruff check .` on Python 3.12 (`ubuntu-latest`) in `.github/workflows/tests.yml` to enforce static code hygiene in CI. +- **Contract Testing Expansion**: Extended `tests/test_repository_hygiene.py` with `test_llms_txt_contract` (validating canonical repository, ethical boundaries, license, and verification anchors in `llms.txt`) and `test_ruff_linter_contract` (validating tool configuration and clean codebase linting), bringing test suite coverage to 108 passed tests. +- **Documentation & Verification**: Synchronized test pass badges (`108 passed, 1 skipped`) across `README.md`, `README_de.md`, and `llms.txt` with `Last-checked: 2026-11-03`. + ## 2026-09-10 - **CI Matrix Hardening (Path A)**: Upgraded `.github/workflows/tests.yml` to official `@v4`/`@v5` GitHub Actions, added cross-platform testing on Ubuntu and Windows across Python 3.10–3.13, configured job concurrency with `cancel-in-progress: true`, and added bytecode validation (`compileall`) and CLI smoke verification steps. diff --git a/README.md b/README.md index 5fb7de7..0339411 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![CI](https://github.com/dev-bricks/ApiProber/actions/workflows/tests.yml/badge.svg)](https://github.com/dev-bricks/ApiProber/actions/workflows/tests.yml) [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/) -[![Pytest 106 passed, 1 skipped](https://img.shields.io/badge/pytest-106_passed%2C_1_skipped-brightgreen.svg)](https://docs.pytest.org/) +[![Pytest 108 passed, 1 skipped](https://img.shields.io/badge/pytest-108_passed%2C_1_skipped-brightgreen.svg)](https://docs.pytest.org/) [![Zero Dependencies](https://img.shields.io/badge/dependencies-zero-success.svg)]() [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![LLM-Ready](https://img.shields.io/badge/LLM--Ready-llms.txt-success.svg)](llms.txt) diff --git a/README_de.md b/README_de.md index 106a876..841fbe6 100644 --- a/README_de.md +++ b/README_de.md @@ -10,7 +10,7 @@ [![CI](https://github.com/dev-bricks/ApiProber/actions/workflows/tests.yml/badge.svg)](https://github.com/dev-bricks/ApiProber/actions/workflows/tests.yml) [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/) -[![Pytest 106 bestanden, 1 übersprungen](https://img.shields.io/badge/pytest-106_bestanden%2C_1_%C3%BCbersprungen-brightgreen.svg)](https://docs.pytest.org/) +[![Pytest 108 bestanden, 1 übersprungen](https://img.shields.io/badge/pytest-108_bestanden%2C_1_%C3%BCbersprungen-brightgreen.svg)](https://docs.pytest.org/) [![Zero Dependencies](https://img.shields.io/badge/Abh%C3%A4ngigkeiten-keine-success.svg)]() [![Lizenz: MIT](https://img.shields.io/badge/Lizenz-MIT-yellow.svg)](LICENSE) [![LLM-Ready](https://img.shields.io/badge/LLM--Ready-llms.txt-success.svg)](llms.txt) diff --git a/llms.txt b/llms.txt index bb3dfbb..d73e389 100644 --- a/llms.txt +++ b/llms.txt @@ -77,6 +77,6 @@ ApiProber is not Cloudprober, probe-rs, an uptime monitor, a hardware debug probe, or a semantic code-search engine. It is a local Python CLI for documenting authorized REST API surfaces with read-only probing and SQLite persistence. -Verified locally on 2026-09-10: 100 passed, 1 skipped. +Verified locally on 2026-11-03: 108 passed, 1 skipped. -## Last-checked: 2026-09-10 +## Last-checked: 2026-11-03 diff --git a/tests/test_repository_hygiene.py b/tests/test_repository_hygiene.py index 5ece45f..e12ecbd 100644 --- a/tests/test_repository_hygiene.py +++ b/tests/test_repository_hygiene.py @@ -2,6 +2,8 @@ import json from pathlib import Path import re +import subprocess +import sys REPO_ROOT = Path(__file__).resolve().parent.parent @@ -63,6 +65,7 @@ def test_ci_matrix_coverage(): assert "actions/setup-python@v5" in content assert "python -m compileall -q ." in content assert "pytest -ra -v" in content + assert "ruff check ." in content def test_gitignore_protection(): @@ -205,3 +208,34 @@ def test_pep621_license_files_and_keywords(): raw_keywords = [k.strip(' \n\t"') for k in match.group(1).split(",") if k.strip(' \n\t"')] assert len(raw_keywords) >= 15, f"Expected >= 15 keywords, found {len(raw_keywords)}" + +def test_llms_txt_contract(): + """Verify llms.txt exists and specifies boundaries, repository, and verification commands.""" + llms_path = REPO_ROOT / "llms.txt" + assert llms_path.exists(), "llms.txt must exist" + + content = llms_path.read_text(encoding="utf-8") + assert "Canonical repository: https://github.com/dev-bricks/ApiProber" in content + assert "Owner organization: dev-bricks" in content + assert "License: MIT" in content + assert "standard library only" in content + assert "test_smoke.py" in content + assert "python -m compileall -q ." in content + assert "Last-checked: 2026-11-03" in content + assert "Verified locally on 2026-11-03:" in content + + +def test_ruff_linter_contract(): + """Verify ruff linter configuration in pyproject.toml and clean static analysis.""" + pyproject_text = (REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8") + assert "[tool.ruff]" in pyproject_text + assert "[tool.ruff.lint]" in pyproject_text + assert "line-length = 100" in pyproject_text + + result = subprocess.run( + [sys.executable, "-m", "ruff", "check", str(REPO_ROOT)], + capture_output=True, + text=True, + encoding="utf-8", + ) + assert result.returncode == 0, f"Ruff linting failed: {result.stdout}\n{result.stderr}"