diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0e7541b3..59898e7a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,9 +26,6 @@ permissions: jobs: linter: runs-on: ubuntu-latest - defaults: - run: - working-directory: config/ steps: - name: Checkout Code Repository uses: actions/checkout@main @@ -36,7 +33,7 @@ jobs: - name: Set up Python uses: actions/setup-python@main with: - python-version: $MIN_PYTHON_VERSION + python-version: ${{ env.MIN_PYTHON_VERSION }} - name: Run pre-commit uses: pre-commit/action@main diff --git a/python/conftest.py b/python/conftest.py index dfcd2ff1..237d6751 100644 --- a/python/conftest.py +++ b/python/conftest.py @@ -5,7 +5,9 @@ from typing import Final import pytest +from coverage_badge.__main__ import main as gen_cov_badge +BADGE_PATH: Final[Path] = Path("docs") / "assets" / "coverage.svg" CLIMATE_DATA_MOUNT_PATH = Path("/mnt/vmfileshare/ClimateData") TEST_PATH = Path().absolute() PYTHON_DIR_NAME: Final[Path] = Path("python") @@ -49,3 +51,10 @@ def doctest_auto_fixtures( doctest_namespace["is_climate_data_mounted"] = is_climate_data_mounted doctest_namespace["pprint"] = pprint doctest_namespace["pytest"] = pytest + + +def pytest_sessionfinish(session, exitstatus): + """Generate badges for docs after tests finish.""" + if exitstatus == 0: + BADGE_PATH.parent.mkdir(parents=True, exist_ok=True) + gen_cov_badge(["-o", f"{BADGE_PATH}", "-f"])