File tree Expand file tree Collapse file tree 2 files changed +45
-23
lines changed
Expand file tree Collapse file tree 2 files changed +45
-23
lines changed Original file line number Diff line number Diff line change 1+ name : " Lint"
2+ on :
3+ pull_request :
4+ types : [ opened, synchronize ]
5+ paths-ignore :
6+ - ' *.md'
7+ branches :
8+ - master
9+
10+ workflow_dispatch :
11+
12+ jobs :
13+ lint :
14+ name : " Run linter"
15+ runs-on : ubuntu-latest
16+
17+ steps :
18+ - name : Checkout
19+ uses : actions/checkout@v4
20+
21+ - uses : reviewdog/action-setup@v1
22+ with :
23+ reviewdog_version : latest
Original file line number Diff line number Diff line change 1- name : " Lint and test"
2-
1+ name : " Test"
32on :
43 push :
54 branches :
65 - master
76 paths-ignore :
87 - ' *.md'
8+
99 pull_request :
1010 types : [ opened, synchronize ]
1111 paths-ignore :
1212 - ' *.md'
1313 branches :
1414 - master
1515
16- jobs :
17- lint :
18- name : " Run linters"
19- runs-on : ubuntu-latest
20-
21- steps :
22- - name : Checkout
23- uses : actions/checkout@v4
24-
25- - name : Setup Go
26- uses : actions/setup-go@v5
27- with :
28- go-version : 1.22.1
29-
30- - name : golangci-lint
31- uses : golangci/golangci-lint-action@v6
32- with :
33- version : latest
16+ workflow_dispatch :
3417
18+ jobs :
3519 test :
3620 name : Run unit tests
3721 runs-on : ubuntu-latest
3822
3923 steps :
40- - name : Checkout code
24+ - name : Checkout
4125 uses : actions/checkout@v4
4226
4327 - name : Setup Go
4428 uses : actions/setup-go@v5
4529 with :
46- go-version : 1.22.1
30+ go-version : 1.23.0
4731
4832 - name : Install dependencies and run tests
4933 run : |
5034 go mod download
51- go test -v ./...
35+ go test -v ./... -coverpkg=./... -short -coverprofile=unit_coverage.out
36+
37+ code_coverage :
38+ name : " Code coverage report"
39+ if : github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
40+ runs-on : ubuntu-latest
41+ needs : test
42+ permissions :
43+ contents : read
44+ actions : read # to download code coverage results from "test" job
45+ pull-requests : write # write permission needed to comment on PR
46+ steps :
47+ 48+ with :
49+ coverage-artifact-name : " code-coverage" # can be omitted if you used this default value
50+ coverage-file-name : unit_coverage.out
You can’t perform that action at this time.
0 commit comments