mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-28 16:52:22 +01:00
ci: make Python validation authoritative (#5940)
Co-authored-by: Alexandre Teixeira <111787685+alteixeira20@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexandre Teixeira
parent
e0615cda47
commit
937c883c41
@@ -2,7 +2,7 @@ name: CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main, dev]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
# Least privilege: none of the jobs write to the repo.
|
# Least privilege: none of the jobs write to the repo.
|
||||||
@@ -103,10 +103,7 @@ jobs:
|
|||||||
python-tests:
|
python-tests:
|
||||||
name: Python tests (pytest)
|
name: Python tests (pytest)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Informational for now: the suite has known flaky / environment-dependent
|
# Make Python test validation authoritative for the configured scope.
|
||||||
# failures (test isolation + embedding-model assertions). Tracked under the
|
|
||||||
# ROADMAP "fresh install smoke tests" item; make this required once green.
|
|
||||||
continue-on-error: true
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
"""Regression coverage for authoritative Python CI validation."""
|
||||||
|
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
_WORKFLOW = (
|
||||||
|
Path(__file__).resolve().parent.parent / ".github" / "workflows" / "ci.yml"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _indented_block(text: str, heading: str, indent: int) -> str:
|
||||||
|
pattern = re.compile(
|
||||||
|
rf"(?ms)^{' ' * indent}{re.escape(heading)}:\n"
|
||||||
|
rf"(?P<body>(?:(?:{' ' * (indent + 2)}.*|\s*)\n)*)"
|
||||||
|
)
|
||||||
|
match = pattern.search(text)
|
||||||
|
assert match is not None, f"missing {heading!r} block"
|
||||||
|
return match.group(0)
|
||||||
|
|
||||||
|
|
||||||
|
def test_ci_runs_on_integrated_dev_pushes():
|
||||||
|
workflow = _WORKFLOW.read_text()
|
||||||
|
push = _indented_block(workflow, "push", 2)
|
||||||
|
|
||||||
|
assert re.search(r"(?m)^ branches:\s*\[main,\s*dev\]\s*$", push)
|
||||||
|
assert "paths-ignore:" not in push
|
||||||
|
|
||||||
|
|
||||||
|
def test_python_tests_are_authoritative():
|
||||||
|
workflow = _WORKFLOW.read_text()
|
||||||
|
python_tests = _indented_block(workflow, "python-tests", 2)
|
||||||
|
|
||||||
|
assert "python -m pytest -q" in python_tests
|
||||||
|
assert "continue-on-error:" not in python_tests
|
||||||
Reference in New Issue
Block a user