-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
232 lines (204 loc) · 6.34 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html>
<html>
<head>
<title>Crate validation</title>
<style>
table,
th {
font-size: 16px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border: 1px solid black;
border-collapse: collapse;
border-spacing: 0;
}
.column {
float: left;
width: 50%;
}
.column-follow {
position: fixed;
top: 20px;
width: 100%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
textarea {
height: 800px;
width: 95%;
padding: 1%;
border: none;
}
#search-input {
width: 80%;
font-size: 16px;
padding: 12px 20px 12px 12px;
border: 1px solid #ddd;
margin-bottom: 12px;
}
</style>
</head>
<body>
<script>
var data = null;
function show_error(tcell) {
if (data === null) {
console.error("Clicked show_error before data loaded");
}
let crate_name = tcell.srcElement.parentElement.childNodes[0].innerText;
for (let profile of data) {
if (profile.name == crate_name) {
var textarea = document.getElementById("error-log");
var header = document.getElementById("error-log-name");
textarea.value = profile.build_errors;
textarea.setAttribute("value", profile.build_errors);
header.innerText = `Crate: ${crate_name}`;
return;
}
}
console.error(`Failed to find name: ${crate_name}`);
}
async function findMostRecentHash() {
return await fetch("results/index.json")
.then(res => res.json())
.then(data => {
// Find the most recent timestamp
let mostRecent = data.reduce((prev, current) => (prev.timestamp > current.timestamp) ? prev : current);
// Retrieve the hash related to the most recent timestamp
let mostRecentHash = mostRecent.hash;
return mostRecentHash;
})
.catch(err => { console.error(err) });
}
async function readContent(hash) {
let filename = `results/${hash}.json`;
return await fetch(filename)
.then(res => res.json())
.then(data => data)
.catch(err => { console.error(err) });
}
async function fetch_json() {
try {
const mostRecentHash = await findMostRecentHash();
const jsonData = await readContent(mostRecentHash);
return jsonData;
} catch (error) {
console.error(error);
}
}
const headers = ["name", "version", "status", "custom profile"];
async function render_results() {
data = await fetch_json();
var table = document.getElementById("result-table");
let thead = table.createTHead();
let hrow = thead.insertRow();
// Construct able header
for (const key of headers) {
let th = document.createElement("th");
let text = document.createTextNode(key);
th.appendChild(text);
hrow.appendChild(th);
}
var successes = 0;
var failed = 0;
var skipped = 0;
var customized = 0;
const total = data.length;
for (let profile of data) {
let row = table.insertRow();
for (key of headers) {
var table_data = "";
let cell = row.insertCell();
switch (key) {
case "name":
table_data = profile.name;
break;
case "version":
table_data = profile.version;
break;
case "status":
table_data = profile.status;
if (table_data == "Success") {
successes++;
cell.style.backgroundColor = "green";
} else if (table_data == "Skipped") {
skipped++;
cell.style.backgroundColor = "yellow";
} else {
failed++;
cell.onclick = show_error;
cell.style.backgroundColor = "red";
}
break;
case "custom profile":
if (profile.custom_profile) {
table_data = "True";
customized++;
}
break;
default:
console.error(`Unknown header key: ${key}`);
}
let text = document.createTextNode(table_data);
cell.appendChild(text);
}
}
var summary_node = document.getElementById("res-summary");
var p_node = document.createElement("p");
summary_node.appendChild(p_node);
const success_rate = ((successes / total) * 100).toFixed(2);
const text_node = document.createTextNode(`Successes: ${successes}/${total} (${success_rate} %) | Skipped: ${skipped}/${total} | Failed: ${failed}/${total} | customized: ${customized}`);
p_node.appendChild(text_node);
}
function search_errors() {
const input_node = document.getElementById('search-input');
const search_str = input_node.value;
var result_str = "";
var counter = 0;
for (let profile of data) {
const err_str = profile.build_errors;
if (err_str === null || err_str.length == 0) {
continue;
}
if (err_str.includes(search_str)) {
result_str += profile.name + "\n";
counter++;
}
}
result_str = `Found: ${counter} crates matching:\n` + result_str;
var textarea = document.getElementById("error-log");
textarea.value = result_str;
textarea.setAttribute("value", result_str);
var header = document.getElementById("error-log-name");
header.innerText = "";
}
(async () => {
await render_results();
})();
</script>
</body>
<h2>Crate Results</h2>
<p>
Each night, we test compatibility between each of the top 1000 Rust crates and the RISC Zero zkVM.
This page shows the results of those tests.
</p>
<div id="results">
<div id="res-summary"></div>
<div class="result-holder">
<div class="column">
<table id="result-table"></table>
</div>
<div class="column">
<div class="column-follow">
<input type="text" id="search-input" onkeyup="search_errors()" placeholder="Exact string match in build errors">
<h4>Build Errors</h4>
<p id="error-log-name"></p>
<textarea id="error-log"> </textarea>
</div>
</div>
</div>
</div>
</html>