Skip to content

Commit

Permalink
chore: add cover for 4c1beb1
Browse files Browse the repository at this point in the history
  • Loading branch information
go-coverage-action committed May 15, 2024
1 parent 0154765 commit 2d7aa04
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 0 deletions.
78 changes: 78 additions & 0 deletions go-test-app-02/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Waiting for GitHub Pages Deployment</title>
<style>
@import url('nord.css');
body {
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
}
#spinner {
display: none;
border: 4px solid var(--nord1);
border-top: 4px solid var(--nord3);
border-radius: 50%;
width: 25px;
height: 25px;
animation: spin 2s linear infinite;
}
p {
font-size: 12px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<script>
function getHashFromQueryString() {
const params = new URLSearchParams(window.location.search);
return params.get("hash");
}

async function checkFileExists(url) {
try {
const response = await fetch(url, { method: "HEAD" });
return response.ok;
} catch (error) {
return false;
}
}

async function waitForFileToExist(url, interval = 2000) {
while (true) {
if (await checkFileExists(url)) {
return true;
}
await new Promise((resolve) => setTimeout(resolve, interval));
}
}

async function loadContent() {
const spinner = document.getElementById("spinner");
const hash = getHashFromQueryString();
const fileUrl = `revisions/${hash}.html`;

spinner.style.display = "block";

await waitForFileToExist(fileUrl);

window.location.href = fileUrl;
}

document.addEventListener("DOMContentLoaded", loadContent);

</script>
</head>
<body>
<div id="spinner"></div>
<p>Waiting for GitHub Pages Deployment</p>
</body>
</html>
8 changes: 8 additions & 0 deletions go-test-app-02/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let pres = document.querySelectorAll('#content pre');

pres.forEach((pre) => {
let lines = pre.innerHTML.split('\n');
pre.style.setProperty('--ln-width', lines.length.toString().length);
let linesWithNumbers = lines.map((l, i) => `<span class="ln">${i+1}</span>${l}`);
pre.innerHTML = linesWithNumbers.join('\n');
});
83 changes: 83 additions & 0 deletions go-test-app-02/nord.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
:root {
--ln-width: 3;
--nord-deep-dark: #242931;
--nord0: #2e3440;
--nord0-pale: rgba(46, 52, 64, 0.3);
--nord1: #3b4252;
--nord1-pale: rgba(59, 66, 82, 0.3);
--nord2: #434c5e;
--nord2-pale: rgba(67, 76, 94, 0.3);
--nord3: #4c566a;
--nord3-pale: rgba(76, 86, 106, 0.3);
--nord4: #d8dee9;
--nord4-pale: rgba(216, 222, 232, 0.3);
--nord5: #e5e9f0;
--nord5-pale: rgba(229, 233, 240, 0.3);
--nord6: #eceff4;
--nord6-pale: rgba(236, 239, 244, 0.3);
--nord7: #8fbcbb;
--nord7-pale: rgba(143, 188, 187, 0.3);
--nord8: #88c0d0;
--nord9: #81a1c1;
--nord10: #5e81ac;
--nord10-pale: rgba(94, 129, 172, 0.3);
--nord11: #bf616a;
--nord11-pale: rgba(191, 97, 106, 0.3);
--nord12: #d08770;
--nord12-pale: rgba(208, 135, 112, 0.3);
--nord13: #ebcb8b;
--nord13-pale: rgba(235, 203, 139, 0.3);
--nord14: #a3be8c;
--nord14-pale: rgba(163, 190, 140, 0.3);
--nord15: #b48ead;
--nord15-pale: rgba(180, 140, 173, 0.3);
}

* {
font-family: Menlo, Monaco, source-code-pro, "Ubuntu Mono", "DejaVu sans mono", Consolas, monospace, Menlo, Monaco, "Courier New", monospace;
font-weight: normal !important;
font-size: 14px;
}

body {
background: var(--nord0) !important;
color: var(--nord3) !important;
}

#topbar {
background: var(--nord1) !important;
border-color: var(--nord3) !important;
}

select {
background-color: var(--nord-deep-dark);
color: var(--nord9);
border: 1px solid var(--nord3);
border-radius: 3px;
padding: 2px;
}

pre {
line-height: 1.4em;
}

.ln {
display: inline-block;
min-width: calc(0.48em * (var(--ln-width) + 1));
text-align: right;
margin-right: 15px;
padding-right: 10px;
color: var(--nord3);
}

.cov0, .cov0 .ln { color: var(--nord11) !important; }
.cov1, .cov1 .ln { color: var(--nord13) !important; }
.cov2, .cov2 .ln { color: var(--nord14) !important; }
.cov3, .cov3 .ln { color: var(--nord14) !important; }
.cov4, .cov4 .ln { color: var(--nord14) !important; }
.cov5, .cov5 .ln { color: var(--nord14) !important; }
.cov6, .cov6 .ln { color: var(--nord14) !important; }
.cov7, .cov7 .ln { color: var(--nord14) !important; }
.cov8, .cov8 .ln { color: var(--nord14) !important; }
.cov9, .cov9 .ln { color: var(--nord14) !important; }
.cov10, .cov10 .ln { color: var(--nord14) !important; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Go Coverage Report</title>
<style>@import url("../nord.css");
body {
background: black;
color: rgb(80, 80, 80);
}
body, pre, #legend span {
font-family: Menlo, monospace;
font-weight: bold;
}
#topbar {
background: black;
position: fixed;
top: 0; left: 0; right: 0;
height: 42px;
border-bottom: 1px solid rgb(80, 80, 80);
}
#content {
margin-top: 50px;
}
#nav, #legend {
float: left;
margin-left: 10px;
}
#legend {
margin-top: 12px;
}
#nav {
margin-top: 10px;
}
#legend span {
margin: 0 5px;
}
.cov0 { color: rgb(192, 0, 0) }
.cov1 { color: rgb(128, 128, 128) }
.cov2 { color: rgb(116, 140, 131) }
.cov3 { color: rgb(104, 152, 134) }
.cov4 { color: rgb(92, 164, 137) }
.cov5 { color: rgb(80, 176, 140) }
.cov6 { color: rgb(68, 188, 143) }
.cov7 { color: rgb(56, 200, 146) }
.cov8 { color: rgb(44, 212, 149) }
.cov9 { color: rgb(32, 224, 152) }
.cov10 { color: rgb(20, 236, 155) }

</style>
</head>
<body>
<div id="topbar">
<div id="nav">
<select id="files">

</select>
</div>
<div id="legend">
<span>not tracked</span>

<span class="cov0">no coverage</span>
<span class="cov1">low coverage</span>
<span class="cov2">*</span>
<span class="cov3">*</span>
<span class="cov4">*</span>
<span class="cov5">*</span>
<span class="cov6">*</span>
<span class="cov7">*</span>
<span class="cov8">*</span>
<span class="cov9">*</span>
<span class="cov10">high coverage</span>

</div>
</div>
<div id="content">

</div>
</body>
<script>
(function() {
var files = document.getElementById('files');
var visible;
files.addEventListener('change', onChange, false);
function select(part) {
if (visible)
visible.style.display = 'none';
visible = document.getElementById(part);
if (!visible)
return;
files.value = part;
visible.style.display = 'block';
location.hash = part;
}
function onChange() {
select(files.value);
window.scrollTo(0, 0);
}
if (location.hash != "") {
select(location.hash.substr(1));
}
if (!visible) {
select("file0");
}
})();
</script><script src="../index.js"></script>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mode: set
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
total: (statements) 0.0%
Loading

0 comments on commit 2d7aa04

Please sign in to comment.