File tree Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : Coverage
2
+
3
+ on :
4
+ push :
5
+ branches : master
6
+ pull_request :
7
+ branches : master
8
+
9
+ jobs :
10
+ coverage :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+
14
+ - uses : actions/checkout@v2
15
+
16
+ - name : Set up Go 1.17
17
+ uses : actions/setup-go@v1
18
+ with :
19
+ go-version : 1.17
20
+
21
+ - name : Coverage
22
+ id : coverage
23
+ run : |
24
+ go test -v -coverprofile=cov.out ./...
25
+ go tool cover -html=cov.out -o coverage.html
26
+ COV=$(go tool cover -func=cov.out | awk '/total/ { gsub("%", "", $3); print $3 }')
27
+ (( $(echo "${COV} > ${MIN_COV}" | bc -l) )) && STATE=success || STATE=failure
28
+ echo "::set-output name=COV::${COV}% (Required ${MIN_COV}%)"
29
+ echo "::set-output name=STATE::${STATE}"
30
+ env :
31
+ MIN_COV : 70
32
+
33
+ - uses : Sibz/github-status-action@v1
34
+ with :
35
+ authToken : ${{secrets.GITHUB_TOKEN}}
36
+ description : ' ${{steps.coverage.outputs.COV}}'
37
+ context : ${{github.jobs.coverage.name}}
38
+ state : ' ${{steps.coverage.outputs.STATE}}'
39
+ sha : ${{github.event.pull_request.head.sha || github.sha}}
40
+
41
+ - uses : actions/upload-artifact@v2
42
+ with :
43
+ name : coverage
44
+ path : coverage.html
45
+ retention-days : 7
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ jobs:
13
13
14
14
- uses : actions/checkout@v2
15
15
16
- - name : Set up Go 1.15
16
+ - name : Set up Go 1.17
17
17
uses : actions/setup-go@v1
18
18
with :
19
- go-version : 1.15
19
+ go-version : 1.17
20
20
21
21
- name : golangci-lint
22
22
uses : golangci/golangci-lint-action@v2
You can’t perform that action at this time.
0 commit comments