From 4ce59a0ccf0f4f6eef4c3b1c6df0a941a4b83a36 Mon Sep 17 00:00:00 2001 From: ZhouGuangyuan Date: Thu, 23 Jul 2026 19:57:59 +0800 Subject: [PATCH 1/4] ci: publish built binaries with run history --- .github/workflows/llgo-binary-size.yml | 61 ++++++++++++++++++++++++++ ci/llgo-size/README.md | 5 +++ ci/llgo-size/publish.sh | 2 + ci/llgo-size/report.sh | 2 + ci/llgo-size/site/app.js | 9 +++- ci/llgo-size/site/index.html | 6 +-- ci/llgo-size/site/style.css | 2 +- docs/llgo-binary-size-handoff.md | 2 + 8 files changed, 84 insertions(+), 5 deletions(-) diff --git a/.github/workflows/llgo-binary-size.yml b/.github/workflows/llgo-binary-size.yml index 0a180ce..210bfed 100644 --- a/.github/workflows/llgo-binary-size.yml +++ b/.github/workflows/llgo-binary-size.yml @@ -239,6 +239,67 @@ jobs: ) time_command "Generate binary-size report" \ bash -c 'set -o pipefail; ci/llgo-size/report.sh .ci/bent-run | tee -a "$GITHUB_STEP_SUMMARY"' + + - name: Package built binaries + run: | + set -euo pipefail + artifact_dir="$GITHUB_WORKSPACE/.ci/binary-artifact" + rm -rf "$artifact_dir" + mkdir -p "$artifact_dir/llgo" "$artifact_dir/benchmarks" + install -m 0755 .ci/llgo/llgo "$artifact_dir/llgo/llgo" + install -m 0755 \ + .ci/llgo/ltoplugin/build/LLGOLTOPlugin.so \ + "$artifact_dir/llgo/LLGOLTOPlugin.so" + cp -a .ci/bent-run/testbin "$artifact_dir/benchmarks/" + { + printf 'repository=%s\n' "$GITHUB_REPOSITORY" + printf 'workflow_run=%s\n' "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" + printf 'llgo_repository=%s\n' "$LLGO_REPOSITORY" + printf 'llgo_commit=%s\n' "$LLGO_COMMIT" + printf 'go_version=%s\n' "$GO_VERSION" + printf 'llvm_version=%s\n' "$LLVM_VERSION" + printf '\nContents:\n' + printf '%s\n' ' llgo/llgo' + printf '%s\n' ' llgo/LLGOLTOPlugin.so' + printf '%s\n' ' benchmarks/testbin/*' + } > "$artifact_dir/README.txt" + tar -czf .ci/llgo-binary-size-binaries.tar.gz \ + -C "$artifact_dir" . + + - name: Upload built binaries + id: upload-binaries + uses: actions/upload-artifact@v4 + with: + name: llgo-binary-size-binaries + path: .ci/llgo-binary-size-binaries.tar.gz + if-no-files-found: error + retention-days: 30 + + - name: Record binary artifact link in the run result + env: + ARTIFACT_ID: ${{ steps.upload-binaries.outputs.artifact-id }} + ARTIFACT_NAME: llgo-binary-size-binaries + run: | + set -euo pipefail + python3 - <<'PY' + import json + import os + + path = ".ci/bent-run/results/results.json" + with open(path, encoding="utf-8") as f: + document = json.load(f) + run = document.setdefault("run", {}) + artifact_id = os.environ["ARTIFACT_ID"] + run["binaryArtifactName"] = os.environ["ARTIFACT_NAME"] + run["binaryArtifactUrl"] = ( + f"{os.environ['GITHUB_SERVER_URL']}/{os.environ['GITHUB_REPOSITORY']}" + f"/actions/runs/{os.environ['GITHUB_RUN_ID']}/artifacts/{artifact_id}" + ) + with open(path, "w", encoding="utf-8") as f: + json.dump(document, f, indent=2) + f.write("\n") + PY + - name: Upload binary-size results uses: actions/upload-artifact@v4 with: diff --git a/ci/llgo-size/README.md b/ci/llgo-size/README.md index 322f2ee..31d5c58 100644 --- a/ci/llgo-size/README.md +++ b/ci/llgo-size/README.md @@ -69,6 +69,11 @@ variants. A PR that changes the committed LLGo version runs the full five-way matrix and uploads the `llgo-binary-size` artifact for review, but still does not publish history. +Every full binary-size run also uploads a 30-day `llgo-binary-size-binaries` +artifact containing the LLGo executable, the LTO plugin, and Bent's generated +test binaries. The artifact URL is recorded in that run's JSON and shown on +the Pages dashboard; GitHub may require repository access before downloading. + ### First-time repository setup The first publisher run creates the `pages` branch automatically. Before that diff --git a/ci/llgo-size/publish.sh b/ci/llgo-size/publish.sh index f7eb7f9..92f7e9a 100755 --- a/ci/llgo-size/publish.sh +++ b/ci/llgo-size/publish.sh @@ -86,6 +86,8 @@ for path in glob.glob(os.path.join(data_dir, "runs", "*", "results.json")): "goVersion": run.get("goVersion", ""), "llvmVersion": run.get("llvmVersion", ""), "workflowUrl": run.get("workflowUrl", ""), + "binaryArtifactName": run.get("binaryArtifactName", ""), + "binaryArtifactUrl": run.get("binaryArtifactUrl", ""), "path": "runs/" + key + "/results.json", }) runs.sort(key=lambda item: item["createdAt"], reverse=True) diff --git a/ci/llgo-size/report.sh b/ci/llgo-size/report.sh index 38bb31e..c36bac0 100755 --- a/ci/llgo-size/report.sh +++ b/ci/llgo-size/report.sh @@ -151,6 +151,8 @@ run = { "llvmVersion": os.environ.get("LLVM_VERSION", ""), "event": env("LLGO_SIZE_EVENT", "GITHUB_EVENT_NAME"), "workflowUrl": workflow_url, + "binaryArtifactName": os.environ.get("LLGO_SIZE_BINARY_ARTIFACT_NAME", ""), + "binaryArtifactUrl": os.environ.get("LLGO_SIZE_BINARY_ARTIFACT_URL", ""), } document = { diff --git a/ci/llgo-size/site/app.js b/ci/llgo-size/site/app.js index 01cae1f..39620be 100644 --- a/ci/llgo-size/site/app.js +++ b/ci/llgo-size/site/app.js @@ -84,6 +84,11 @@ function runLabel(run) { return runNumber(run) + " · " + dateLabel(run.createdAt); } +function artifactLink(run, label) { + if (!run.binaryArtifactUrl) return "—"; + return '' + escapeHtml(label || run.binaryArtifactName || "Download binaries") + ""; +} + async function loadRun(meta) { if (!state.runs.has(meta.key)) { const response = await fetch("data/" + meta.path, { cache: "no-store" }); @@ -125,6 +130,7 @@ function renderMeta(newer, baseline) { '
LLGo' + escapeHtml(shortSha(run.llgoCommit)) + "
" + '
Toolchain' + escapeHtml(run.goVersion || "—") + " / LLVM " + escapeHtml(run.llvmVersion || "—") + "
" + '
Link' + workflow + "
" + + '
Artifacts' + artifactLink(run, "Download binaries") + "
" + '
Baseline' + (baseline ? escapeHtml(dateLabel(baseline.run.createdAt)) : "none") + "
"; } @@ -187,7 +193,8 @@ function renderHistoryTable(runs) { "" + escapeHtml(shortSha(run.llgoCommit)) + "" + "" + escapeHtml(run.goVersion || "—") + "" + "" + escapeHtml(run.llvmVersion || "—") + "" + - "" + escapeHtml(run.ref || "—") + ""; + "" + escapeHtml(run.ref || "—") + "" + + "" + artifactLink(run, "Download") + ""; body.appendChild(row); } } diff --git a/ci/llgo-size/site/index.html b/ci/llgo-size/site/index.html index 90d158d..707286a 100644 --- a/ci/llgo-size/site/index.html +++ b/ci/llgo-size/site/index.html @@ -4,7 +4,7 @@ LLGo binary-size history - +
@@ -47,7 +47,7 @@

Size history

- +
RunLLGo commitGoLLVMWorkflow
RunLLGo commitGoLLVMWorkflowArtifacts
@@ -59,6 +59,6 @@

Size history

Raw run index
- + diff --git a/ci/llgo-size/site/style.css b/ci/llgo-size/site/style.css index 6092af8..3dae25b 100644 --- a/ci/llgo-size/site/style.css +++ b/ci/llgo-size/site/style.css @@ -36,7 +36,7 @@ h2 { margin-bottom: 4px; font-size: 21px; letter-spacing: -.02em; } label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; } select { width: 100%; padding: 10px 32px 10px 12px; border: 1px solid #cbd7eb; border-radius: 10px; background: #fbfcff; color: var(--ink); font: 600 14px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; } select:focus { border-color: #5c82e8; outline: 3px solid rgba(71, 118, 226, .16); } -.run-meta { display: grid; grid-template-columns: 1.35fr 1fr 1.1fr 1.05fr 1.35fr; gap: 0; padding: 7px 10px; margin-bottom: 18px; } +.run-meta { display: grid; grid-template-columns: 1.25fr .95fr 1fr .95fr 1.2fr 1.25fr; gap: 0; padding: 7px 10px; margin-bottom: 18px; } .run-meta > div { display: grid; gap: 4px; min-width: 0; padding: 10px 13px; border-right: 1px solid var(--line); font-size: 13px; } .run-meta > div:last-child { border-right: 0; } .label { color: var(--muted); font-size: 10px; } diff --git a/docs/llgo-binary-size-handoff.md b/docs/llgo-binary-size-handoff.md index 253d30a..bfa57f3 100644 --- a/docs/llgo-binary-size-handoff.md +++ b/docs/llgo-binary-size-handoff.md @@ -41,6 +41,8 @@ PR 修改 `llgo-version.env`,则运行完整的 LLGo 二进制大小矩阵并上传 artifact 供开发者参考,但两种 PR 都不会发布 Pages。 两个工作流使用独立的并发队列,页面刷新不会淘汰等待中的二进制大小构建。 +完整构建还会上传 LLGo 可执行文件、LTO plugin 和 Bent 测试二进制;artifact +链接会写入运行结果并显示在 Pages 页面中,保留 30 天。 核心文件: From 0951da84ea20a695a720f1f19458bcd223421084 Mon Sep 17 00:00:00 2001 From: ZhouGuangyuan Date: Thu, 23 Jul 2026 20:01:44 +0800 Subject: [PATCH 2/4] ci: key history by LLGo commit --- .github/workflows/llgo-binary-size.yml | 10 ++---- ci/llgo-size/README.md | 10 +++--- ci/llgo-size/publish.sh | 44 ++++++++++++++++++++++++-- ci/llgo-size/site/app.js | 25 ++++++++------- ci/llgo-size/site/index.html | 2 +- docs/llgo-binary-size-handoff.md | 5 +-- 6 files changed, 66 insertions(+), 30 deletions(-) diff --git a/.github/workflows/llgo-binary-size.yml b/.github/workflows/llgo-binary-size.yml index 210bfed..93199e4 100644 --- a/.github/workflows/llgo-binary-size.yml +++ b/.github/workflows/llgo-binary-size.yml @@ -245,11 +245,7 @@ jobs: set -euo pipefail artifact_dir="$GITHUB_WORKSPACE/.ci/binary-artifact" rm -rf "$artifact_dir" - mkdir -p "$artifact_dir/llgo" "$artifact_dir/benchmarks" - install -m 0755 .ci/llgo/llgo "$artifact_dir/llgo/llgo" - install -m 0755 \ - .ci/llgo/ltoplugin/build/LLGOLTOPlugin.so \ - "$artifact_dir/llgo/LLGOLTOPlugin.so" + mkdir -p "$artifact_dir/benchmarks" cp -a .ci/bent-run/testbin "$artifact_dir/benchmarks/" { printf 'repository=%s\n' "$GITHUB_REPOSITORY" @@ -259,8 +255,6 @@ jobs: printf 'go_version=%s\n' "$GO_VERSION" printf 'llvm_version=%s\n' "$LLVM_VERSION" printf '\nContents:\n' - printf '%s\n' ' llgo/llgo' - printf '%s\n' ' llgo/LLGOLTOPlugin.so' printf '%s\n' ' benchmarks/testbin/*' } > "$artifact_dir/README.txt" tar -czf .ci/llgo-binary-size-binaries.tar.gz \ @@ -270,7 +264,7 @@ jobs: id: upload-binaries uses: actions/upload-artifact@v4 with: - name: llgo-binary-size-binaries + name: llgo-binary-size-test-binaries path: .ci/llgo-binary-size-binaries.tar.gz if-no-files-found: error retention-days: 30 diff --git a/ci/llgo-size/README.md b/ci/llgo-size/README.md index 31d5c58..202195e 100644 --- a/ci/llgo-size/README.md +++ b/ci/llgo-size/README.md @@ -69,10 +69,12 @@ variants. A PR that changes the committed LLGo version runs the full five-way matrix and uploads the `llgo-binary-size` artifact for review, but still does not publish history. -Every full binary-size run also uploads a 30-day `llgo-binary-size-binaries` -artifact containing the LLGo executable, the LTO plugin, and Bent's generated -test binaries. The artifact URL is recorded in that run's JSON and shown on -the Pages dashboard; GitHub may require repository access before downloading. +Every full binary-size run also uploads a 30-day +`llgo-binary-size-test-binaries` artifact containing Bent's generated test +binaries. The artifact URL is recorded in that run's JSON and shown on the +Pages dashboard; GitHub may require repository access before downloading. +Published history is keyed by the full LLGo commit, so rerunning one commit +updates its existing entry instead of adding another build-round entry. ### First-time repository setup diff --git a/ci/llgo-size/publish.sh b/ci/llgo-size/publish.sh index 92f7e9a..b03972f 100755 --- a/ci/llgo-size/publish.sh +++ b/ci/llgo-size/publish.sh @@ -23,6 +23,46 @@ for legacy in "$pages_dir"/data/runs/*.json; do mkdir -p "$legacy_dir" mv "$legacy" "$legacy_dir/results.json" done + +# Consolidate historical runs under the LLGo commit that produced them. This +# keeps reruns of the same commit as one comparable history entry instead of +# creating a new entry for every Actions run number. +python3 - "$pages_dir/data/runs" <<'PY' +import json +import os +import re +import shutil +import sys + +runs_dir = sys.argv[1] +for source in sorted(os.listdir(runs_dir)): + source_dir = os.path.join(runs_dir, source) + result_path = os.path.join(source_dir, "results.json") + if not os.path.isdir(source_dir) or not os.path.isfile(result_path): + continue + try: + with open(result_path, encoding="utf-8") as f: + run = json.load(f).get("run", {}) + except (OSError, ValueError): + continue + key = run.get("llgoCommit") or run.get("sourceCommit") or source + if not re.fullmatch(r"[A-Za-z0-9._-]+", str(key)) or str(key) == source: + continue + target_dir = os.path.join(runs_dir, str(key)) + if os.path.exists(target_dir): + existing_path = os.path.join(target_dir, "results.json") + try: + with open(existing_path, encoding="utf-8") as f: + existing = json.load(f).get("run", {}) + except (OSError, ValueError): + existing = {} + if str(run.get("createdAt", "")) >= str(existing.get("createdAt", "")): + shutil.rmtree(target_dir) + else: + shutil.rmtree(source_dir) + continue + os.rename(source_dir, target_dir) +PY cp "$site_dir/index.html" "$pages_dir/index.html" cp "$site_dir/app.js" "$pages_dir/app.js" cp "$site_dir/style.css" "$pages_dir/style.css" @@ -36,9 +76,7 @@ import sys with open(sys.argv[1], encoding="utf-8") as f: run = json.load(f)["run"] -run_id = str(run.get("id") or "manual") -attempt = run.get("attempt") -key = run_id if not attempt else run_id + "-" + str(attempt) +key = str(run.get("llgoCommit") or run.get("sourceCommit") or run.get("id") or "manual") if not re.fullmatch(r"[A-Za-z0-9._-]+", key): raise SystemExit("invalid run key: " + repr(key)) print(key) diff --git a/ci/llgo-size/site/app.js b/ci/llgo-size/site/app.js index 39620be..8d283bf 100644 --- a/ci/llgo-size/site/app.js +++ b/ci/llgo-size/site/app.js @@ -80,8 +80,12 @@ function runNumber(run) { return run.number == null ? run.key : "#" + run.number; } +function commitLabel(run) { + return shortSha(run.llgoCommit || run.sourceCommit || run.key); +} + function runLabel(run) { - return runNumber(run) + " · " + dateLabel(run.createdAt); + return commitLabel(run) + " · " + dateLabel(run.createdAt); } function artifactLink(run, label) { @@ -130,7 +134,7 @@ function renderMeta(newer, baseline) { '
LLGo' + escapeHtml(shortSha(run.llgoCommit)) + "
" + '
Toolchain' + escapeHtml(run.goVersion || "—") + " / LLVM " + escapeHtml(run.llvmVersion || "—") + "
" + '
Link' + workflow + "
" + - '
Artifacts' + artifactLink(run, "Download binaries") + "
" + + '
Artifacts' + artifactLink(run, "Download test binaries") + "
" + '
Baseline' + (baseline ? escapeHtml(dateLabel(baseline.run.createdAt)) : "none") + "
"; } @@ -160,8 +164,8 @@ function renderComparison(newer, baseline) { const baselineByName = baseline ? benchmarkMap(baseline) : new Map(); const benchmarkNames = Array.from(new Set(Array.from(newerByName.keys()).concat(Array.from(baselineByName.keys())))).sort(); - const newerHeading = "Newer · " + runNumber(newer.run); - const baselineHeading = baseline ? "Older · " + runNumber(baseline.run) : "Older"; + const newerHeading = "Newer · " + commitLabel(newer.run); + const baselineHeading = baseline ? "Older · " + commitLabel(baseline.run) : "Older"; grid.innerHTML = benchmarkNames.map(function (name) { const newerBenchmark = newerByName.get(name); const baselineBenchmark = baselineByName.get(name); @@ -184,17 +188,14 @@ function renderHistoryTable(runs) { const body = document.querySelector("#history-body"); body.replaceChildren(); for (const run of runs) { - const link = run.workflowUrl - ? '' + escapeHtml(runNumber(run)) + "" - : escapeHtml(runNumber(run)); const row = document.createElement("tr"); row.innerHTML = - "" + link + "" + escapeHtml(dateLabel(run.createdAt)) + "" + - "" + escapeHtml(shortSha(run.llgoCommit)) + "" + + "" + (run.workflowUrl ? '' : "") + escapeHtml(commitLabel(run)) + (run.workflowUrl ? "" : "") + "" + + "" + escapeHtml(dateLabel(run.createdAt)) + "" + "" + escapeHtml(run.goVersion || "—") + "" + "" + escapeHtml(run.llvmVersion || "—") + "" + "" + escapeHtml(run.ref || "—") + "" + - "" + artifactLink(run, "Download") + ""; + "" + artifactLink(run, "Download test binaries") + ""; body.appendChild(row); } } @@ -245,11 +246,11 @@ function renderHistoryChart(name, documents) { const color = seriesColors[configIndex % seriesColors.length]; return '' + points.map(function (point) { return '' + - escapeHtml(name + " · " + config + " · " + runNumber(point.document.run) + ": " + formatBytes(point.value)) + ""; + escapeHtml(name + " · " + config + " · " + commitLabel(point.document.run) + ": " + formatBytes(point.value)) + ""; }).join(""); }).join(""); const labels = documents.map(function (document, index) { - return '' + escapeHtml(runNumber(document.run)) + ""; + return '' + escapeHtml(commitLabel(document.run)) + ""; }).join(""); const legend = configs.map(function (config, index) { return '' + escapeHtml(configLabels[config] || config) + ""; diff --git a/ci/llgo-size/site/index.html b/ci/llgo-size/site/index.html index 707286a..cca09e1 100644 --- a/ci/llgo-size/site/index.html +++ b/ci/llgo-size/site/index.html @@ -47,7 +47,7 @@

Size history

- +
RunLLGo commitGoLLVMWorkflowArtifacts
LLGo commitCreatedGoLLVMWorkflowArtifacts
diff --git a/docs/llgo-binary-size-handoff.md b/docs/llgo-binary-size-handoff.md index bfa57f3..64f66cd 100644 --- a/docs/llgo-binary-size-handoff.md +++ b/docs/llgo-binary-size-handoff.md @@ -41,8 +41,9 @@ PR 修改 `llgo-version.env`,则运行完整的 LLGo 二进制大小矩阵并上传 artifact 供开发者参考,但两种 PR 都不会发布 Pages。 两个工作流使用独立的并发队列,页面刷新不会淘汰等待中的二进制大小构建。 -完整构建还会上传 LLGo 可执行文件、LTO plugin 和 Bent 测试二进制;artifact -链接会写入运行结果并显示在 Pages 页面中,保留 30 天。 +完整构建还会上传 Bent 测试二进制;artifact 链接会写入运行结果并显示在 +Pages 页面中,保留 30 天。历史目录和索引使用完整 LLGo commit 作为 key, +不再使用 Actions 构建轮次作为历史标识。 核心文件: From 144b20ee7e76bccfe0294f49aeea1d9725f1be88 Mon Sep 17 00:00:00 2001 From: ZhouGuangyuan Date: Thu, 23 Jul 2026 20:38:18 +0800 Subject: [PATCH 3/4] ci: key history by LLGo commit only --- .github/workflows/llgo-binary-size.yml | 55 -------------------------- ci/llgo-size/README.md | 4 -- ci/llgo-size/publish.sh | 2 - ci/llgo-size/report.sh | 2 - ci/llgo-size/site/app.js | 9 +---- ci/llgo-size/site/index.html | 2 +- ci/llgo-size/site/style.css | 2 +- docs/llgo-binary-size-handoff.md | 5 +-- 8 files changed, 5 insertions(+), 76 deletions(-) diff --git a/.github/workflows/llgo-binary-size.yml b/.github/workflows/llgo-binary-size.yml index 93199e4..0a180ce 100644 --- a/.github/workflows/llgo-binary-size.yml +++ b/.github/workflows/llgo-binary-size.yml @@ -239,61 +239,6 @@ jobs: ) time_command "Generate binary-size report" \ bash -c 'set -o pipefail; ci/llgo-size/report.sh .ci/bent-run | tee -a "$GITHUB_STEP_SUMMARY"' - - - name: Package built binaries - run: | - set -euo pipefail - artifact_dir="$GITHUB_WORKSPACE/.ci/binary-artifact" - rm -rf "$artifact_dir" - mkdir -p "$artifact_dir/benchmarks" - cp -a .ci/bent-run/testbin "$artifact_dir/benchmarks/" - { - printf 'repository=%s\n' "$GITHUB_REPOSITORY" - printf 'workflow_run=%s\n' "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" - printf 'llgo_repository=%s\n' "$LLGO_REPOSITORY" - printf 'llgo_commit=%s\n' "$LLGO_COMMIT" - printf 'go_version=%s\n' "$GO_VERSION" - printf 'llvm_version=%s\n' "$LLVM_VERSION" - printf '\nContents:\n' - printf '%s\n' ' benchmarks/testbin/*' - } > "$artifact_dir/README.txt" - tar -czf .ci/llgo-binary-size-binaries.tar.gz \ - -C "$artifact_dir" . - - - name: Upload built binaries - id: upload-binaries - uses: actions/upload-artifact@v4 - with: - name: llgo-binary-size-test-binaries - path: .ci/llgo-binary-size-binaries.tar.gz - if-no-files-found: error - retention-days: 30 - - - name: Record binary artifact link in the run result - env: - ARTIFACT_ID: ${{ steps.upload-binaries.outputs.artifact-id }} - ARTIFACT_NAME: llgo-binary-size-binaries - run: | - set -euo pipefail - python3 - <<'PY' - import json - import os - - path = ".ci/bent-run/results/results.json" - with open(path, encoding="utf-8") as f: - document = json.load(f) - run = document.setdefault("run", {}) - artifact_id = os.environ["ARTIFACT_ID"] - run["binaryArtifactName"] = os.environ["ARTIFACT_NAME"] - run["binaryArtifactUrl"] = ( - f"{os.environ['GITHUB_SERVER_URL']}/{os.environ['GITHUB_REPOSITORY']}" - f"/actions/runs/{os.environ['GITHUB_RUN_ID']}/artifacts/{artifact_id}" - ) - with open(path, "w", encoding="utf-8") as f: - json.dump(document, f, indent=2) - f.write("\n") - PY - - name: Upload binary-size results uses: actions/upload-artifact@v4 with: diff --git a/ci/llgo-size/README.md b/ci/llgo-size/README.md index 202195e..da9810d 100644 --- a/ci/llgo-size/README.md +++ b/ci/llgo-size/README.md @@ -69,10 +69,6 @@ variants. A PR that changes the committed LLGo version runs the full five-way matrix and uploads the `llgo-binary-size` artifact for review, but still does not publish history. -Every full binary-size run also uploads a 30-day -`llgo-binary-size-test-binaries` artifact containing Bent's generated test -binaries. The artifact URL is recorded in that run's JSON and shown on the -Pages dashboard; GitHub may require repository access before downloading. Published history is keyed by the full LLGo commit, so rerunning one commit updates its existing entry instead of adding another build-round entry. diff --git a/ci/llgo-size/publish.sh b/ci/llgo-size/publish.sh index b03972f..85e28df 100755 --- a/ci/llgo-size/publish.sh +++ b/ci/llgo-size/publish.sh @@ -124,8 +124,6 @@ for path in glob.glob(os.path.join(data_dir, "runs", "*", "results.json")): "goVersion": run.get("goVersion", ""), "llvmVersion": run.get("llvmVersion", ""), "workflowUrl": run.get("workflowUrl", ""), - "binaryArtifactName": run.get("binaryArtifactName", ""), - "binaryArtifactUrl": run.get("binaryArtifactUrl", ""), "path": "runs/" + key + "/results.json", }) runs.sort(key=lambda item: item["createdAt"], reverse=True) diff --git a/ci/llgo-size/report.sh b/ci/llgo-size/report.sh index c36bac0..38bb31e 100755 --- a/ci/llgo-size/report.sh +++ b/ci/llgo-size/report.sh @@ -151,8 +151,6 @@ run = { "llvmVersion": os.environ.get("LLVM_VERSION", ""), "event": env("LLGO_SIZE_EVENT", "GITHUB_EVENT_NAME"), "workflowUrl": workflow_url, - "binaryArtifactName": os.environ.get("LLGO_SIZE_BINARY_ARTIFACT_NAME", ""), - "binaryArtifactUrl": os.environ.get("LLGO_SIZE_BINARY_ARTIFACT_URL", ""), } document = { diff --git a/ci/llgo-size/site/app.js b/ci/llgo-size/site/app.js index 8d283bf..8f2915a 100644 --- a/ci/llgo-size/site/app.js +++ b/ci/llgo-size/site/app.js @@ -88,11 +88,6 @@ function runLabel(run) { return commitLabel(run) + " · " + dateLabel(run.createdAt); } -function artifactLink(run, label) { - if (!run.binaryArtifactUrl) return "—"; - return '' + escapeHtml(label || run.binaryArtifactName || "Download binaries") + ""; -} - async function loadRun(meta) { if (!state.runs.has(meta.key)) { const response = await fetch("data/" + meta.path, { cache: "no-store" }); @@ -134,7 +129,6 @@ function renderMeta(newer, baseline) { '
LLGo' + escapeHtml(shortSha(run.llgoCommit)) + "
" + '
Toolchain' + escapeHtml(run.goVersion || "—") + " / LLVM " + escapeHtml(run.llvmVersion || "—") + "
" + '
Link' + workflow + "
" + - '
Artifacts' + artifactLink(run, "Download test binaries") + "
" + '
Baseline' + (baseline ? escapeHtml(dateLabel(baseline.run.createdAt)) : "none") + "
"; } @@ -194,8 +188,7 @@ function renderHistoryTable(runs) { "" + escapeHtml(dateLabel(run.createdAt)) + "" + "" + escapeHtml(run.goVersion || "—") + "" + "" + escapeHtml(run.llvmVersion || "—") + "" + - "" + escapeHtml(run.ref || "—") + "" + - "" + artifactLink(run, "Download test binaries") + ""; + "" + escapeHtml(run.ref || "—") + ""; body.appendChild(row); } } diff --git a/ci/llgo-size/site/index.html b/ci/llgo-size/site/index.html index cca09e1..a0f44fd 100644 --- a/ci/llgo-size/site/index.html +++ b/ci/llgo-size/site/index.html @@ -47,7 +47,7 @@

Size history

- +
LLGo commitCreatedGoLLVMWorkflowArtifacts
LLGo commitCreatedGoLLVMWorkflow
diff --git a/ci/llgo-size/site/style.css b/ci/llgo-size/site/style.css index 3dae25b..6092af8 100644 --- a/ci/llgo-size/site/style.css +++ b/ci/llgo-size/site/style.css @@ -36,7 +36,7 @@ h2 { margin-bottom: 4px; font-size: 21px; letter-spacing: -.02em; } label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; } select { width: 100%; padding: 10px 32px 10px 12px; border: 1px solid #cbd7eb; border-radius: 10px; background: #fbfcff; color: var(--ink); font: 600 14px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; } select:focus { border-color: #5c82e8; outline: 3px solid rgba(71, 118, 226, .16); } -.run-meta { display: grid; grid-template-columns: 1.25fr .95fr 1fr .95fr 1.2fr 1.25fr; gap: 0; padding: 7px 10px; margin-bottom: 18px; } +.run-meta { display: grid; grid-template-columns: 1.35fr 1fr 1.1fr 1.05fr 1.35fr; gap: 0; padding: 7px 10px; margin-bottom: 18px; } .run-meta > div { display: grid; gap: 4px; min-width: 0; padding: 10px 13px; border-right: 1px solid var(--line); font-size: 13px; } .run-meta > div:last-child { border-right: 0; } .label { color: var(--muted); font-size: 10px; } diff --git a/docs/llgo-binary-size-handoff.md b/docs/llgo-binary-size-handoff.md index 64f66cd..bb664ba 100644 --- a/docs/llgo-binary-size-handoff.md +++ b/docs/llgo-binary-size-handoff.md @@ -41,9 +41,8 @@ PR 修改 `llgo-version.env`,则运行完整的 LLGo 二进制大小矩阵并上传 artifact 供开发者参考,但两种 PR 都不会发布 Pages。 两个工作流使用独立的并发队列,页面刷新不会淘汰等待中的二进制大小构建。 -完整构建还会上传 Bent 测试二进制;artifact 链接会写入运行结果并显示在 -Pages 页面中,保留 30 天。历史目录和索引使用完整 LLGo commit 作为 key, -不再使用 Actions 构建轮次作为历史标识。 +历史目录和索引使用完整 LLGo commit 作为 key,不再使用 Actions 构建轮次作为 +历史标识。 核心文件: From fee9bbcc48cb6ce4a4af8f1d8b6b9b1b43c62432 Mon Sep 17 00:00:00 2001 From: ZhouGuangyuan Date: Thu, 23 Jul 2026 21:04:23 +0800 Subject: [PATCH 4/4] ci: run Pages deployment after successful builds --- .github/workflows/llgo-binary-size.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/llgo-binary-size.yml b/.github/workflows/llgo-binary-size.yml index 0a180ce..4f48fef 100644 --- a/.github/workflows/llgo-binary-size.yml +++ b/.github/workflows/llgo-binary-size.yml @@ -261,7 +261,9 @@ jobs: "$pages_dir" \ ci/llgo-size/site deploy-pages: - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + if: >- + always() && github.ref == 'refs/heads/main' && + github.event_name != 'pull_request' && needs.binary-size.result == 'success' needs: binary-size runs-on: ubuntu-24.04 permissions: