From f47df7c67365b73656ec3b86899e1acbf74625b2 Mon Sep 17 00:00:00 2001 From: Juan M Salamanca Date: Mon, 23 Sep 2024 16:25:58 +0200 Subject: [PATCH] feat: Add a code coverage badge --- .github/workflows/build.yml | 27 ++++++++++++++++++++++++++- README.md | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef464fb..911fb2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,8 @@ on: branches: "**" permissions: - contents: read + contents: write + pull-requests: write jobs: build: @@ -33,3 +34,27 @@ jobs: - name: Test with pytest run: | pytest + - name: Coverage Badge + uses: tj-actions/coverage-badge-py@v2 + + - name: Verify Changed files + uses: tj-actions/verify-changed-files@v16 + id: verify-changed-files + with: + files: coverage.svg + + - name: Commit files + if: steps.verify-changed-files.outputs.files_changed == 'true' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add coverage.svg + git commit -m "Updated coverage.svg" + + - name: Push changes + if: steps.verify-changed-files.outputs.files_changed == 'true' + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.head_ref }} + force_with_lease: true diff --git a/README.md b/README.md index e6f2f4a..ab24150 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ [![Documentation Status](https://readthedocs.org/projects/nada-dsl/badge/?version=latest)](https://nada-dsl.readthedocs.io/en/latest/?badge=latest) ![Build Status](https://github.com/NillionNetwork/nada-dsl/actions/workflows/build.yml/badge.svg) ![PyPI - Version](https://img.shields.io/pypi/v/nada-dsl) +![Code coverage](coverage.svg) # nada-dsl