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
9 changes: 5 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
workflow_dispatch:
inputs:
source_runs:
description: "Completed CI run IDs, separated by spaces; later runs replace entries (empty = republish)"
description: "Completed CI run IDs, separated by spaces; later runs replace entries (empty = redeploy the latest release)"
required: false
default: ""
release_tag:
description: "New benchmark-* tag when releasing; otherwise existing tag or empty for latest"
description: "New release tag vX.Y.Z (needed with source_runs)"
required: false
default: ""

Expand Down Expand Up @@ -57,11 +57,12 @@ jobs:
SOURCE_RUNS: ${{ inputs.source_runs }}
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
python matchmaker_eval/release_results.py --source-runs "$SOURCE_RUNS" --tag "$RELEASE_TAG"
python matchmaker_eval/release_results.py --source-runs "$SOURCE_RUNS" --tag "$RELEASE_TAG" \
--versions-dir "$RUNNER_TEMP/benchmark-versions"

- name: Assemble the site
if: steps.results.outputs.ready == 'true'
run: python matchmaker_eval/build_site.py _site
run: python matchmaker_eval/build_site.py _site --versions "$RUNNER_TEMP/benchmark-versions"

- uses: actions/configure-pages@v5
if: steps.results.outputs.ready == 'true'
Expand Down
78 changes: 77 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,24 @@
color: var(--ink-soft);
}

/* ── Result versions ──────────────────────────────────────────────────── */
.versions {
display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
font-size: 13px; color: var(--ink-soft);
}
.versions select {
font-family: var(--ui); font-size: 13px; color: var(--ink);
background: var(--surface); border: 1px solid var(--rule-firm);
border-radius: 2px; padding: 5px 9px; max-width: 100%;
}
.versions a { color: var(--ink-soft); text-underline-offset: 2px; }
.version-note {
border-left: 3px solid var(--warn); background: var(--surface);
padding: 8px 12px; font-size: 13px; color: var(--ink-soft);
}
.version-note b { color: var(--ink); font-weight: 500; }
.version-note a { color: var(--ink); text-underline-offset: 2px; }

/* ── Controls ─────────────────────────────────────────────────────────── */
.controls {
display: flex;
Expand Down Expand Up @@ -558,6 +576,12 @@ <h1>Matchmaker Benchmark</h1>
</p>
<div class="staff" role="presentation"></div>
<div class="provenance" id="provenance"></div>
<div class="versions" id="versions" hidden>
<label for="version-select">Results version</label>
<select id="version-select"></select>
<a id="version-release" href="#">release files</a>
</div>
<p class="version-note" id="version-note" hidden></p>
</header>

<div class="controls">
Expand Down Expand Up @@ -1147,7 +1171,10 @@ <h2>Submitting</h2>
container.innerHTML = '<p class="plot-hint">Loading the full record…</p>';
const detail = await loadDetail(entry);
if (!detail) {
container.innerHTML = '<p class="plot-hint">Per-piece results are not published for this entry.</p>';
container.innerHTML = tablesOnly
? `<p class="plot-hint">This older version is shown with its tables only. Per-piece results
are in its <a href="${escapeHtml(tablesOnly)}">release files</a>.</p>`
: '<p class="plot-hint">Per-piece results are not published for this entry.</p>';
return;
}

Expand Down Expand Up @@ -1499,6 +1526,55 @@ <h2>Submitting</h2>
return null;
}

// Published result versions: the latest release at the root, every release
// under versions/<tag>/, listed newest first in versions.json at the root.
// Without that file (a local checkout) the menu stays hidden.
const IN_VERSION = /\/versions\/v\d+\.\d+\.\d+\/(?:index\.html)?$/.test(location.pathname);
const SITE_ROOT = IN_VERSION ? "../../" : "./";

async function fetchJson(url) {
try {
const response = await fetch(url);
return response.ok ? await response.json() : null;
} catch (error) { return null; }
}

// This version's release URL when it is shown with its tables only.
let tablesOnly = null;

async function showVersions() {
const [index, release] = await Promise.all([
fetchJson(SITE_ROOT + "versions.json"), fetchJson("./release.json"),
]);
const versions = (index && index.versions) || [];
const current = release && versions.find((v) => v.tag === release.tag);
if (!current) return;
const newest = versions[0];
const date = (v) => v.published_at.slice(0, 10);
const select = el("version-select");
select.innerHTML = versions.map((v) => `<option value="${escapeHtml(v.tag)}"
${v === current ? "selected" : ""}>${escapeHtml(v.tag)} · ${escapeHtml(date(v))}${v === newest ? " (latest)" : ""}</option>`).join("");
select.addEventListener("change", () => {
location.href = SITE_ROOT + (select.value === newest.tag ? "" : `versions/${select.value}/`);
});
el("version-release").href = current.url;
if (!current.full) tablesOnly = current.url;
el("versions").hidden = false;

const note = el("version-note");
if (current !== newest) {
note.innerHTML = `You are viewing <b>${escapeHtml(current.tag)}</b>, published ${escapeHtml(date(current))}.
Newer results exist: <a href="${SITE_ROOT}">see the latest version (${escapeHtml(newest.tag)})</a>.${
tablesOnly ? " Per-piece plots for this version are in its release files." : ""}`;
} else {
const permanent = new URL(`versions/${current.tag}/`, new URL(SITE_ROOT, location.href)).href;
note.innerHTML = `To cite these exact numbers, link this version: <a href="${escapeHtml(permanent)}">${escapeHtml(permanent)}</a>`;
note.style.borderLeftColor = "var(--accent)";
}
note.hidden = false;
}
showVersions();

loadBoard().then((board) => {
if (!board) {
const empty = el("empty");
Expand Down
26 changes: 24 additions & 2 deletions docs/maintaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ published. `evaluate.yml` runs from `submissions`, so fast-forward it to
- `source_runs`: the completed run IDs, separated by spaces. Later listed
runs replace earlier entries for the same method. Entries not listed are
carried over from the latest release.
- `release_tag`: a new `benchmark-*` tag. Leave `source_runs` empty to
redeploy that release, or both empty to redeploy the latest one.
- `release_tag`: a new version `vMAJOR.MINOR.PATCH` (see "Older result
versions" below). Leave both empty to redeploy the latest release.

The workflow attaches the selected artifacts and a `benchmark-snapshot.zip`
for the site to the release, then deploys it. Actions artifacts
Expand Down Expand Up @@ -492,6 +492,28 @@ somewhere else.
files, CSVs and details of a release snapshot, and deploys it to GitHub Pages.
Documentation changes redeploy the latest release.

### Older result versions

Result releases are numbered `vMAJOR.MINOR.PATCH`:

- **major**: a new evaluation key, e.g. changed scoring, data or matchmaker version
- **minor**: new entries under the same key
- **patch**: a fix to already published entries

Every deployment serves the latest release at the root and every release at
`versions/<tag>/`, e.g.
`https://pymatchmaker.github.io/matchmaker_benchmark/versions/v1.0.0/`, with a
**Results version** menu on the page. Link a paper to its `versions/<tag>/`
address so readers see exactly the numbers it cites. Each version is shown with
the current page code.

Per-piece views take almost all of a version's space (about 25–30 MB, against
under 1 MB for its tables), and GitHub Pages allows 1 GB. So only the newest
releases (`NEWEST_FULL_VERSIONS`) and pinned ones (`PINNED_FULL_VERSIONS`, e.g.
the release a paper cites) keep them, both in `matchmaker_eval/build_site.py`.
Other versions show their tables, and their per-piece results stay in the
release files.

### What the site can show

`results/leaderboard.json` is the index: one row per entry, small enough to load
Expand Down
61 changes: 52 additions & 9 deletions matchmaker_eval/build_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

python matchmaker_eval/build_site.py _site # what Pages publishes
python matchmaker_eval/build_site.py --serve # ...and open it locally
python matchmaker_eval/build_site.py _site --versions DIR # plus versions/<tag>/

The site is ``docs/`` plus what the page reads and links to: the leaderboard
JSON and CSV, the same pair per dataset, and the per-entry detail files. Both
the publish workflow and the staging preview call this, so what you look at
before merging is assembled by the same code as what goes live.

With ``--versions``, every published release is also assembled under
``versions/<tag>/`` (see docs/maintaining.md, "Older result versions").

The page also reads ``../results/`` when it is served from a checkout, so
``--serve`` from the repository root works without assembling anything; the
assembled form is what Pages uploads.
Expand All @@ -23,50 +27,61 @@
sys.path.insert(0, str(_path))

import argparse
import json
import shutil

from matchmaker_eval.folds import REPO_ROOT, RESULTS_DIR

DOCS_DIR = REPO_ROOT / "docs"

#: Releases that keep their per-piece views under versions/: the newest few,
#: plus any pinned ones, such as the release our paper cites.
NEWEST_FULL_VERSIONS = 3
PINNED_FULL_VERSIONS = ("v1.0.0",)


class SiteError(Exception):
"""Raised when the site cannot be assembled."""


def build(destination: Path) -> dict:
"""Copy docs/ and the result files into ``destination``. Returns a summary."""
def build(destination: Path, results_dir: Path = None, details: bool = True) -> dict:
"""Copy docs/ and the result files into ``destination``. Returns a summary.

``details=False`` leaves out the per-piece views, which are almost all of
a version's size; the tables and archived keys are always included.
"""
destination = Path(destination)
results_dir = Path(results_dir or RESULTS_DIR)
if destination.exists():
shutil.rmtree(destination)
if not DOCS_DIR.is_dir():
raise SiteError(f"{DOCS_DIR} is missing.")
shutil.copytree(DOCS_DIR, destination)

summary = {"boards": [], "details": 0, "archives": 0, "missing": []}
for name in ("leaderboard.json", "leaderboard.csv"):
source = RESULTS_DIR / name
for name in ("leaderboard.json", "leaderboard.csv", "release.json"):
source = results_dir / name
if source.exists():
shutil.copy2(source, destination / name)
else:
summary["missing"].append(name)
# leaderboard-<dataset>.json/.csv: the page links to them for download.
for source in sorted(RESULTS_DIR.glob("leaderboard-*.*")):
for source in sorted(results_dir.glob("leaderboard-*.*")):
if source.suffix in (".json", ".csv"):
shutil.copy2(source, destination / source.name)
summary["boards"].append(source.name)

details = RESULTS_DIR / "details"
if details.is_dir():
details_dir = results_dir / "details"
if details and details_dir.is_dir():
target = destination / "details"
target.mkdir(exist_ok=True)
for path in sorted(details.glob("*.json")):
for path in sorted(details_dir.glob("*.json")):
shutil.copy2(path, target / path.name)
summary["details"] += 1

# Every leaderboard ever published under an evaluation key, so a key cited
# in a paper resolves to archive/<key>/leaderboard.json on the site.
archive = RESULTS_DIR / "archive"
archive = results_dir / "archive"
if archive.is_dir():
shutil.copytree(archive, destination / "archive")
summary["archives"] = sum(1 for path in archive.iterdir() if path.is_dir())
Expand All @@ -79,6 +94,22 @@ def build(destination: Path) -> dict:
return summary


def add_versions(destination: Path, versions_dir: Path) -> list:
"""Assemble each release in ``versions_dir/versions.json`` under ``versions/<tag>/``.

The newest ``NEWEST_FULL_VERSIONS`` and the ``PINNED_FULL_VERSIONS`` keep
their per-piece views; the others keep their tables only. The list is also written to ``versions.json``.
"""
destination, versions_dir = Path(destination), Path(versions_dir)
listed = json.loads((versions_dir / "versions.json").read_text())["versions"]
for index, version in enumerate(listed):
version["full"] = index < NEWEST_FULL_VERSIONS or version["tag"] in PINNED_FULL_VERSIONS
build(destination / "versions" / version["tag"], versions_dir / version["tag"],
details=version["full"])
(destination / "versions.json").write_text(json.dumps({"versions": listed}, indent=2) + "\n")
return listed


def serve(directory: Path, port: int) -> None:
import functools
import http.server
Expand Down Expand Up @@ -115,10 +146,18 @@ def main():
help="serve the assembled site over HTTP and keep running",
)
parser.add_argument("--port", type=int, default=8000, help="port for --serve")
parser.add_argument(
"--versions",
type=Path,
default=None,
help="folder of downloaded releases (release_results.py --versions-dir); "
"each is added under versions/<tag>/",
)
args = parser.parse_args()

try:
summary = build(Path(args.destination))
versions = add_versions(Path(args.destination), args.versions) if args.versions else []
except SiteError as e:
print(f"\n{e}", file=sys.stderr)
return 1
Expand All @@ -129,6 +168,10 @@ def main():
f"per-dataset file(s), {summary['details']} detail file(s), "
f"{summary['archives']} archived key(s)"
)
if args.versions:
print(f" {len(versions)} published version(s) under versions/: "
+ (", ".join(v["tag"] + ("" if v["full"] else " (tables only)") for v in versions)
or "none"))
for name in summary["missing"]:
print(f" note: results/{name} was not there")
if args.serve:
Expand Down
Loading
Loading