diff --git a/.gitea/workflows/bench-pages.yml b/.gitea/workflows/bench-pages.yml new file mode 100644 index 0000000..f68fefa --- /dev/null +++ b/.gitea/workflows/bench-pages.yml @@ -0,0 +1,34 @@ +name: public-benchmark-pages + +on: + schedule: + - cron: '*/15 * * * *' + workflow_dispatch: + +concurrency: + group: alkane-os-public-benchmark-pages + cancel-in-progress: false + +jobs: + publish: + runs-on: alkane-pages + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - name: Install SSH client + run: | + apt-get update -qq + apt-get install -y -qq --no-install-recommends openssh-client + - name: Render measured benchmark history + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: python3 ci/bench_history.py render + - name: Publish public benchmark page + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + BENCH_PAGES_DEPLOY_KEY: ${{ secrets.BENCH_PAGES_DEPLOY_KEY }} + run: python3 ci/publish-bench-pages.py os + - name: Clean generated page + if: always() + run: python3 ci/cleanup-generated.py diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index a9c6998..4cb5b49 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -99,11 +99,6 @@ jobs: with: name: alkane-os-benchmark-site-preview path: bench-site/index.html - - name: Publish public benchmark page - env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} - BENCH_PAGES_DEPLOY_KEY: ${{ secrets.BENCH_PAGES_DEPLOY_KEY }} - run: python3 ci/publish-bench-pages.py os - name: Pairing and simulator conformance run: python3 ci/check-conformance.py - name: Select release version diff --git a/ci/bench_history.py b/ci/bench_history.py index 468c315..02e6fd5 100644 --- a/ci/bench_history.py +++ b/ci/bench_history.py @@ -120,7 +120,7 @@ def render_html(index: dict) -> str: def main() -> None: parser = argparse.ArgumentParser() - parser.add_argument("action", choices=("prepare", "publish")) + parser.add_argument("action", choices=("prepare", "publish", "render")) args = parser.parse_args() api = os.environ["GITHUB_API_URL"].rstrip("/") repo = os.environ["GITHUB_REPOSITORY"] @@ -135,6 +135,13 @@ def main() -> None: Path("badges/bench-baseline.json").write_text(json.dumps(baseline) + "\n") print(f"Loaded {len(baseline)} prior benchmark measurements") return + if args.action == "render": + if not index["entries"]: + raise ValueError("no measured benchmark history to publish") + Path("bench-site").mkdir(exist_ok=True) + Path("bench-site/index.html").write_text(render_html(index)) + print(f"Rendered {len(index['entries'])} measured benchmark commits") + return metrics = json.loads(Path("badges/metrics.json").read_text()) timestamp = datetime.now(timezone.utc).isoformat(timespec="seconds") index = updated_index(index, sha, metrics, timestamp)