7
7
- synchronize
8
8
- reopened
9
9
10
+ permissions : {}
11
+
10
12
jobs :
11
- e2e :
13
+ lint-chart :
12
14
runs-on : ubuntu-latest
13
15
steps :
16
+ - name : Harden Runner
17
+ uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
18
+ with :
19
+ egress-policy : audit
14
20
- name : Checkout
15
- uses : actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
16
- - name : Setup Go
17
- uses : actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
21
+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
22
+ with :
23
+ fetch-depth : 0
24
+
25
+ - name : Set up Helm
26
+ uses : azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
18
27
with :
19
- go-version : 1.20.x
20
- - name : Restore Go cache
21
- uses : actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
28
+ version : v3.4.0
29
+
30
+ - uses : actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
31
+ with :
32
+ python-version : 3.7
33
+
34
+ - name : Set up chart-testing
35
+ uses : helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
36
+
37
+ - name : Run chart-testing (list-changed)
38
+ id : list-changed
39
+ run : |
40
+ changed=$(ct list-changed --target-branch=master --chart-dirs chart)
41
+ if [[ -n "$changed" ]]; then
42
+ echo "::set-output name=changed::true"
43
+ fi
44
+ - name : Run chart-testing (lint)
45
+ run : ct lint --target-branch=master --chart-dirs chart --check-version-increment=false
46
+
47
+ fmt :
48
+ runs-on : ubuntu-latest
49
+ steps :
50
+ - name : Harden Runner
51
+ uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
52
+ with :
53
+ egress-policy : audit
54
+ - name : Checkout
55
+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
56
+ - name : Setup Go
57
+ uses : actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
22
58
with :
23
- path : ~/go/pkg/mod
24
- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
25
- restore-keys : |
26
- ${{ runner.os }}-go-
59
+ go-version : 1.22.x
27
60
- name : fmt
28
61
run : make fmt
29
62
- name : vet
30
63
run : make vet
31
64
- name : lint
32
65
run : make lint
33
- - name : test
34
- run : make test
66
+ - name : Check if working tree is dirty
67
+ run : |
68
+ if [[ $(git diff --stat) != '' ]]; then
69
+ git --no-pager diff
70
+ echo 'run <make test> and commit changes'
71
+ exit 1
72
+ fi
73
+
74
+ test :
75
+ runs-on : ubuntu-latest
76
+ strategy :
77
+ matrix :
78
+ kubernetes-version :
79
+ - " 1.27"
80
+ - " 1.28"
81
+ - " 1.29"
82
+ - " 1.30"
83
+ steps :
84
+ - name : Harden Runner
85
+ uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
86
+ with :
87
+ egress-policy : audit
88
+ - name : Checkout
89
+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
90
+ - name : Setup Go
91
+ uses : actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
92
+ with :
93
+ go-version : 1.22.x
94
+ - name : run test
95
+ run : make test ENVTEST_K8S_VERSION=${{ matrix.kubernetes-version }}
96
+
97
+ build :
98
+ runs-on : ubuntu-latest
99
+ outputs :
100
+ profiles : ${{ steps.profiles.outputs.matrix }}
101
+ steps :
102
+ - name : Harden Runner
103
+ uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
104
+ with :
105
+ egress-policy : audit
106
+ - name : Checkout
107
+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
108
+ - name : Setup Go
109
+ uses : actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
110
+ with :
111
+ go-version : 1.22.x
35
112
- name : build
36
113
run : make build
37
- - name : Send go coverage report
38
- uses : shogo82148/actions-goveralls@31ee804b8576ae49f6dc3caa22591bc5080e7920 # v1.6.0
39
- with :
40
- path-to-profile : coverage.out
41
114
- name : Check if working tree is dirty
42
115
run : |
43
116
if [[ $(git diff --stat) != '' ]]; then
@@ -48,19 +121,108 @@ jobs:
48
121
- name : Build container image
49
122
run : |
50
123
make docker-build
124
+ - name : Create image tarball
125
+ run : |
126
+ docker save --output oauth2-redirect-controller-container.tar oauth2-redirect-controller:latest
127
+ - name : Upload image
128
+ uses : actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
129
+ with :
130
+ name : oauth2-redirect-controller-container
131
+ path : oauth2-redirect-controller-container.tar
132
+ - id : profiles
133
+ name : Determine test profiles
134
+ run : |
135
+ profiles=$(ls config/tests/cases | jq -R -s -c 'split("\n")[:-1]')
136
+ echo $profiles
137
+ echo "::set-output name=matrix::$profiles"
138
+
139
+ e2e-tests :
140
+ runs-on : ubuntu-latest
141
+ needs :
142
+ - build
143
+ strategy :
144
+ matrix :
145
+ profile : ${{ fromJson(needs.build.outputs.profiles) }}
146
+ steps :
147
+ - name : Harden Runner
148
+ uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
149
+ with :
150
+ egress-policy : audit
151
+ - name : Checkout
152
+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
51
153
- name : Setup Kubernetes
52
154
uses : engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 # v0.5.0
53
155
with :
54
156
version : v0.17.0
55
- - name : Load test image
56
- run : kind load docker-image k8soauth2-proxy-controller:latest
57
- - name : Deploy controller
58
- run : make deploy
157
+ - name : Download oauth2-redirect-controller container
158
+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
159
+ with :
160
+ name : oauth2-redirect-controller-container
161
+ path : /tmp
162
+ - name : Load images
163
+ run : |
164
+ docker load --input /tmp/oauth2-redirect-controller-container.tar
165
+ docker image ls -a
166
+ - name : Setup Kustomize
167
+ uses : imranismail/setup-kustomize@2ba527d4d055ab63514ba50a99456fc35684947f # v2.1.0
168
+ - name : Run test
169
+ run : |
170
+ make kind-test TEST_PROFILE=${{ matrix.profile }}
59
171
- name : Debug failure
60
172
if : failure()
61
173
run : |
62
174
kubectl -n kube-system describe pods
63
- kubectl -n podinfo get pods
64
- kubectl -n k8soauth2-proxy-system describe pods
65
- kubectl -n k8soauth2-proxy-system get all
66
- kubectl -n k8soauth2-proxy-system logs deploy/k8soauth2-proxy-controller manager
175
+ kubectl -n oauth2-system describe pods
176
+ kubectl -n oauth2-system get all
177
+ kubectl -n oauth2-system logs deploy/oauth2-redirect-controller
178
+ kubectl -n oauth2-system get oauth2-redirectrealms -o yaml
179
+
180
+ test-chart :
181
+ runs-on : ubuntu-latest
182
+ needs :
183
+ - build
184
+ - lint-chart
185
+ steps :
186
+ - name : Harden Runner
187
+ uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
188
+ with :
189
+ egress-policy : audit
190
+ - name : Checkout
191
+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
192
+ with :
193
+ fetch-depth : 0
194
+
195
+ - name : Set up Helm
196
+ uses : azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
197
+
198
+ - uses : actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
199
+ with :
200
+ python-version : 3.7
201
+
202
+ - name : Set up chart-testing
203
+ uses : helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
204
+
205
+ - name : Create kind cluster
206
+ uses : helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
207
+
208
+ - name : Download oauth2-redirect-controller container
209
+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
210
+ with :
211
+ name : oauth2-redirect-controller-container
212
+ path : /tmp
213
+
214
+ - name : Load image
215
+ run : |
216
+ docker load --input /tmp/oauth2-redirect-controller-container.tar
217
+ docker tag oauth2-redirect-controller:latest ghcr.io/doodlescheduling/oauth2-redirect-controller:v0.0.0
218
+ kind load docker-image ghcr.io/doodlescheduling/oauth2-redirect-controller:v0.0.0 --name chart-testing
219
+ docker image ls -a
220
+
221
+ - name : Run chart-testing (install)
222
+ run : ct install --target-branch=master --chart-dirs chart
223
+
224
+ test-success :
225
+ runs-on : ubuntu-latest
226
+ needs : [test, e2e-tests]
227
+ steps :
228
+ - run : echo "all tests succeeded"
0 commit comments