Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # history.json replays every data commit
- uses: actions/setup-python@v5
with:
python-version: "3.12"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ coverage.xml

# Generated site catalog (rebuilt in CI)
site/catalog.json
site/history.json

# Local GitHub setup helpers (not part of the catalog)
.github-setup/
Expand Down
19 changes: 19 additions & 0 deletions site/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,28 @@
from __future__ import annotations

import json
import subprocess
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
DATA = ROOT / "data" / "cpu"
OUT = Path(__file__).resolve().parent / "catalog.json"
HISTORY = Path(__file__).resolve().parent / "history.json"


def git(*args: str) -> str:
return subprocess.run(["git", *args], cwd=ROOT, check=True, capture_output=True, text=True).stdout


def build_history() -> list[dict]:
"""Record count after every commit that touched data/cpu (needs full clone)."""
points = []
for line in git("log", "--reverse", "--format=%H %cI", "--", "data/cpu").splitlines():
sha, date = line.split(" ", 1)
names = git("ls-tree", "-r", "--name-only", sha, "--", "data/cpu").splitlines()
points.append({"sha": sha, "date": date, "count": sum(n.endswith(".json") for n in names)})
return points


def main() -> int:
Expand All @@ -34,6 +50,9 @@ def main() -> int:
)
OUT.write_text(json.dumps(records, indent=2) + "\n", encoding="utf-8")
print(f"wrote {OUT} ({len(records)} ES records)")
history = build_history()
HISTORY.write_text(json.dumps({"points": history}, indent=2) + "\n", encoding="utf-8")
print(f"wrote {HISTORY} ({len(history)} points)")
return 0


Expand Down
Loading