File tree 5 files changed +120
-54
lines changed
5 files changed +120
-54
lines changed Original file line number Diff line number Diff line change 1
- # See http://docs.codecov.io/docs/coverage-configuration
2
1
coverage :
3
- precision : 2 # 2 = xx.xx%, 0 = xx%
4
- round : down
5
- # For example: 20...60 would result in any coverage less than 20%
6
- # would have a red background. The color would gradually change to
7
- # green approaching 60%. Any coverage over 60% would result in a
8
- # solid green color.
9
- range : " 20...60"
10
-
11
2
status :
12
- # project will give us the diff in the total code coverage between a commit
13
- # and its parent
14
- project : yes
15
- # Patch gives just the coverage of the patch
16
- patch : yes
17
- # changes tells us if there are unexpected code co verage changes in other files
18
- # which were not changed by the diff
19
- changes : yes
3
+ # allow test coverage to drop by 0.1%, assume that it's typically due to CI problems
4
+ patch :
5
+ default :
6
+ threshold : 0.1
7
+ project :
8
+ default :
9
+ threshold : 0.1
20
10
21
- # See http://docs.codecov.io/docs/ignoring-paths
22
11
ignore :
12
+ - " api/v1alpha1/*"
23
13
- " build/*"
14
+ - " common/*"
24
15
- " hack/*"
25
16
- " openshift-ci/*"
17
+ - " vendor/.*"
18
+ - " version/*"
26
19
- " Makefile"
27
- - " .travis.yml"
28
-
29
- # See http://docs.codecov.io/docs/pull-request-comments-1
30
- comment :
31
- layout : " diff, files"
32
- behavior : " "
33
- # default = posts once then update, posts new if delete
34
- # once = post once then updates
35
- # new = delete old, post new
36
- # spammy = post new
Original file line number Diff line number Diff line change
1
+ name : Go
2
+ on :
3
+ push :
4
+ branches :
5
+ - " master"
6
+ pull_request :
7
+ branches :
8
+ - " master"
9
+ env :
10
+ # Golang version to use across CI steps
11
+ GOLANG_VERSION : ' 1.20'
12
+
13
+ concurrency :
14
+ group : ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress : true
16
+
17
+ permissions :
18
+ contents : read
19
+
20
+ jobs :
21
+ event_file :
22
+ name : " Event File"
23
+ runs-on : ubuntu-latest
24
+ steps :
25
+ - name : Upload
26
+ uses : actions/upload-artifact@v4
27
+ with :
28
+ name : Event File
29
+ path : ${{ github.event_path }}
30
+
31
+ build :
32
+ name : Build
33
+ runs-on : ubuntu-latest
34
+ steps :
35
+ - name : Set up Go
36
+
37
+ with :
38
+ go-version : ${{ env.GOLANG_VERSION }}
39
+ id : go
40
+
41
+ - name : Check out code into the Go module directory
42
+ uses : actions/checkout@v4
43
+
44
+ - name : Restore go build cache
45
+ uses : actions/cache@v4
46
+ with :
47
+ path : ~/.cache/go-build
48
+ key : ${{ runner.os }}-go-build-v1-${{ github.run_id }}
49
+
50
+ - name : Download all Go modules
51
+ run : |
52
+ go mod download
53
+
54
+ - name : Generate code coverage artifacts
55
+ uses : actions/upload-artifact@v4
56
+ with :
57
+ name : code-coverage
58
+ path : coverage.out
59
+
60
+ - name : Upload code coverage information to codecov.io
61
+
62
+ with :
63
+ file : coverage.out
Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Go Test on Pull Requests
3
+ on : # yamllint disable-line rule:truthy
4
+ pull_request :
5
+ types :
6
+ - opened
7
+ - synchronize
8
+ - reopened
9
+ paths :
10
+ - ' **.go'
11
+ workflow_dispatch :
12
+ jobs :
13
+ gosec :
14
+ name : Check GO security
15
+ runs-on : ubuntu-20.04
16
+ steps :
17
+ - name : Check out code
18
+ uses : actions/checkout@v3
19
+ with :
20
+ fetch-depth : 1
21
+ ref : ${{ github.event.pull_request.head.sha }}
22
+ - name : Run Gosec Security Scanner
23
+ uses : securego/gosec@master
24
+ with :
25
+ args : -exclude-generated ./...
26
+ env :
27
+ GOROOT : " "
Original file line number Diff line number Diff line change 4
4
pull_request :
5
5
branches :
6
6
- master
7
- - ' v*.*'
7
+
8
+ env :
9
+ GO111MODULE : on
10
+ SDK_VERSION : " 1.17.0"
11
+ MINIKUBE_WANTUPDATENOTIFICATION : false
12
+ MINIKUBE_WANTREPORTERRORPROMPT : false
13
+ K8S_VERSION : " 1.21.3"
14
+ MINIKUBE_VERSION : " 1.26.0"
15
+ OLM_VERSION : " 0.22.0"
16
+ TEST_ACCEPTANCE_CLI : " kubectl"
17
+ TEST_RESULTS : " out/acceptance-tests"
8
18
9
19
jobs :
10
20
lint :
26
36
- name : Checkout repo
27
37
uses : actions/checkout@v4
28
38
29
- - name : Run linters
30
- run : make lint
31
-
32
-
33
39
unit :
34
40
name : Unit Tests with Code coverage
35
41
runs-on : ubuntu-20.04
@@ -44,29 +50,11 @@ jobs:
44
50
uses : actions/checkout@v4
45
51
46
52
- name : Unit Tests with Code Coverage
47
- run : |
48
- make test
53
+ run : ./scripts/openshiftci-presubmit-unittests.sh
49
54
50
55
- name : Upload Code Coverage Report
51
56
uses : codecov/codecov-action@v3
52
57
with :
53
- file : cover .out
58
+ file : coverage .out
54
59
verbose : true
55
60
fail_ci_if_error : true
56
-
57
- source-scan :
58
- name : Gosec code scanning
59
- runs-on : ubuntu-20.04
60
- steps :
61
- - name : Checkout code
62
- uses : actions/checkout@v4
63
-
64
- - name : Run gosec
65
-
66
- with :
67
- args : ' -no-fail -fmt sarif -out gosec.sarif ./...'
68
-
69
- - name : Upload gosec scan results to GitHub Security tab
70
- uses : github/codeql-action/upload-sarif@v2
71
- with :
72
- sarif_file : ' gosec.sarif'
Original file line number Diff line number Diff line change @@ -110,7 +110,12 @@ test-gitopsservice-nondefault:
110
110
go test -p 1 -timeout 30m ./test/nondefaulte2e -ginkgo.focus=" GitOpsServiceNoDefaultInstall" -coverprofile cover.out -ginkgo.v
111
111
112
112
test : manifests generate fmt vet # # Run unit tests.
113
- go test ` go list ./... | grep -v test` -coverprofile cover.out
113
+ go test ` go list ./... | grep -v test` -coverprofile coverage.out
114
+
115
+ .PHONY : coverage
116
+ coverage : test # # run coverage tests
117
+ go tool cover -html=coverage.out -o coverage.html
118
+ open coverage.html
114
119
115
120
.PHONY : e2e-tests-sequential
116
121
e2e-tests-sequential : # # Runs kuttl e2e sequentail tests
You can’t perform that action at this time.
0 commit comments