Skip to content

Cleanup (#50)

Cleanup (#50) #59

Workflow file for this run

name: Documentation
on:
push:
branches:
- main
jobs:
coverage_report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup venv
uses: ./.github/actions/setup-venv
with:
python-version: "3.11"
os-name: "ubuntu-latest"
optional-dependencies: "[test,optimize]"
- name: Run pytest
run: |
pytest --ignore continuity --cov=src/nos --cov-report html:codecov --cov-report json:cov.json
- name: Install zip
run: |
sudo apt-get update
sudo apt-get install zip -y
- name: package coverage report
run: |
zip -r coverage_report.zip codecov
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: cov-html-zip
path: coverage_report.zip
- name: Upload coverage json
uses: actions/upload-artifact@v4
with:
name: cov-json
path: cov.json
documentation:
name: documentation
needs: coverage_report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup venv
uses: ./.github/actions/setup-venv
with:
python-version: "3.11"
os-name: "ubuntu-latest"
optional-dependencies: "[doc]"
- name: Download coverage html zip
uses: actions/download-artifact@v4
with:
name: cov-html-zip
- name: Install zip
run: |
sudo apt-get update
sudo apt-get install zip -y
- name: Unzip coverage html
run: unzip coverage_report.zip
- name: Move into static sphinx dir
run: mv codecov docs/source/_static/codecov
- name: build website for detailed coverage
run: |
sphinx-apidoc -f -o docs/source/ src/nos
sphinx-build -M html docs/source docs/build
- name: deploy website
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: deployed-pages
github_token: ${{ secrets.DEPLOY_TOKEN }}
publish_dir: docs/build/html/
force_orphan: true
- name: Download coverage json
uses: actions/download-artifact@v4
with:
name: cov-json
- name: Create json for badge
run: |
export TOTAL=$(python -c "import json;print(json.load(open('cov.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 }}