File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Generate coverage badges
2+ on :
3+ push :
4+ branches : [main]
5+
6+ permissions :
7+ contents : write
8+
9+ jobs :
10+ generate-badges :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ # setup go environment
16+ - name : Set up Go
17+ uses : actions/setup-go@v5
18+ with :
19+ go-version : 1.24.x
20+
21+ - name : coverage
22+ id : coverage
23+ run : |
24+ go test -coverpkg=./... -coverprofile=profile.cov ./...
25+ # sed -i '/cmd/d' profile.cov # remove cmd package from coverage
26+ total=$(go tool cover -func profile.cov | grep '^total:' | awk '{print $3}' | sed "s/%//")
27+ rm profile.cov
28+ echo "COVERAGE_VALUE=${total}" >> $GITHUB_ENV
29+
30+ - uses : actions/checkout@v4
31+ with :
32+ repository : sgaunet/gh-action-badge
33+ path : gh-action-badge
34+ ref : main
35+ fetch-depth : 1
36+
37+ - name : Generate coverage badge
38+ id : coverage-badge
39+ uses : ./gh-action-badge/.github/actions/gh-action-coverage
40+ with :
41+ limit-coverage : " 70"
42+ badge-label : " coverage"
43+ badge-filename : " coverage-badge.svg"
44+ badge-value : " ${COVERAGE_VALUE}"
45+
46+ - name : Print url of badge
47+ run : |
48+ echo "Badge URL: ${{ steps.coverage-badge.outputs.badge-url }}"
Original file line number Diff line number Diff line change 11[ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/sgaunet/gitlab-backup2s3 )] ( https://goreportcard.com/report/github.com/sgaunet/gitlab-backup2s3 )
22[ ![ GitHub release] ( https://img.shields.io/github/release/sgaunet/gitlab-backup2s3.svg )] ( https://github.com/sgaunet/gitlab-backup2s3/releases/latest )
33![ GitHub Downloads] ( https://img.shields.io/github/downloads/sgaunet/gitlab-backup2s3/total )
4+ ![ Test Coverage] ( https://raw.githubusercontent.com/wiki/sgaunet/gitlab-backup2s3/coverage-badge.svg )
5+ [ ![ GoDoc] ( https://godoc.org/github.com/sgaunet/gitlab-backup2s3?status.svg )] ( https://godoc.org/github.com/sgaunet/gitlab-backup2s3 )
46[ ![ License] ( https://img.shields.io/github/license/sgaunet/gitlab-backup2s3.svg )] ( LICENSE )
57
68# gitlab-backup2s3
You can’t perform that action at this time.
0 commit comments