Skip to content

Commit

Permalink
adding custom gist-driven dynamic coverage badge
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodges committed Feb 1, 2024
1 parent be4e503 commit 35ff7ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing
name: Tests

on:
push:
Expand Down Expand Up @@ -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

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 35ff7ad

Please sign in to comment.