From: Vladimír Vondruš Date: Sat, 23 Feb 2019 00:32:43 +0000 (+0100) Subject: site: show coverage info in Build Status. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=d648a3f7bf207f6273c033b216281f2d07a67a84;p=blog.git site: show coverage info in Build Status. --- diff --git a/doc/build-status.html.in b/doc/build-status.html.in new file mode 100644 index 00000000..f3cd1369 --- /dev/null +++ b/doc/build-status.html.in @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Python
3.4
Python
3.5
Python
3.6
code coverage 
 
Pelican theme 
 
 
 
 
 
Pelican plugins
Graph rendering
Doxygen theme
Doxygen theme
client search
 
 
Math rendering
diff --git a/doc/build-status.js b/doc/build-status.js index 074d5bea..cc080434 100644 --- a/doc/build-status.js +++ b/doc/build-status.js @@ -119,6 +119,39 @@ function fetchLatestTravisJobs(project, branch) { req.send(); } +function fetchLatestCodecovJobs(project, branch) { + var req = window.XDomainRequest ? new XDomainRequest() : new XMLHttpRequest(); + if(!req) return; + + req.open("GET", 'https://codecov.io/api/gh/' + project + '/branch/' + branch, true); + req.responseType = 'json'; + req.onreadystatechange = function() { + if(req.readyState != 4) return; + + //console.log(req.response); + + var repo = req.response['repo']['name']; + var id = 'coverage-' + repo.replace("m.css", "mcss"); + var elem = document.getElementById(id); + + var commit = req.response['commit']; + var coverage = (commit['totals']['c']*1.0).toFixed(1); + var type; + if(commit['state'] != 'complete') type = 'm-info'; + else if(Math.round(coverage) > 90) type = 'm-success'; + else if(Math.round(coverage) > 50) type = 'm-warning'; + else type = 'm-danger'; + + var date = commit['updatestamp']; + var age = timeDiff(new Date(Date.parse(date)), new Date(Date.now())); + + elem.innerHTML = '' + coverage + '%
' + age + '
'; + elem.className = type; + }; + req.send(); +} + for(var i = 0; i != projects.length; ++i) { fetchLatestTravisJobs(projects[i][0], projects[i][1]); + fetchLatestCodecovJobs(projects[i][0], projects[i][1]); } diff --git a/doc/build-status.rst b/doc/build-status.rst index 756cbdd9..d5a13e80 100644 --- a/doc/build-status.rst +++ b/doc/build-status.rst @@ -40,47 +40,8 @@ Show builds for: .. container:: m-scroll - .. raw:: html + .. can't name it HTML, because then Pelican tries to parse it (and + can't disable HTML parsing because we need that for layout tests) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Python
3.4
Python
3.5
Python
3.6
Pelican theme 
 
 
 
 
 
Pelican plugins
Graph rendering
Doxygen theme
Doxygen theme
client search
 
 
Math rendering
+ .. raw:: html + :file: build-status.html.in