25 lines
873 B
Python
25 lines
873 B
Python
from __future__ import annotations
|
|
|
|
import re
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
class CiContractTests(unittest.TestCase):
|
|
def test_ci_is_one_dependency_free_lite_gate(self) -> None:
|
|
workflow = (ROOT / ".gitea/workflows/ci.yml").read_text(encoding="utf-8")
|
|
jobs = workflow.split("jobs:", 1)[1]
|
|
self.assertEqual(re.findall(r"(?m)^ ([a-z][a-z0-9_-]*):\s*$", jobs), ["lite"])
|
|
self.assertIn("actions/checkout@524e936cd9e579adf00e308bfdf971aebc7de09e", workflow)
|
|
self.assertIn("persist-credentials: false", workflow)
|
|
self.assertIn("python3 tests/governance/test_module_spec.py", workflow)
|
|
for forbidden in ("setup-python", "pip ", "curl ", "wget ", "docker pull"):
|
|
self.assertNotIn(forbidden, workflow)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|