Improve table

This commit is contained in:
nora 2024-09-08 15:34:12 +02:00
parent ae1f0b96e3
commit 67459f825b
5 changed files with 51 additions and 28 deletions

View file

@ -54,6 +54,7 @@ async fn build(State(state): State<AppState>, Query(query): Query<BuildQuery>) -
.replace("{{nightly}}", &query.nightly) .replace("{{nightly}}", &query.nightly)
.replace("{{target}}", &query.target) .replace("{{target}}", &query.target)
.replace("{{stderr}}", &build.stderr) .replace("{{stderr}}", &build.stderr)
.replace("{{mode}}", &build.mode.to_string())
.replace("{{version}}", crate::VERSION) .replace("{{version}}", crate::VERSION)
.replace("{{status}}", &build.status.to_string()); .replace("{{status}}", &build.status.to_string());

View file

@ -12,8 +12,11 @@
</style> </style>
</head> </head>
<body> <body>
<h1>Build results nightly-{{nightly}} target-{{target}}</h1> <h1>Build results for nightly-{{nightly}} target-{{target}} {{mode}}</h1>
<div class="{{status}} build-indicator-big">{{status}}</div> <a href="/">Back</a>
<div style="margin-top: 20px" class="{{status}} build-indicator-big">
{{status}}
</div>
<pre> <pre>
{{stderr}} {{stderr}}
</pre> </pre>

View file

@ -20,11 +20,24 @@ td {
background-color: lightgray; background-color: lightgray;
} }
.target-header {
writing-mode: sideways-lr;
}
.build-info-a { .build-info-a {
color: black; color: black;
text-decoration: none; text-decoration: none;
} }
.build-cell {
padding-left: 5px;
padding-right: 5px;
}
.target-name-col {
white-space: nowrap;
}
.footer { .footer {
margin-top: 20px; margin-top: 20px;
display: flex; display: flex;

View file

@ -8,8 +8,13 @@
</head> </head>
<body> <body>
<h1>Does it build?</h1> <h1>Does it build?</h1>
<p>This website builds every rustc target on many nightlies to check which ones work and which ones do not.</p>
<ul>
<li><a href="#core-build">Core build</a></li>
<li><a href="#miri-std-build">Std check build</a></li>
</ul>
<!--core--> <!--core-->
<h2>Core Build</h2> <h2 id="core-build">Core Build</h2>
<p>Builds every target with: <p>Builds every target with:
<pre>cargo build --release -Zbuild-std=core</pre></p> <pre>cargo build --release -Zbuild-std=core</pre></p>
<p>This checks that codegen/linking of core works, but does not check whether std builds.</p> <p>This checks that codegen/linking of core works, but does not check whether std builds.</p>
@ -25,7 +30,7 @@
</table> </table>
<!--std--> <!--std-->
<h2>Miri Std Build</h2> <h2 id="miri-std-build">Miri Std Build</h2>
<p>Builds every target with: <p>Builds every target with:
<pre>cargo miri setup</pre></p> <pre>cargo miri setup</pre></p>
<p>This checks that std builds (on targets that have it) but does not check whether codegen/linking works.</p> <p>This checks that std builds (on targets that have it) but does not check whether codegen/linking works.</p>

View file

@ -28,7 +28,8 @@ class Table {
const allTargets = new Set(); const allTargets = new Set();
const allNightlies = new Set(); const allNightlies = new Set();
const nightlyInfos = new Map(); // The infos grouped by target.
const targetInfos = new Map();
// Targets that have, at some point, errored // Targets that have, at some point, errored
const targetsWithErrors = new Set(); const targetsWithErrors = new Set();
@ -62,10 +63,10 @@ class Table {
} }
allTargets.add(info.target); allTargets.add(info.target);
if (!nightlyInfos.has(info.nightly)) { if (!targetInfos.has(info.target)) {
nightlyInfos.set(info.nightly, new Map()); targetInfos.set(info.target, new Map());
} }
nightlyInfos.get(info.nightly).set(info.target, info); targetInfos.get(info.target).set(info.nightly, info);
} }
const nightlies = Array.from(allNightlies); const nightlies = Array.from(allNightlies);
@ -75,34 +76,33 @@ class Table {
targets.sort(); targets.sort();
const header = document.createElement("tr"); const header = document.createElement("tr");
const headerNightly = document.createElement("th"); const headerTarget = document.createElement("th");
headerNightly.innerText = "nightly"; headerTarget.innerText = "target";
header.appendChild(headerNightly); header.appendChild(headerTarget);
targets.forEach((target) => { nightlies.forEach((target) => {
if (this.filter.filterFailed && !targetsWithErrors.has(target)) {
return;
}
const elem = document.createElement("th"); const elem = document.createElement("th");
elem.classList.add("target-header");
elem.innerText = target; elem.innerText = target;
header.appendChild(elem); header.appendChild(elem);
}); });
const rows = nightlies.map((nightly) => { const rows = targets.flatMap((target) => {
const tr = document.createElement("tr");
const nightlyCol = document.createElement("td");
nightlyCol.innerText = nightly;
tr.appendChild(nightlyCol);
const info = nightlyInfos.get(nightly) ?? new Map();
for (const target of targets) {
if (this.filter.filterFailed && !targetsWithErrors.has(target)) { if (this.filter.filterFailed && !targetsWithErrors.has(target)) {
continue; return [];
} }
const tr = document.createElement("tr");
const targetCol = document.createElement("td");
targetCol.innerText = target;
targetCol.classList.add("target-name-col");
tr.appendChild(targetCol);
const info = targetInfos.get(target) ?? new Map();
for (const nightly of nightlies) {
const td = document.createElement("td"); const td = document.createElement("td");
const targetInfo = info.get(target); const targetInfo = info.get(nightly);
if (targetInfo) { if (targetInfo) {
const a = document.createElement("a"); const a = document.createElement("a");
@ -112,8 +112,9 @@ class Table {
)}&target=${encodeURIComponent(target)}&mode=${encodeURIComponent( )}&target=${encodeURIComponent(target)}&mode=${encodeURIComponent(
targetInfo.mode targetInfo.mode
)}`; )}`;
a.innerText = targetInfo.status; a.innerText = targetInfo.status == "pass" ? "✅" : "❌";
td.appendChild(a); td.appendChild(a);
td.classList.add("build-cell");
td.classList.add(targetInfo.status); td.classList.add(targetInfo.status);
} else { } else {
td.innerText = ""; td.innerText = "";
@ -122,7 +123,7 @@ class Table {
tr.appendChild(td); tr.appendChild(td);
} }
return tr; return [tr];
}); });
this.elem.replaceChildren(header, ...rows); this.elem.replaceChildren(header, ...rows);
} }