Skip to content

CI Dashboard Ingest #15

CI Dashboard Ingest

CI Dashboard Ingest #15

name: CI Dashboard Ingest
# Parses recent benchmark runs of the "Fly DSL test" workflow into the dashboard data
# files and publishes them to the orphan `ci-dashboard-data` branch, which the static
# dashboard (rocm.github.io/FlyDSL/ci-dashboard) fetches at runtime. No GitHub Pages
# setting change is required: the dashboard *page* ships with the docs Pages artifact,
# while this job only updates the *data* branch.
on:
schedule:
- cron: "17 */3 * * *" # every 3 hours
workflow_run:
workflows: ["Fly DSL test"] # refresh promptly after a benchmark run finishes
types: [completed]
workflow_dispatch:
inputs:
max_runs:
description: "How many recent runs to scan (≈1-2 runs/day; 60 ≈ 30 days)"
default: "60"
concurrency:
group: ci-dashboard-data # serialize pushes to the data branch
cancel-in-progress: false
permissions:
contents: write # push to ci-dashboard-data
actions: read # download job logs
jobs:
ingest:
runs-on: ubuntu-latest
steps:
- name: Checkout (ingest scripts)
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Ingest benchmark runs -> data files
env:
GH_TOKEN: ${{ github.token }}
DATA_BRANCH: ci-dashboard-data
MAX_RUNS: ${{ github.event.inputs.max_runs || '60' }}
run: |
set -euo pipefail
OUT="${RUNNER_TEMP}/dashboard-data"
mkdir -p "$OUT"
# Seed the merge from the published history (public raw; 404 -> fresh start).
# Only history.json is accumulated across runs; runs.json is a fresh
# snapshot ingest.py rewrites every time, so it is not seeded here.
base="https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${DATA_BRANCH}"
curl -fsSL "$base/history.json" -o "$OUT/history.json" || echo "no existing history.json fetched (first run or unreachable) — starting fresh"
python3 .github/dashboard/ingest/ingest.py \
--repo "$GITHUB_REPOSITORY" \
--max-runs "$MAX_RUNS" \
--history-days 30 \
--out-dir "$OUT"
- name: Publish to data branch
env:
GH_TOKEN: ${{ github.token }}
DATA_BRANCH: ci-dashboard-data
run: |
set -euo pipefail
OUT="${RUNNER_TEMP}/dashboard-data"
PUB="${RUNNER_TEMP}/publish"
rm -rf "$PUB"; mkdir -p "$PUB"; cd "$PUB"
git init -q
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote add origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
if git fetch --depth=1 origin "$DATA_BRANCH" 2>/dev/null; then
git checkout -q "$DATA_BRANCH"
else
echo "creating orphan $DATA_BRANCH"
git checkout -q --orphan "$DATA_BRANCH"
git rm -rfq . 2>/dev/null || true
printf '# FlyDSL CI dashboard data\n\nMachine-generated by `.github/workflows/ci-dashboard-ingest.yml`. Do not edit by hand.\n' > README.md
fi
cp "$OUT/history.json" "$OUT/runs.json" .
git add history.json runs.json README.md
if git diff --cached --quiet; then
echo "no data change"; exit 0
fi
git commit -qm "ci-dashboard: ingest $(date -u +%FT%TZ) [skip ci]"
git push -qf origin "HEAD:${DATA_BRANCH}"
echo "published $(wc -c < history.json) bytes of history"