CI/CD & Coverage
Per-service build status, current coverage %, and a historical coverage trend (stepped sparkline + 30-day delta) are shown as service-health cards on the home page (/). Clicking a card opens a run-history modal — rendered client-side by portal.js from the card's data-dash-card payload, with no Chart.js dependency.
There is no longer a standalone
/dashboard/(or/cicd/) page. The CI/CD section intools/site_config.ymlis data-only (it has nomodule/classand no nav entry); the home page consumes its config.tools/dashboards/ cicd_coverage.pyis now a library of data + card-rendering helpers, not a renderable dashboard section.
How it works
GitHub Actions run
│
▼
tools/collectors/cicd_coverage_collector.py
│ appends to
▼
tools/data/cicd_history.jsonl
│ read by
▼
tools/coverage/generate_index.py (_write_home_page)
→ tools/dashboards/cicd_coverage.py (service_summary / _render_card helpers)
│ writes
▼
site/index.html (service-health cards + run-history modal)
Data store
Records are stored as newline-delimited JSON in tools/data/cicd_history.jsonl. Each line has the shape:
{
"timestamp": 1718000000.0,
"service": "svc-core",
"build_status": "success",
"run_id": 12345678,
"run_url": "https://github.com/...",
"coverage_pct": 88.5,
"commit": "382b84a"
}
commit is optional; when present it is shown in the run-history modal table.
This format was chosen over SQLite because it is trivially appendable from CI, human-readable, requires no schema migrations, and diffs cleanly in git.
Scheduling the collector
The collector runs in the ci_stats job on the post-merge push to main, committing the refreshed history straight back to main. A paths-ignore guard on the push trigger keeps that data-only commit from re-triggering CI, so no [skip ci] marker is used (which would otherwise leak into squash-merge commit bodies and skip the whole pipeline):
on:
push:
branches: [main]
paths-ignore:
- tools/data/cicd_history.jsonl
# ...
- name: Collect CI/CD dashboard data
env:
GITHUB_TOKEN: ${{ secrets.APP_CI_GITHUB_TOKEN }}
run: python3 tools/collectors/cicd_coverage_collector.py
- name: Commit updated history
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add tools/data/cicd_history.jsonl
git diff --cached --quiet && exit 0
git commit -m "chore: update CI/CD history"
git pull --rebase origin main
git push origin HEAD:main
Because the collector runs after the merge, the newest record lands in the commit that is published on the next push to main — a one-cycle lag that is immaterial for a historical trend chart.
The site build step that follows reads from the committed file so the dashboard renders from cached data — it never hits the GitHub API at page-generation time.
Timestamps
The portal is static HTML. Anything the generator computes is frozen at build time and stays on the page until the next deploy — so a relative age rendered in Python ("3 minutes ago") keeps claiming the last run was minutes old for as long as the page is live. That was a real bug: a deployment from the previous evening reported "3 minutes ago" the next morning.
The rule that replaced it:
The generator renders absolute UTC times only. Relative ages are computed in the browser by
portal.js.
Server side, tools/coverage/generate_index.py::_time_html emits
<time class="rtime" datetime="2026-09-15T22:48:05+00:00" data-rel="append">
2026-09-15 22:48 UTC
</time>
Client side, portal.js fills the age in on load and refreshes it every 60s, reading the original text back from data-abs so repeated passes recompute rather than append to themselves. data-rel picks the shape:
data-rel | Rendered | Used by |
|---|---|---|
replace | 11 hours ago (absolute moves to title) | recent-activity feed, run-history modal |
With JavaScript disabled the absolute UTC time stands on its own — correct, just not relative. Every rendered timestamp is UTC and says so; tools/dashboards/ cicd_coverage.py::format_utc / format_iso are the single source of both spellings, and the run payload carries ts (absolute) alongside iso (what the age is computed from).
Tests
make test-tools covers all of it:
tools/coverage/test_generate_index.pyasserts the published HTML contains no pre-rendered age, that every<time>carries a timezone-awaredatetime, that no timestamp is printed without aUTClabel, and that only allowlisted files reachsite/assets/.tools/dashboards/test_cicd_coverage.pycovers the data helpers behind every card, feed row and modal payload.tools/templates/assets/test_portal_js.pyrunsportal.jsitself underportal_test_harness.js, a small Node DOM stub —portal.jsships verbatim to the site, so it must stay dependency-free and cannot be bundled or imported. The tests pin every relative-time bucket, both hydration modes, clock skew, bad data, and the fact that re-running the 60s refresh does not concatenate ages. They skip whennodeis absent; CI installs one so they always run.
Adding a new service
Only tools/site_config.yml needs to be edited:
sections:
- id: cicd-coverage
...
config:
services:
# Add an entry like this:
- id: my-new-service
label: "My New Service"
repo: datachainr/Chainr-Web
workflow: ci.yml
job_name: "pytest (my-new-service)"
id — used as the primary key in the history store. label — display name on the service-health card. repo — owner/repo GitHub repository slug. workflow — workflow file name (e.g. ci.yml). job_name — substring of the job name whose log will be scanned for coverage %.
After committing the config change, run the collector once to seed initial data:
GITHUB_TOKEN=<pat> python3 tools/collectors/cicd_coverage_collector.py
Adding a new dashboard section (developer reference)
Create
tools/dashboards/my_section.pywith a class that extendsdashboards.DashboardSectionand implementsnav_entry()andrender().Register it in
tools/site_config.yml:
- id: my-section
title: "My Section"
nav_key: my-section
path: my-section/index.html
module: dashboards.my_section
class: MySectionDashboard
config:
# section-specific keys
No changes to generate_index.py are required.