-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (32 loc) · 1.05 KB
/
goCodeCoverage.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Go Code Coverage Test and Badge
on:
pull_request:
branches:
- main
jobs:
badge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- name: generate test generate coverage
run: go test ./... -coverprofile=./cover.out
- name: check test coverage
id: coverage ## this step must have id
uses: vladopajic/go-test-coverage@v2
with:
profile: cover.out
local-prefix: github.com/org/project
threshold-file: 0
threshold-package: 0
threshold-total: 0
- name: make coverage badge
uses: action-badges/[email protected]
# if: contains(github.ref, 'main')
with:
label: coverage
message: ${{ steps.coverage.outputs.badge-text }}
message-color: ${{ steps.coverage.outputs.badge-color }}
file-name: coverage.svg
badge-branch: badges ## orphan branch where badge will be committed
github-token: "${{ secrets.GITHUB_TOKEN }}"