4 Commits
Author SHA1 Message Date
noah 418c2c3502 Merge pull request 'Hand the toolkit benchmarks to the toolkit site; honest README badges' (#1) from toolkit-own-pages into main
main-site-gate / validate-and-release (push) Successful in 21s
2026-11-03 10:34:49 -07:00
noahandClaude Opus 5.5 35b96c493f Hand the toolkit benchmarks to the toolkit's own site
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>
2026-11-03 11:03:55 -06:00
noah a2ef500560 Gate benchmark releases on live Pages privacy
next-site-candidate / validate-and-candidate (push) Successful in 5s
main-site-gate / validate-and-release (push) Successful in 10s
2026-10-17 03:04:38 -06:00
noah 35c38eaf89 Tighten public benchmark repository guide
main-site-gate / validate-and-release (push) Successful in 31s
next-site-candidate / validate-and-candidate (push) Successful in 5s
2026-10-17 01:26:10 -06:00
6 changed files with 106 additions and 41 deletions
+2
View File
@@ -21,6 +21,8 @@ jobs:
run: python3 -m unittest discover -s ci -p 'test_*.py'
- name: Validate published Pages snapshot
run: python3 ci/check_published.py
- name: Verify live Pages and source isolation
run: python3 ci/check_live_pages.py
- name: Publish measured repository badges
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+15 -29
View File
@@ -1,41 +1,27 @@
# Alkane benchmarks
[![CI main](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/main.svg)](https://gitea.bluefla.re/blueflare/alkane-benchmarks/actions)
[![CI next](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/next.svg)](https://gitea.bluefla.re/blueflare/alkane-benchmarks/actions)
![tests](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/badges/tests.svg)
![coverage](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/badges/coverage.svg)
![bench](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/badges/bench.svg)
![bench coverage](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/badges/bench-coverage.svg)
![lines of code](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/badges/loc.svg)
![dependencies](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/badges/dependencies.svg)
![code quality](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/badges/quality.svg)
[![CI](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/main.svg)](https://gitea.bluefla.re/blueflare/alkane-benchmarks/actions)
![license](https://gitea.bluefla.re/blueflare/alkane-benchmarks/raw/branch/ci-badges/badges/license.svg)
Public, generated microbenchmark history for Alkane SDK, OS, and Toolkit.
Public [benchmark history](https://blueflare.gitea.bluefla.re/alkane-benchmarks/)
for the Alkane SDK and OS, whose source repositories are private. Publishers
copy measured host data after CI. These results do not measure miner boards
or qualify a release.
[View the benchmark site](https://blueflare.gitea.bluefla.re/alkane-benchmarks/).
No Gitea login is required. The `gh-pages` branch contains only static pages.
The source repositories remain private; their main CI workflows update the
respective site paths after measurement.
The toolkit is public and publishes its own benchmarks, badges and quality
dashboard at <https://blueflare.gitea.bluefla.re/alkane-toolkit/>.
These are host microbenchmarks. They do not show miner board performance or release qualification.
The site repository has no microbenchmarks of its own, so its bench and bench
coverage badges read `n/a`. Its coverage badge measures executed statement
lines in the site validator and version selector under the guard tests.
This repository holds only the site validator and publishing scripts, so it
shows no test, coverage or size badges: those would describe the scripts, not
the SDK or OS.
## Branches
`main` validates the public Pages snapshot and runs the site guard tests.
`next` validates the snapshot before making a release candidate. The
`gh-pages` branch contains generated output only. Neither workflow copies
source repositories into Pages.
CI creates `vX.Y.Z` releases from passing `main` runs and `-rc.N` releases
from passing `next` runs. Edit `ci/version-x.txt` to change X. Changes to
the site validator increment Y; documentation and CI fixes increment Z.
The release tags identify site configuration, while benchmark measurements
continue to update on `gh-pages`.
`main` runs the site guards and publishes `vX.Y.Z` releases. `next` checks
the snapshot and publishes `-rc.N` candidates. `gh-pages` holds generated
pages only. Edit `ci/version-x.txt` to change X.
Validator changes increment Y; documentation and CI changes increment Z.
## License
The site layout is [MIT licensed](LICENSE). Benchmark measurements are factual data from CI.
The site layout is [MIT licensed](LICENSE).
+57
View File
@@ -0,0 +1,57 @@
#!/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())
+16 -3
View File
@@ -68,6 +68,18 @@ def svg(label: str, value: str, color: str) -> bytes:
f'font-family="sans-serif" font-size="11">{value}</text></svg>\n').encode()
# Same bands as the toolkit's quality grade: coverage sets the grade.
GRADE_BANDS = ((80.0, "A", "#2ea043"), (60.0, "B", "#7cb342"), (40.0, "C", "#d4a72c"),
(20.0, "D", "#e16f24"))
def grade(coverage: float) -> tuple[str, str]:
for floor, letter, color in GRADE_BANDS:
if coverage >= floor:
return letter, color
return "F", "#cf222e"
def generate() -> tuple[dict[str, bytes], dict]:
tests, coverage = tests_and_coverage()
sources = list((ROOT / "ci").glob("*.py"))
@@ -76,14 +88,15 @@ def generate() -> tuple[dict[str, bytes], dict]:
if line.strip() and not line.lstrip().startswith("#"))
if "MIT License" not in (ROOT / "LICENSE").read_text():
raise RuntimeError("site license is not MIT")
letter, color = grade(coverage)
values = {
"tests": (str(tests), "#2ea043"),
"coverage": (f"{coverage:.1f}%", "#2ea043"),
"coverage": (f"{coverage:.1f}%", color),
"bench": ("n/a", "#777"),
"bench-coverage": ("n/a", "#777"),
"loc": (compact_lines(lines), "#0969da"),
"dependencies": ("0", "#2ea043"),
"quality": ("A", "#2ea043"),
"quality": (letter, color),
"license": ("MIT", "#0969da"),
}
labels = {"bench-coverage": "bench coverage", "loc": "LOC",
@@ -94,7 +107,7 @@ def generate() -> tuple[dict[str, bytes], dict]:
"statement_coverage_percent": round(coverage, 1),
"source_lines": lines, "dependencies": 0,
"benchmarks": None, "benchmark_coverage_percent": None,
"quality": "A", "license": "MIT"}
"quality": letter, "license": "MIT"}
return badges, metrics
+10 -5
View File
@@ -12,7 +12,7 @@ from validate_site import validate
INDEX = """<!doctype html><html><head><title>Alkane benchmarks</title></head>
<body><h1>Alkane benchmarks</h1><a href="sdk/">SDK</a>
<a href="os/">OS</a><a href="toolkit/">Toolkit</a></body></html>"""
<a href="os/">OS</a></body></html>"""
PAGE = """<!doctype html><html><head><title>Alkane benchmarks</title></head>
<body><h1>Alkane benchmarks</h1><table><tr><td>10 ns/op</td></tr></table></body></html>"""
@@ -23,7 +23,7 @@ class SiteValidationTests(unittest.TestCase):
self.addCleanup(self.temp.cleanup)
self.root = Path(self.temp.name)
(self.root / "index.html").write_text(INDEX)
for repo in ("sdk", "os", "toolkit"):
for repo in ("sdk", "os"):
(self.root / repo).mkdir()
(self.root / repo / "index.html").write_text(PAGE)
@@ -60,12 +60,17 @@ class SiteValidationTests(unittest.TestCase):
)
self.assertTrue(any("external or active reference" in error for error in validate(self.root)))
def test_allows_link_to_toolkit_site(self):
(self.root / "index.html").write_text(INDEX.replace(
"</body>", '<a href="https://blueflare.gitea.bluefla.re/alkane-toolkit/bench/">Toolkit</a></body>'))
self.assertEqual(validate(self.root), [])
def test_rejects_extra_files(self):
(self.root / "source.tar.gz").write_bytes(b"private source")
self.assertTrue(any("unexpected published files" in error for error in validate(self.root)))
def test_requires_all_three_reports(self):
(self.root / "toolkit/index.html").unlink()
def test_requires_both_reports(self):
(self.root / "os/index.html").unlink()
self.assertTrue(any("missing regular page" in error for error in validate(self.root)))
def test_rejects_css_import(self):
@@ -103,7 +108,7 @@ class SiteValidationTests(unittest.TestCase):
self.assertTrue(any("contains a symlink" in error for error in validate(self.root)))
def test_requires_index_navigation(self):
(self.root / "index.html").write_text(INDEX.replace('<a href="toolkit/">Toolkit</a>', ""))
(self.root / "index.html").write_text(INDEX.replace('<a href="os/">OS</a>', ""))
self.assertTrue(any("missing project links" in error for error in validate(self.root)))
def test_requires_measurements_or_pending_notice(self):
+6 -4
View File
@@ -7,13 +7,15 @@ from pathlib import Path
import re
PAGES = ("index.html", "sdk/index.html", "os/index.html", "toolkit/index.html")
PAGES = ("index.html", "sdk/index.html", "os/index.html")
# The toolkit is public and publishes its own site; the index links to it.
TOOLKIT_SITE = "https://blueflare.gitea.bluefla.re/alkane-toolkit/bench/"
ALLOWED_TAGS = {"html", "head", "meta", "title", "style", "body", "h1",
"p", "a", "ul", "li", "div", "small", "table", "thead",
"tbody", "tr", "th", "td"}
ALLOWED_ATTRIBUTES = {"html": {"lang"}, "a": {"href"},
"div": {"class"}, "th": {"scope"}}
LOCAL_LINKS = {"sdk/", "os/", "toolkit/", "../"}
LOCAL_LINKS = {"sdk/", "os/", "../", TOOLKIT_SITE}
FORBIDDEN_TEXT = ("BEGIN PRIVATE KEY", "GITEA_TOKEN", "ghp_", "glpat-")
COMMIT_LINK = re.compile(
r"https://gitea\.bluefla\.re/blueflare/alkane-(?:sdk|os|toolkit)/commit/[0-9a-f]{40}"
@@ -86,7 +88,7 @@ def validate_page(path: Path, relative: str) -> list[str]:
if re.search(r"url\s*\(|@import", text, re.IGNORECASE):
errors.append(f"{relative}: external CSS reference is not allowed")
if relative == "index.html":
if not {"sdk/", "os/", "toolkit/"}.issubset(parser.links):
if not {"sdk/", "os/"}.issubset(parser.links):
errors.append("index.html: missing project links")
elif not parser.tables and "Waiting for a completed measured CI run." not in text:
errors.append(f"{relative}: no measurements or pending notice")
@@ -111,7 +113,7 @@ def validate(root: Path) -> list[str]:
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("site", type=Path)
parser.add_argument("--page", choices=("sdk", "os", "toolkit"),
parser.add_argument("--page", choices=("sdk", "os"),
help="validate one generated report before publication")
args = parser.parse_args()
errors = (validate_page(args.site, f"{args.page}/index.html")