From 35ff7ad64d22ab19b8b8a52a0eb3269b544326ad Mon Sep 17 00:00:00 2001 From: Ryan Hodges Date: Wed, 31 Jan 2024 17:52:05 -0800 Subject: [PATCH] adding custom gist-driven dynamic coverage badge --- .github/workflows/django.yml | 26 ++++++++++++++++++++------ README.md | 1 + 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 6984c6b..9f1ffa5 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -1,4 +1,4 @@ -name: Testing +name: Tests on: push: @@ -29,11 +29,25 @@ jobs: - name: Run Tests run: | coverage run --source='.' ci_testing/mp_layers_testing/manage.py test layers.tests.test_models + - name: Set Coverage + id: set_coverage + run: | COV=`coverage report --format=total` - echo "{'coverage':$COV}" > /tmp/coverage_badge.json - - name: Archive test coverage results - uses: actions/upload-artifact@v4 + echo "::set-output name=coverage::$COV" + # echo "$COV%" + # echo "{'coverage':$COV}" > /tmp/coverage_badge.json + # - name: Archive test coverage results + # uses: actions/upload-artifact@v4 + # with: + # name: test-coverage-report_py-${{ matrix.python-version }} + # path: /tmp/coverage_badge.json + - name: Create Coverage Badge + uses: schneegans/dynamic-badges-action@v1.7.0 with: - name: test-coverage-report_py-${{ matrix.python-version }} - path: /tmp/coverage_badge.json + auth: ${{ secrets.COVERAGE_GIST_SECRET }} + gistID: 20cd92a8df1c63f3e6447540e67cddfd + filename: mpl_coverage.json + label: Coverage + message: "${{ steps.set_coverage.outputs.coverage }}" + color: green diff --git a/README.md b/README.md index e9b4592..63b8175 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,4 @@ Madrona Portal's Layer Manager [![Test Build](https://github.com/Ecotrust/mp-layers/actions/workflows/django.yml/badge.svg?branch=main)](https://github.com/Ecotrust/mp-layers/actions/workflows/django.yml) +![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/rhodges/20cd92a8df1c63f3e6447540e67cddfd/raw/mpl_coverage.json)