File tree Expand file tree Collapse file tree 4 files changed +73
-0
lines changed Expand file tree Collapse file tree 4 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ coverage :
2
+ status :
3
+ project :
4
+ default :
5
+ target : auto
6
+ threshold : 1%
7
+ informational : true
8
+ patch :
9
+ default :
10
+ target : auto
11
+ threshold : 1%
12
+ informational : true
Original file line number Diff line number Diff line change
1
+ name : codecov
2
+
3
+ on :
4
+ pull_request :
5
+ push :
6
+ branches :
7
+ - main
8
+ permissions :
9
+ contents : read
10
+
11
+ jobs :
12
+ coverage :
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ - name : Harden Runner
16
+ uses : step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
17
+ with :
18
+ egress-policy : audit
19
+
20
+ - uses : actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
21
+ - uses : actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
22
+ with :
23
+ go-version : ' 1.20'
24
+ - run : " PATH=/usr/local/go/bin:$PATH make test-cover"
25
+ - uses : Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 Retry codecov upload. It is flaky due to a known issue https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
26
+ with :
27
+ attempt_limit : 20
28
+ action : codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
29
+ with : |
30
+ file: ./coverage.out
31
+ fail_ci_if_error: true
Original file line number Diff line number Diff line change @@ -471,6 +471,7 @@ test-junit: $(SETUP_ENVTEST) $(GOTESTSUM) $(GOVC) ## Run unit tests
471
471
.PHONY : test-cover
472
472
test-cover : # # Run unit tests and generate a coverage report
473
473
$(MAKE ) test TEST_ARGS=" $( TEST_ARGS) -coverprofile=coverage.out"
474
+ ./hack/codecov-ignore.sh
474
475
go tool cover -func=coverage.out -o coverage.txt
475
476
go tool cover -html=coverage.out -o coverage.html
476
477
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Copyright 2023 The Kubernetes Authors.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Ignore generated files in API packages, e.g. zz_generated.deepcopy.go and zz_generated.conversion.go.
18
+ {
19
+ find apis -regex ' .*zz_generated.*\.go' -exec echo sigs.k8s.io/cluster-api-provider-vsphere/{} \;
20
+ } >> codecov-ignore.txt
21
+
22
+ while read -r p || [ -n " $p " ]
23
+ do
24
+ if [[ " ${OSTYPE} " == " darwin" * ]]; then
25
+ sed -i ' ' " /${p// \/ / \\ / } /d" ./coverage.out
26
+ else
27
+ sed -i " /${p// \/ / \\ / } /d" ./coverage.out
28
+ fi
29
+ done < ./codecov-ignore.txt
You can’t perform that action at this time.
0 commit comments