diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml index 08f4249..a89fb36 100644 --- a/.github/workflows/deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -1,4 +1,4 @@ -name: Deploy docs +name: GitHub Pages on: push: diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 78d19eb..b2d3a21 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Run tests +name: Tests, Code Quality and Documentation on: push: @@ -43,6 +43,7 @@ jobs: - name: Run tests run: | poetry run pytest --cov=pystatis tests + code-quality: runs-on: ${{ matrix.os }} timeout-minutes: 10 @@ -50,12 +51,13 @@ jobs: fail-fast: false matrix: # only support specific python version, as guidelines differ beween (minor) versions - python-version: ["3.11.6"] + python-version: ["3.11.7"] os: [ubuntu-latest] steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Run poetry image @@ -78,7 +80,8 @@ jobs: run: poetry run safety check - name: Run mypy run: poetry run mypy src - sphinx-documentation: + + sphinx-documentation-and-coverage: runs-on: ${{ matrix.os }} timeout-minutes: 10 strategy: @@ -111,3 +114,17 @@ jobs: name: docs path: docs/build/html/* retention-days: 5 + - name: Generate and filter test coverage report + run: | + poetry run coverage run -m pytest + poetry run coverage json -o assets/coverage.json + cov=$(jq -r '.totals.percent_covered_display' assets/coverage.json) + echo "{\"label\":\"Test Coverage\",\"message\":\"${cov}%\",\"schemaVersion\":1,\"color\":\"hsl(120, 100%, 40%)\"}" > assets/coverage_badge.json + # compromise: Due to versioning issues, only display + # coverage (report) for main (on/push/branches/main) + - name: Prepare files + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: | + set -e + mkdir -p output/publish + cp assets/coverage_badge.json output/publish/ diff --git a/README.md b/README.md index 123c6c6..027eec0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # ``pystatis`` +![Tests, Code Quality and Documentation](https://github.com/CorrelAid/pystatis/actions/workflows/run-tests.yaml/badge.svg?event=push) +![Code Coverage](https://img.shields.io/endpoint?url=https%3A%2F%2Fcorrelaid.github.io%2Fpystatis%2Fpublish%2Fcoverage_badge.json +) +![GitHub Pages Documentation](https://github.com/CorrelAid/pystatis/actions/workflows/deploy-docs.yaml/badge.svg?event=push) + ```pystatis``` is a Python wrapper for the different GENESIS web service interfaces (API). Currently we are supporting the following databases: - [GENESIS-Online](https://www-genesis.destatis.de/genesis/online)