-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (89 loc) · 2.74 KB
/
doc.yml
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
89
90
91
92
93
name: Documentation
on:
push:
branches:
- main
jobs:
coverage_report:
runs-on: ubuntu-latest
name: build coverage report
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Install dependencies
run: |
pip install -e .
- name: build coverage reports
run: |
pytest test --cov=src/nos --cov-report html:codecov --cov-report json
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: covdata
path: |
coverage.json
- name: package coverage report
run: |
zip -r coverage_report.zip codecov
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: covdata-html
path: coverage_report.zip
documentation:
name: documentation
needs: coverage_report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
name: Checkout
- name: Download coverage data
uses: actions/download-artifact@v3
with:
name: covdata
- name: Download coverage report
uses: actions/download-artifact@v3
with:
name: covdata-html
- name: Unpack coverage report
run: |
unzip coverage_report.zip
- name: Move into static sphinx dir
run: |
mv codecov doc/source/_static/codecov
- name: build website for detailed coverage
run: |
pip install sphinx
sphinx-apidoc -f -o doc/source/ src/nos
sphinx-build -M html doc/source doc/build
- name: deploy website
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: deployed-pages
github_token: ${{ secrets.DEPLOY_TOKEN }}
publish_dir: doc/build/html/
force_orphan: true
- name: Create json for badge
run: |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
- name: Make badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: 715271f51dd7b16c37fcf84c79dcb31a
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 95
valColorRange: ${{ env.total }}