55 branches : [ main ]
66 pull_request :
77 branches : [ main ]
8- workflow_dispatch :
8+
9+ env :
10+ GO_VERSION : " 1.25.0"
11+ GOLANGCI_LINT_VERSION : " v2.9.0"
12+
13+ permissions : {}
914
1015jobs :
1116 lint-code :
1217 name : Run Linters
1318 runs-on : ubuntu-latest
1419 permissions :
20+ contents : read
1521 pull-requests : write
22+ timeout-minutes : 10
1623 steps :
24+ - name : Harden Runner
25+ uses : step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
26+ with :
27+ egress-policy : audit
1728 - name : Checkout repository
1829 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1930 with :
20- fetch-depth : 0
31+ persist-credentials : false
2132 - name : Review code
2233 uses : reviewdog/action-golangci-lint@c76cceaaab89abe74e649d2e34c6c9adc26662d2 # v2.10.0
2334 with :
24- go_version : 1.25.0
25- golangci_lint_version : v2.4.0
35+ go_version : " ${{ env.GO_VERSION }} "
36+ golangci_lint_version : " ${{ env.GOLANGCI_LINT_VERSION }} "
2637 reporter : github-pr-review
27- fail_on_error : true
38+ fail_level : error
2839
2940 check-licenses :
3041 name : Check Licenses
3142 runs-on : ubuntu-latest
43+ permissions :
44+ contents : read
3245 steps :
46+ - name : Harden Runner
47+ uses : step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
48+ with :
49+ egress-policy : audit
3350 - name : Checkout repository
3451 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
52+ with :
53+ persist-credentials : false
3554 - name : Set up Go
3655 uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
3756 with :
38- go-version : 1.25.0
57+ go-version : " ${{ env.GO_VERSION }} "
3958 - name : Get google/go-licenses package
4059 run : go install github.com/google/go-licenses@v1.6.0
4160 - name : Check the licenses
@@ -45,22 +64,41 @@ jobs:
4564 test :
4665 name : Run Tests
4766 runs-on : ubuntu-latest
67+ permissions :
68+ contents : read
4869 steps :
70+ - name : Harden Runner
71+ uses : step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
72+ with :
73+ egress-policy : audit
4974 - name : Checkout repository
5075 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
5176 with :
52- ref : ${{ github.head_ref }}
77+ persist-credentials : false
5378 fetch-depth : 0
5479 - name : Set up Go
5580 uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
5681 with :
57- go-version : 1.25.0
82+ go-version : " ${{ env.GO_VERSION }}"
83+ - name : Install go-junit-report
84+ run : go install github.com/jstemmer/go-junit-report/v2@v2.1.0
5885 - name : Execute tests
5986 run : |
60- go test -v -gcflags=all=-l -cover ./... -coverprofile coverage.out -coverpkg ./...
61- - name : Upload code coverage report
62- uses : codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
87+ set -o pipefail
88+ go test -v -coverprofile=coverage.cov -coverpkg=./... ./... 2>&1 | \
89+ tee >(go-junit-report -set-exit-code > junit-report.xml)
90+ - name : Upload test results to Codecov
91+ uses : codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
92+ if : always() && !cancelled()
93+ with :
94+ report_type : test_results
95+ files : junit-report.xml
96+ verbose : true
97+ token : ${{ secrets.CODECOV_TOKEN }}
98+ - name : Upload code coverage report to Codecov
99+ uses : codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
63100 with :
64- files : coverage.out
101+ report_type : coverage
102+ files : coverage.cov
65103 verbose : true
66104 token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments