Skip to content

adding custom gist-driven dynamic coverage badge #15

adding custom gist-driven dynamic coverage badge

adding custom gist-driven dynamic coverage badge #15

Workflow file for this run

name: Tests
on:
push:
branches: [ "main", "ci_testing" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r ci_testing/test_requirements.txt
pip install -r requirements.txt
- 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 "::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:
auth: ${{ secrets.COVERAGE_GIST_SECRET }}
gistID: 20cd92a8df1c63f3e6447540e67cddfd
filename: mpl_coverage.json
label: Coverage
message: "${{ steps.set_coverage.outputs.coverage }}"
color: green