:fix: correct plot scaling calculation and leaf parameters #1137
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: Code Coverage Assessment | |
# Run in addition to unit tests without coverage assessment in case of weirdness around | |
# parallelised code. Also regenerates coverage badge. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
outputs: | |
percentage: ${{ steps.cov.outputs.percentage }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Install test dependencies | |
run: pip install -e .[test] | |
- name: Assess coverage of unit tests | |
run: pytest tests/unit --cov | |
- name: Extract total coverage percentage | |
id: cov | |
run: echo "percentage=$( coverage report --format=total )" >> $GITHUB_OUTPUT | |
coverage-badge: | |
name: Update coverage badge | |
if: github.event_name == 'push' | |
# Push coverage badge config to a GitHub Gist. The Gist can currently only be hosted | |
# by a user rather than an organisation. A PAT with write Gist permissions needs to | |
# be saved as a secret of this repo. The PAT and Gist ID need updating if the host | |
# user changes. | |
needs: | |
- coverage | |
env: | |
percentage: ${{ needs.coverage.outputs.percentage }} | |
GITHUB_TOKEN: ${{ secrets.COVERAGE_GIST_KEY }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Choose badge colour | |
id: design | |
run: | | |
echo "colour=${{ | |
env.percentage >= 90 && 'brightgreen' || | |
env.percentage >= 70 && 'yellow' || | |
env.percentage >= 50 && 'orange' || | |
'red' | |
}}" >> $GITHUB_OUTPUT | |
- name: Generate badge config JSON | |
run: | | |
echo "coverage = ${{ env.percentage }}%" | |
echo "colour = ${{ steps.design.outputs.colour }}" | |
{ | |
echo "{" | |
echo " \"schemaVersion\": 1," | |
echo " \"label\": \"Coverage\"," | |
echo " \"message\": \"${{ env.percentage }}%\"," | |
echo " \"color\": \"${{ steps.design.outputs.colour }}\"" | |
echo "}" | |
} > badge.json | |
- name: Write Gist | |
env: | |
gist_id: 51dd332be75961a7dc903c67718028e1 | |
out_name: coreax_coverage.json | |
run: gh gist edit ${{ env.gist_id }} -a ${{ env.out_name }} badge.json |