The toolkit repository is public and now publishes its own Pages site (benchmarks, badges, quality dashboard), so this site covers only the private SDK and OS. - validate_site: drop the toolkit page; the index may link to the toolkit's bench page. - check_live_pages: /alkane-toolkit/ and its bench page must be public; only the SDK and OS sites must stay closed. - metrics: grade coverage on the toolkit's bands instead of a fixed green A. - README: one CI badge plus the license; the script metrics no longer pose as SDK or OS metrics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
1.6 KiB
Python
58 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: MIT
|
|
"""Check that benchmark Pages are public and private source repositories stay closed.
|
|
|
|
The toolkit repository is public and serves its own site, benchmarks included.
|
|
"""
|
|
|
|
from urllib.error import HTTPError, URLError
|
|
from urllib.request import HTTPRedirectHandler, Request, build_opener
|
|
|
|
|
|
BASE = "https://blueflare.gitea.bluefla.re"
|
|
PUBLIC = (
|
|
"/alkane-benchmarks/",
|
|
"/alkane-benchmarks/sdk/",
|
|
"/alkane-benchmarks/os/",
|
|
"/alkane-toolkit/",
|
|
"/alkane-toolkit/bench/",
|
|
)
|
|
PRIVATE = ("/alkane-sdk/", "/alkane-os/")
|
|
|
|
|
|
class NoRedirect(HTTPRedirectHandler):
|
|
def redirect_request(self, request, response, code, message, headers, url):
|
|
return None
|
|
|
|
|
|
def status(opener, path: str) -> int:
|
|
request = Request(BASE + path, headers={"User-Agent": "alkane-pages-gate/1"})
|
|
try:
|
|
with opener.open(request, timeout=15) as response:
|
|
return response.status
|
|
except HTTPError as error:
|
|
return error.code
|
|
|
|
|
|
def main() -> int:
|
|
opener = build_opener(NoRedirect)
|
|
failed = False
|
|
for path in PUBLIC + PRIVATE:
|
|
expected = 200 if path in PUBLIC else 404
|
|
try:
|
|
actual = status(opener, path)
|
|
except URLError as error:
|
|
print(f"FAIL {path}: {error.reason}")
|
|
failed = True
|
|
continue
|
|
if actual != expected:
|
|
print(f"FAIL {path}: HTTP {actual}; expected {expected}")
|
|
failed = True
|
|
else:
|
|
print(f"PASS {path}: HTTP {actual}")
|
|
return int(failed)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|