From 7227bf12fc66439534f1e28d942386bee2816bcd Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 22 Dec 2024 22:44:16 +0300 Subject: [PATCH 1/3] add coverage badge Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/job_coverage.yml | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .gitea/workflows/job_coverage.yml diff --git a/.gitea/workflows/job_coverage.yml b/.gitea/workflows/job_coverage.yml new file mode 100644 index 00000000..3b9591b1 --- /dev/null +++ b/.gitea/workflows/job_coverage.yml @@ -0,0 +1,51 @@ +name: Go # The name of the workflow that will appear on Github + +on: + push: + branches: [ main, v3, v4 ] + pull_request: + branches: [ main, v3, v4 ] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + with: + filter: 'blob:none' + + - name: setup go + uses: actions/setup-go@v5 + with: + cache-dependency-path: "**/*.sum" + go-version: 'stable' + + - name: test coverage + run: | + go test -v -cover ./... -coverprofile coverage.out -coverpkg ./... + go tool cover -func coverage.out -o coverage.out + + - name: coverage badge + uses: tj-actions/coverage-badge-go@v1 + with: + green: 80 + filename: coverage.out + + - uses: stefanzweifel/git-auto-commit-action@v4 + id: auto-commit-action + with: + commit_message: Apply Code Coverage Badge + skip_fetch: true + skip_checkout: true + file_pattern: ./README.md + + - name: Push Changes + if: steps.auto-commit-action.outputs.changes_detected == 'true' + uses: ad-m/github-push-action@master + with: + github_token: ${{ github.token }} + branch: ${{ github.ref }} \ No newline at end of file -- 2.45.2 From e14f489ea8ffa9f402e7ec177372b5e810107007 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 22 Dec 2024 22:46:08 +0300 Subject: [PATCH 2/3] add coverage badge Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/job_coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/job_coverage.yml b/.gitea/workflows/job_coverage.yml index 3b9591b1..e176edca 100644 --- a/.gitea/workflows/job_coverage.yml +++ b/.gitea/workflows/job_coverage.yml @@ -1,4 +1,4 @@ -name: Go # The name of the workflow that will appear on Github +name: coverage on: push: -- 2.45.2 From 9cb00bef58cdd2e41a21446f09bb4ca0cc415a34 Mon Sep 17 00:00:00 2001 From: vtolstov Date: Sun, 22 Dec 2024 19:47:44 +0000 Subject: [PATCH 3/3] Apply Code Coverage Badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1b945697..4d3571e8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Micro [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Doc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/unistack-org/micro/v3?tab=overview) [![Status](https://git.unistack.org/unistack-org/micro/actions/workflows/job_tests.yml/badge.svg?branch=v3)](https://git.unistack.org/unistack-org/micro/actions?query=workflow%3Abuild+branch%3Av3+event%3Apush) [![Lint](https://goreportcard.com/badge/go.unistack.org/micro/v3)](https://goreportcard.com/report/go.unistack.org/micro/v3) +![Coverage](https://img.shields.io/badge/Coverage-45.1%25-yellow) Micro is a standard library for microservices. -- 2.45.2