Skip to content
Snippets Groups Projects
Commit bf68ed83 authored by Austin Anderson's avatar Austin Anderson
Browse files

Add status badges

parent 92a203ed
Branches
No related tags found
No related merge requests found
...@@ -62,7 +62,7 @@ jobs: ...@@ -62,7 +62,7 @@ jobs:
- name: Setup Pages - name: Setup Pages
uses: actions/configure-pages@v3 uses: actions/configure-pages@v3
- name: Move dashboard around - name: Move dashboard around, include all generated files
run: cd tf_oss_dashboard; mkdir .site; mv -t .site * run: cd tf_oss_dashboard; mkdir .site; mv -t .site *
- name: Upload pages artifact - name: Upload pages artifact
......
...@@ -56,3 +56,9 @@ nightly_job_basis: Nightly - Code Check - Linux ...@@ -56,3 +56,9 @@ nightly_job_basis: Nightly - Code Check - Linux
maximum_card_size: 100 maximum_card_size: 100
# Set to Google Analytics "Measurement ID" to enable, or disable w/ "false" # Set to Google Analytics "Measurement ID" to enable, or disable w/ "false"
gtag: G-JTD613F3TX gtag: G-JTD613F3TX
# Generate SVG badges, each available at Category Name.svg, e.g.
# tensorflow.github.io/build/TF Official Continuous.svg
# They then should link to the specific section with #Category Name (spaces ok)
badges:
- TF Official Continuous
- TF Official Nightly
...@@ -12,6 +12,7 @@ import json ...@@ -12,6 +12,7 @@ import json
import cmarkgfm import cmarkgfm
import pypugjs import pypugjs
import re import re
import subprocess
import sys import sys
import yaml import yaml
...@@ -172,6 +173,7 @@ for job_name, original_records in job_names_to_records.items(): ...@@ -172,6 +173,7 @@ for job_name, original_records in job_names_to_records.items():
if record["state"] not in ["PENDING", "IN_PROGRESS", "QUEUED", "EXPECTED"]: if record["state"] not in ["PENDING", "IN_PROGRESS", "QUEUED", "EXPECTED"]:
meta["css_classes"] = record["state"] meta["css_classes"] = record["state"]
break break
meta["passing"] = meta["css_classes"] not in ["FAILURE", "ERROR", "TIMEOUT"]
records.append(meta) records.append(meta)
...@@ -232,3 +234,14 @@ print(template.render( ...@@ -232,3 +234,14 @@ print(template.render(
now=now, now=now,
isonow=isonow, isonow=isonow,
yaml=YAML_CONFIG)) yaml=YAML_CONFIG))
# Generate SVG badges. wget prints to stderr so it doesn't corrupt HTML output.
# Maybe the print statement above should be using an output file instead.
for category in YAML_CONFIG["badges"]:
total = len(by_group[category])
failing = total - sum([jobs[0]["passing"] for name, jobs in by_group[category].items()])
if failing == 0:
url = f"https://img.shields.io/static/v1?label={category}&message=passing&color=success"
else:
url = f"https://img.shields.io/static/v1?label={category}&message={failing}/{total} failing&color=critical"
subprocess.run(["wget", url, "-O", f"{category}.svg"])
...@@ -66,7 +66,7 @@ html(lang="en") ...@@ -66,7 +66,7 @@ html(lang="en")
a.badge.p-2(title="#{test['date_human']} - #{test['commit_summary']}" class=test["state"] data-bs-toggle='modal' data-bs-target=test["commit_id"]) a.badge.p-2(title="#{test['date_human']} - #{test['commit_summary']}" class=test["state"] data-bs-toggle='modal' data-bs-target=test["commit_id"])
each category, everythin in by_group.items() each category, everythin in by_group.items()
.fw-bold.ps-4 .fw-bold.ps-4
span.text-light= category span.text-light(id=category)= category
.d-flex.flex-row.flex-wrap.gap-1.m-1.card-section.tf-is-listed .d-flex.flex-row.flex-wrap.gap-1.m-1.card-section.tf-is-listed
each name, tests in everythin.items() each name, tests in everythin.items()
.card.flex-shrink-1.flex-grow-1(class=tests[0]["css_classes"] data-name=name) .card.flex-shrink-1.flex-grow-1(class=tests[0]["css_classes"] data-name=name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment