-
-
Notifications
You must be signed in to change notification settings - Fork 82
49 lines (48 loc) · 1.4 KB
/
coverage.yml
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# Code coverage report
#
# Reports tests code coverage to coveralls.
# Uses COVERALLS_TOKEN env var from GitHub repo secrets.
#
# see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
#
name: Submit code coverage
on:
push:
branches:
- master
env:
GO111MODULE: on
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "^1.21.0"
- uses: actions/checkout@v4
- name: Go Build Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Go Mod Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- run: go version
- name: install
run: |
go get golang.org/x/tools/cmd/cover
- name: Test
run: cat tools/cover.txt | xargs go test -v -covermode=count -coverprofile=coverage.out
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out