@@ -16,27 +16,15 @@ defaults:
16
16
working-directory : governance-policy-propagator
17
17
18
18
jobs :
19
- kind -tests :
19
+ unit -tests :
20
20
runs-on : ubuntu-latest
21
- env :
22
- REGISTRY : localhost:5000
23
- strategy :
24
- fail-fast : false
25
- matrix :
26
- # Run tests on minimum and newest supported OCP Kubernetes
27
- # The "minimum" tag is set in the Makefile
28
- # KinD tags: https://hub.docker.com/r/kindest/node/tags
29
- kind :
30
- - ' minimum'
31
- - ' latest'
32
- name : KinD tests
21
+ name : Unit Tests
33
22
steps :
34
23
- name : Checkout Governance Policy Propagator
35
24
uses : actions/checkout@v3
36
25
with :
37
26
path : governance-policy-propagator
38
- fetch-depth : 0 # Fetch all history for all tags and branches
39
-
27
+
40
28
- name : Set up Go
41
29
uses : actions/setup-go@v3
42
30
id : go
62
50
run : |
63
51
make test
64
52
53
+ - name : Unit Test Coverage
54
+ if : ${{ github.event_name == 'pull_request' }}
55
+ run : |
56
+ make test-coverage
57
+
58
+ - name : Upload Unit Test Coverage
59
+ if : ${{ github.event_name == 'pull_request' }}
60
+ uses : actions/upload-artifact@v3
61
+ with :
62
+ name : coverage_unit
63
+ path : governance-policy-propagator/coverage_unit.out
64
+
65
+ kind-tests :
66
+ runs-on : ubuntu-latest
67
+ env :
68
+ REGISTRY : localhost:5000
69
+ strategy :
70
+ fail-fast : false
71
+ matrix :
72
+ # Run tests on minimum and newest supported OCP Kubernetes
73
+ # The "minimum" tag is set in the Makefile
74
+ # KinD tags: https://hub.docker.com/r/kindest/node/tags
75
+ kind :
76
+ - ' minimum'
77
+ - ' latest'
78
+ name : KinD tests
79
+ steps :
80
+ - name : Checkout Governance Policy Propagator
81
+ uses : actions/checkout@v3
82
+ with :
83
+ path : governance-policy-propagator
84
+
65
85
- name : Create K8s KinD Cluster - ${{ matrix.kind }}
66
86
env :
67
87
KIND_VERSION : ${{ matrix.kind }}
@@ -73,16 +93,24 @@ jobs:
73
93
export GOPATH=$(go env GOPATH)
74
94
make e2e-test-coverage
75
95
96
+ - name : Upload E2E Test Coverage
97
+ if : ${{ github.event_name == 'pull_request' && matrix.kind == 'latest'}}
98
+ uses : actions/upload-artifact@v3
99
+ with :
100
+ name : coverage_e2e
101
+ path : governance-policy-propagator/coverage_e2e.out
102
+
76
103
- name : E2E Tests for Compliance Events API
77
104
run : |
78
105
make postgres
79
106
make e2e-test-coverage-compliance-events-api
80
107
81
- - name : Test Coverage Verification
82
- if : ${{ github.event_name == 'pull_request' }}
83
- run : |
84
- make test-coverage
85
- make coverage-verify
108
+ - name : Upload Compliance Events API Test Coverage
109
+ if : ${{ github.event_name == 'pull_request' && matrix.kind == 'latest'}}
110
+ uses : actions/upload-artifact@v3
111
+ with :
112
+ name : coverage_e2e_compliance_events_api
113
+ path : governance-policy-propagator/coverage_e2e_compliance_events_api.out
86
114
87
115
- name : Verify Deployment Configuration
88
116
run : |
@@ -103,4 +131,88 @@ jobs:
103
131
if : ${{ always() }}
104
132
run : |
105
133
make kind-delete-cluster
106
-
134
+
135
+ policyautomation-tests :
136
+ runs-on : ubuntu-latest
137
+ env :
138
+ REGISTRY : localhost:5000
139
+ strategy :
140
+ fail-fast : false
141
+ matrix :
142
+ # Run tests on minimum and newest supported OCP Kubernetes
143
+ # The "minimum" tag is set in the Makefile
144
+ # KinD tags: https://hub.docker.com/r/kindest/node/tags
145
+ kind :
146
+ - ' minimum'
147
+ - ' latest'
148
+ name : PolicyAutomation tests
149
+ steps :
150
+ - name : Checkout Governance Policy Propagator
151
+ uses : actions/checkout@v3
152
+ with :
153
+ path : governance-policy-propagator
154
+
155
+ - name : Create K8s KinD Cluster - ${{ matrix.kind }}
156
+ env :
157
+ KIND_VERSION : ${{ matrix.kind }}
158
+ run : |
159
+ make kind-bootstrap-cluster-dev
160
+
161
+ - name : PolicyAutomation E2E Tests
162
+ run : |
163
+ export GOPATH=$(go env GOPATH)
164
+ make e2e-test-coverage-policyautomation
165
+
166
+ - name : Upload PolicyAutomation Test Coverage
167
+ if : ${{ github.event_name == 'pull_request' && matrix.kind == 'latest'}}
168
+ uses : actions/upload-artifact@v3
169
+ with :
170
+ name : coverage_e2e_policyautomation
171
+ path : governance-policy-propagator/coverage_e2e_policyautomation.out
172
+
173
+ - name : Debug
174
+ if : ${{ failure() }}
175
+ run : |
176
+ make e2e-debug
177
+
178
+ - name : Clean up cluster
179
+ if : ${{ always() }}
180
+ run : |
181
+ make kind-delete-cluster
182
+
183
+ coveage-verification :
184
+ defaults :
185
+ run :
186
+ working-directory : ' .'
187
+ runs-on : ubuntu-latest
188
+ name : Test Coverage Verification
189
+ if : ${{ github.event_name == 'pull_request' }}
190
+ needs : [unit-tests, kind-tests, policyautomation-tests]
191
+
192
+ steps :
193
+ - name : Checkout Governance Policy Propagator
194
+ uses : actions/checkout@v3
195
+
196
+ - name : Download Unit Coverage Result
197
+ uses : actions/download-artifact@v3
198
+ with :
199
+ name : coverage_unit
200
+
201
+ - name : Download E2E Coverage Result
202
+ uses : actions/download-artifact@v3
203
+ with :
204
+ name : coverage_e2e
205
+
206
+ - name : Download Compliance Events Coverage Result
207
+ uses : actions/download-artifact@v3
208
+ with :
209
+ name : coverage_e2e_compliance_events_api
210
+
211
+ - name : Download PolicyAutomation Coverage Result
212
+ uses : actions/download-artifact@v3
213
+ with :
214
+ name : coverage_e2e_policyautomation
215
+
216
+ - name : Test Coverage Verification
217
+ run : |
218
+ make coverage-verify
0 commit comments