forked from SPARC-X/SPARC-X-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from alchem0x2A/master
Add coverage report / workflow to documentation
- Loading branch information
Showing
8 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,23 +55,25 @@ jobs: | |
run: | | ||
mkdir -p badges/ | ||
# A coverage test badge | ||
anybadge --value=$COVPERCENT --file=badges/coverage.svg coverage | ||
anybadge --value=$COVPERCENT --file=badges/coverage.svg -l "Test Coverage" | ||
# A version badge | ||
PIPVER=`pip show sparc-x-api | grep Version | cut -d ' ' -f2` | ||
anybadge --value=$PIPVER --file=badges/package.svg -l sparc-x-api | ||
# api version badge | ||
anybadge --value=${API_VERSION} --file=badges/api_version.svg -l "JSON schema version" | ||
- name: Manually add git badges | ||
- name: Manually add git badges and .coverage file | ||
run: | | ||
# Assuming a badges branch already exists! | ||
rm -rf /tmp/*.svg && cp badges/*.svg /tmp/ | ||
rm -rf /tmp/.coverage && mv .coverage /tmp/ | ||
git fetch | ||
git switch badges || { echo "Could not check out badges branch. Have you created it on remote?"; exit 1; } | ||
git pull | ||
cp /tmp/*.svg badges/ && git add -f badges/*.svg && rm -rf /tmp/*.svg | ||
cp /tmp/.coverage ./ && git add -f .coverage && rm -rf /tmp/.coverage | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Action Bot (badges only)" | ||
git commit -m "Update badges from run ${RID}" || true | ||
git commit -m "Update badges and coverge file from run ${RID}" || true | ||
git push -u origin badges || true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
```{include} ../README.md | ||
:language: md | ||
:relative-docs: docs/ | ||
:relative-docs: doc/ | ||
:relative-images: | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Test Coverage Report | ||
|
||
The following coverage test was generated by the [`coverage` package](https://coverage.readthedocs.io/en/7.6.7/other.html): | ||
|
||
```{raw} html | ||
<iframe id="coverage-iframe" | ||
src="_static/htmlcov/index.html" | ||
width="100%" | ||
style="border:none;"></iframe> | ||
<script> | ||
function adjustIframeHeight() { | ||
var iframe = document.getElementById('coverage-iframe'); | ||
if (iframe && iframe.contentWindow && iframe.contentWindow.document.body) { | ||
iframe.style.height = (iframe.contentWindow.document.body.scrollHeight + 50) + 'px'; | ||
} | ||
} | ||
document.addEventListener("DOMContentLoaded", function() { | ||
const iframe = document.getElementById('coverage-iframe'); | ||
iframe.onload = adjustIframeHeight; // Adjust height when iframe content loads | ||
}); | ||
</script> | ||
``` |