Skip to content

Commit 9d443b6

Browse files
authored
GitHub Action: Upload test coverage to Codecov (#9)
1 parent 227c42c commit 9d443b6

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.github/workflows/go.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,30 @@ jobs:
5656
fi
5757

5858
test:
59-
runs-on: ubuntu-latest
6059
needs: diff
60+
runs-on: ubuntu-latest
6161
steps:
6262
- uses: actions/checkout@v4
6363
- uses: actions/setup-go@v5
6464
with:
6565
go-version-file: 'go.mod'
6666
- run: go mod download
6767
- run: go mod verify
68-
- run: go test -v -count=1 -race -shuffle=on ./...
68+
- run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.out -covermode=atomic ./...
69+
- uses: actions/upload-artifact@v4
70+
with:
71+
name: coverage
72+
path: coverage.out
73+
74+
codecov:
75+
needs: test
76+
runs-on: ubuntu-latest
77+
permissions:
78+
id-token: write
79+
steps:
80+
- uses: actions/download-artifact@v4
81+
with:
82+
name: coverage
83+
- uses: codecov/codecov-action@v4
84+
with:
85+
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<div align="center">
88

99
[![Go](https://github.com/typisttech/comver/actions/workflows/go.yml/badge.svg)](https://github.com/typisttech/comver/actions/workflows/go.yml)
10+
[![codecov](https://codecov.io/gh/typisttech/comver/graph/badge.svg?token=GVO7RV80TJ)](https://codecov.io/gh/typisttech/comver)
1011
[![Go Report Card](https://goreportcard.com/badge/github.com/typisttech/comver)](https://goreportcard.com/report/github.com/typisttech/comver)
1112
[![GitHub Release](https://img.shields.io/github/v/release/typisttech/comver?style=flat-square&)](https://github.com/typisttech/comver/releases/latest)
1213
[![Go Reference](https://pkg.go.dev/badge/github.com/typisttech/comver.svg)](https://pkg.go.dev/github.com/typisttech/comver)

0 commit comments

Comments
 (0)