Skip to content

Commit 1a3fad4

Browse files
committed
Update ci.yml
1 parent d1ac22c commit 1a3fad4

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,34 @@ jobs:
2121
2222
- name: Unit tests
2323
run: |
24-
sudo go test ./... -coverprofile coverage.out -covermode count
25-
sudo go tool cover -func coverage.out
24+
go test -v ./... -covermode=count -coverprofile=coverage.out
25+
go tool cover -func=coverage.out -o=coverage.out
26+
27+
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
28+
uses: tj-actions/coverage-badge-go@v2
29+
with:
30+
filename: coverage.out
31+
32+
- name: Verify Changed files
33+
uses: tj-actions/verify-changed-files@v9.1
34+
id: verify-changed-files
35+
with:
36+
files: README.md
37+
38+
- name: Commit changes
39+
if: steps.verify-changed-files.outputs.files_changed == 'true'
40+
run: |
41+
git config --local user.email "action@github.com"
42+
git config --local user.name "GitHub Action"
43+
git add README.md
44+
git commit -m "chore: Updated coverage badge."
45+
46+
- name: Push changes
47+
if: steps.verify-changed-files.outputs.files_changed == 'true'
48+
uses: ad-m/github-push-action@master
49+
with:
50+
github_token: ${{ github.token }}
51+
branch: ${{ github.head_ref }}
2652

2753
- name: Quality Gate - Test coverage shall be above threshold
2854
env:

0 commit comments

Comments
 (0)