From eea728fa7c1aee11656df724694ab5d2cf5a1457 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Tue, 29 Sep 2026 22:58:41 +0000 Subject: [PATCH] ci: self-hosted job that keeps readme progress numbers updated --- .github/workflows/readme-progress.yml | 62 +++++++++++++++++++++++++++ README.md | 10 +++++ tools/update_readme_progress.py | 59 +++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 .github/workflows/readme-progress.yml create mode 100644 tools/update_readme_progress.py diff --git a/.github/workflows/readme-progress.yml b/.github/workflows/readme-progress.yml new file mode 100644 index 00000000..8c70f24a --- /dev/null +++ b/.github/workflows/readme-progress.yml @@ -0,0 +1,62 @@ +name: README progress + +# runs on the self-hosted runner on cole's server so it doesn't use hosted minutes. +# only push/schedule/manual triggers, never pull_request, so fork PRs can't reach this machine. +on: + push: + branches: [main] + paths-ignore: [README.md] + schedule: + - cron: "*/30 * * * *" + workflow_dispatch: + +concurrency: + group: readme-progress + cancel-in-progress: true + +permissions: + contents: write + +jobs: + progress: + runs-on: [self-hosted, wii-ipl-local] + timeout-minutes: 60 + env: + ORIG_APP: /mnt/drive2/projects/wiichannels/wii-ipl/orig/43U/00000008.app + TOOL_CACHE: /mnt/drive2/projects/wiichannels/wii-ipl/build + NINJA: /home/cole/projects/tests/.venv/bin/ninja + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 1 + + - name: Prepare + run: | + mkdir -p build orig/43U + cp "$ORIG_APP" orig/43U/00000008.app + [ -d build/compilers ] || cp -a "$TOOL_CACHE/compilers" build/ + [ -d build/tools ] || cp -a "$TOOL_CACHE/tools" build/ + + - name: Build + run: | + python3 configure.py --version 43U + "$NINJA" + "$NINJA" build/43U/ok + + - name: Report + run: build/tools/objdiff-cli report generate -p . -o build/43U/report.json -f json + + - name: Update README + run: python3 tools/update_readme_progress.py build/43U/report.json README.md "$GITHUB_SHA" + + - name: Commit + run: | + if git diff --quiet README.md; then exit 0; fi + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add README.md + git commit -m "docs: update progress [skip ci]" + git pull --rebase origin main || { git rebase --abort; echo "main moved, next run will update"; exit 0; } + git push origin HEAD:main diff --git a/README.md b/README.md index 882897fa..167dec26 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,16 @@ Supported versions: Progress ======== + +| Decompiled | Matched | Linked | Data | +|:---:|:---:|:---:|:---:| +| 80.98% | 72.11% | 56.76% | 86.16% | + +units 748/1027 complete, functions 10570/12563 matched. updated 2026-09-29 22:58 UTC from `test` by the self-hosted progress job + +decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data + + | Version | Progress | |-----------------------|------------------------------------------------------------------------------| | [Wii Menu 4.3U][V43U] | [![FuncBadgeV43U]][V43U] [![DecompBadgeV43U]][V43U] [![LinkBadgeV43U]][V43U] | diff --git a/tools/update_readme_progress.py b/tools/update_readme_progress.py new file mode 100644 index 00000000..c4cdd252 --- /dev/null +++ b/tools/update_readme_progress.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +"""Rewrite the progress block in README.md from an objdiff report. + +usage: update_readme_progress.py [commit] +""" +import datetime +import json +import sys + +START = "" +END = "" + + +def pct(measures, key): + return float(measures.get(key) or 0.0) + + +def main(): + report_path, readme_path = sys.argv[1], sys.argv[2] + commit = sys.argv[3][:8] if len(sys.argv) > 3 else "" + m = json.load(open(report_path))["measures"] + + stamp = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M UTC") + block = "\n".join([ + START, + "| Decompiled | Matched | Linked | Data |", + "|:---:|:---:|:---:|:---:|", + f"| {pct(m, 'fuzzy_match_percent'):.2f}% | {pct(m, 'matched_code_percent'):.2f}% " + f"| {pct(m, 'complete_code_percent'):.2f}% | {pct(m, 'matched_data_percent'):.2f}% |", + "", + f"units {m.get('complete_units')}/{m.get('total_units')} complete, " + f"functions {m.get('matched_functions')}/{m.get('total_functions')} matched. " + f"updated {stamp}" + (f" from `{commit}`" if commit else "") + " by the self-hosted progress job", + "", + "decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, " + "linked = code actually linked into the DOL, data = byte-exact data", + END, + ]) + + text = open(readme_path, encoding="utf-8").read() + if START in text and END in text: + head, rest = text.split(START, 1) + _, tail = rest.split(END, 1) + new = head + block + tail + else: + anchor = "Progress\n========\n" + if anchor not in text: + raise SystemExit("no progress anchor in README") + new = text.replace(anchor, anchor + block + "\n\n", 1) + + if new != text: + open(readme_path, "w", encoding="utf-8").write(new) + print("README progress updated") + else: + print("README progress unchanged") + + +if __name__ == "__main__": + main() -- 2.49.1