Merge pull request #20 from JakobEliasWagner/bugfix/test-domain #12
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
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 }} |