Skip to content

Commit

Permalink
Chore: Add code coverage and other badges
Browse files Browse the repository at this point in the history
- Copied more badges from zitadel as a template

- Changed unit test actions to upload code coverage metrics to codecov

Signed-off-by: Anoop Gopalakrishnan <[email protected]>
  • Loading branch information
anoop2811 committed Apr 25, 2024
1 parent c49b62c commit ef980bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 28 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,10 @@ jobs:
- name: Run Make test
run: make test

- name: Go Coverage Badge # Pass the `coverage.out` output to this action
uses: tj-actions/coverage-badge-go@v2
- name: Publish coverage # Pass the `coverage.out` output to this action
uses: codecov/[email protected]
with:
filename: coverage.out
file: profile.cov
token: ${{ secrets.CODECOV_TOKEN }}

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
with:
files: README.md

- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: Updated coverage badge."
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ cross-compile:
# Testing
test:
@echo "Testing..."
@ginkgo -r $(TEST_FLAGS) -cover -covermode=count
@echo 'mode: count' > coverage.out
@find . -name "*coverprofile*" | xargs -I{} tail -q -n +2 {} >> coverage.out
@find . -name "*coverprofile*" | xargs -I{} rm {}
go tool cover -func=coverage.out -o=coverage.out
cat coverage.out
@go test -r $(TEST_FLAGS) -coverprofile=profile.cov ./...

docker-build: cross-compile
@echo "Building Local Docker image..."
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@

![Fern](https://github.com/guidewire/fern-reporter/raw/main/docs/images/logo-no-background.png)

<p align="center">
<a href="https://github.com/guidewire/fern-reporter/blob/main/LICENSE" alt="License">
<img src="https://badgen.net/github/license/guidewire/fern-reporter/" /></a>
<!-- <a href="https://github.com/guidewire/fern-reporter/actions" alt="Fern Reporter Release"> -->
<!-- <img alt="GitHub Workflow Status (with event)" src="https://img.shields.io/github/actions/workflow/status/guidewire/fern-reporter/build.yml?event=pull_request"></a> -->
<a href="https://goreportcard.com/report/github.com/guidewire/fern-reporter" alt="Go Report Card">
<img src="https://goreportcard.com/badge/github.com/guidewire/fern-reporter" /></a>
<a href="https://codecov.io/gh/guidewire/fern-reporter" alt="Code Coverage">
<img src="https://codecov.io/gh/guidewire/fern-reporter/branch/main/graph/badge.svg" /></a>
<a href="https://github.com/guidewire/fern-reporter/graphs/contributors" alt="Release">
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/guidewire/fern-reporter"></a>
</p>

## Introduction

Expand Down

0 comments on commit ef980bf

Please sign in to comment.