Skip to content

Commit

Permalink
Documentation coverage badge
Browse files Browse the repository at this point in the history
  • Loading branch information
emilydolson committed Mar 5, 2021
1 parent 9614c68 commit 076bdeb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ jobs:
- run: docker build -t devosoft/empirical .
- run: docker ps -a
- run: sudo docker run devosoft/empirical /bin/bash -c "set -o pipefail && cd /opt/Empirical/doc && make html coverage | ./headtail.sh"
- run: docker cp devosoft/empirical:/opt/Empirical/doc/_build/doc-coverage.json .
- run: mkdir temp
- run: sudo docker run -v $HOME/temp:/transfer devosoft/empirical /bin/bash -c "python /opt/Empirical/doc/parse_documentation_coverage.py /opt/Empirical/doc/_build/doc-coverage.json >> /transfer/doc-coverage.json"
- uses: actions/upload-artifact@v2
with:
name: doc-coverage
path: doc-coverage.json
path: $HOME/temp/doc-coverage.json
deploy-dockerhub:
name: Deploy to DockerHub
runs-on: ubuntu-latest
Expand Down
14 changes: 14 additions & 0 deletions doc/parse_documentation_coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# from https://github.com/mmore500/conduit/blob/master/ci/parse_documentation_coverage.py

import json
import sys

with open(sys.argv[1]) as json_file:
data = json.load(json_file)
res = {
'schemaVersion' : 1,
'label' : 'documentation coverage',
'message' : '{:.1%}'.format(float(data['total']['coverage_rate'])),
'color' : 'orange',
}
print(json.dumps(res, sort_keys=True, indent=4))

0 comments on commit 076bdeb

Please sign in to comment.