Skip to content

Commit 6d4296e

Browse files
committed
Add coverage badge
1 parent 9bce287 commit 6d4296e

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/ci.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,29 @@ jobs:
1717
- name: Build
1818
run: go build -v ./...
1919
- name: Test with the Go CLI
20-
run: go test
20+
run: |
21+
go test -v ./... -covermode=count -coverprofile=coverage.out
22+
go tool cover -func=coverage.out -o=coverage.out
23+
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
24+
uses: tj-actions/coverage-badge-go@v2
25+
with:
26+
filename: coverage.out
27+
- name: Verify Changed files
28+
uses: tj-actions/verify-changed-files@v16
29+
id: verify-changed-files
30+
with:
31+
files: README.md
32+
- name: Commit changes
33+
if: steps.verify-changed-files.outputs.files_changed == 'true'
34+
run: |
35+
git config --local user.email "action@github.com"
36+
git config --local user.name "GitHub Action"
37+
git add README.md
38+
git commit -m "chore: Updated coverage badge."
39+
- name: Push changes
40+
if: steps.verify-changed-files.outputs.files_changed == 'true'
41+
uses: ad-m/github-push-action@master
42+
with:
43+
github_token: ${{ github.token }}
44+
branch: ${{ github.head_ref }}
2145

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# RingChan
22

33
[![CI](https://github.com/floatdrop/ringchan/actions/workflows/ci.yaml/badge.svg)](https://github.com/floatdrop/ringchan/actions/workflows/ci.yaml)
4+
![Coverage](https://img.shields.io/badge/Coverage-100.0-brightgreen)
45
[![Go Report Card](https://goreportcard.com/badge/github.com/floatdrop/ringchan)](https://goreportcard.com/report/github.com/floatdrop/ringchan)
56
[![Go Reference](https://pkg.go.dev/badge/github.com/floatdrop/ringchan.svg)](https://pkg.go.dev/github.com/floatdrop/ringchan)
67
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)