Skip to content

428 modify examples and tutorials link #459

428 modify examples and tutorials link

428 modify examples and tutorials link #459

Workflow file for this run

name: Pytest
on:
pull_request:
push:
branches:
- main
jobs:
tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Unit tests
# running offline tests only
run: |
coverage run -m pytest -m offline
coverage xml
coverage json
coverage html
- name: Archive code coverage html report
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: htmlcov
- name: Get Cover
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract results
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
if: github.ref == 'refs/heads/main'
uses: schneegans/[email protected]
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
auth: ${{ secrets.GIST_TOKEN }}
gistID: 92452aca5c894f95fb934dc2a7a6815f # replace with your real Gist id.
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}