forked from compare-ci/admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
88 lines (73 loc) · 2.41 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
<!DOCTYPE html>
<html>
<head>
<link href="graph/primer.css" rel="stylesheet">
<title>Compare CI</title>
</head>
<body>
<div class="pagehead bg-gray-dark text-white p-3">
<div class="">
<h1>Compare CI</h1>
</div>
</div>
<div id="container" class="m-3">
<p>Compares CI across multiple systems. Please see <a href="https://github.com/compare-ci">compare-ci</a>. Lower is better.</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
<script>
d3.csv('https://raw.githubusercontent.com/compare-ci/admin/master/data/data.csv')
.then(makeChart);
var container = document.getElementById("container")
function timeToSecs(time) {
let split = time.split(":");
return parseInt(split[0]) * 3600 + parseInt(split[1]) * 60 + parseInt(split[2])
}
function makeChart(rows) {
let colours = {
"Azure Pipelines": "blue",
"GitHub Actions": "firebrick",
//"Travis CI": "green",
"CircleCI Checks": "darkgrey"
}
let apps = Object.keys(colours);
rows = rows.slice(rows.length - (50 * apps.length), rows.length);
let repos = [...new Set(rows.map(function(d) {return d.Repo}))];
let urls = [...new Set(rows.map(function(d) {return '#' + d.URL.split('/')[6]}))];
for (let repoName of repos) {
let header = document.createElement("h2");
header.innerText = repoName;
header.className = "mt-2";
container.append(header);
let canvas = document.createElement("canvas");
container.append(canvas);
let ctx = canvas.getContext('2d');
let dataset = {};
for (let app of apps) {
dataset[app] = {
label: app,
backgroundColor: colours[app],
borderColor: colours[app],
data: [],
fill: false
}
}
for (let data of rows) {
if (data.Repo === repoName) {
dataset[data.App].data.push(timeToSecs(data.Total))
}
}
let chart = new Chart(ctx, {
type: 'line',
data: {
labels: urls,
datasets: Object.values(dataset)
},
// Configuration options go here
options: {}
});
}
}
</script>
</body>
</html>