3434 kubebuilder-diff :
3535 name : Kubebuilder Diff
3636 runs-on : ubuntu-latest
37+ needs : [changes]
38+ if : |
39+ (needs.changes.outputs.go == 'true') ||
40+ (needs.changes.outputs.make == 'true')
3741 steps :
3842 - uses : actions/checkout@v6
3943 - uses : nixbuild/nix-quick-install-action@v34
@@ -49,19 +53,58 @@ jobs:
4953 name : Lint
5054 runs-on : ubuntu-latest
5155 timeout-minutes : 10
56+ needs : [changes]
57+ if : |
58+ (needs.changes.outputs.go == 'true') ||
59+ (needs.changes.outputs.make == 'true')
5260 steps :
5361 - uses : actions/checkout@v6
5462 - uses : nixbuild/nix-quick-install-action@v34
5563 - uses : DeterminateSystems/magic-nix-cache-action@b8276522d77f21bf19d3574e5bc99186a6c7aa6c
5664 - name : Lint
5765 run : nix develop --command make lint
5866
67+ go-mod-tidy :
68+ name : Go Mod Tidy Check
69+ runs-on : ubuntu-latest
70+ needs :
71+ - changes
72+ if : |
73+ (needs.changes.outputs.go == 'true')
74+ steps :
75+ - uses : actions/checkout@v6
76+ - uses : nixbuild/nix-quick-install-action@v34
77+ - uses : DeterminateSystems/magic-nix-cache-action@b8276522d77f21bf19d3574e5bc99186a6c7aa6c
78+ - run : nix develop --command go mod tidy
79+ - run : git diff --exit-code go.mod
80+ - run : git diff --exit-code go.sum
81+
82+ go-fix :
83+ name : Go Fix Check
84+ runs-on : ubuntu-latest
85+ needs :
86+ - changes
87+ if : |
88+ (needs.changes.outputs.go == 'true')
89+ permissions :
90+ contents : read
91+ steps :
92+ - uses : actions/checkout@v6
93+ - uses : nixbuild/nix-quick-install-action@v34
94+ - uses : DeterminateSystems/magic-nix-cache-action@b8276522d77f21bf19d3574e5bc99186a6c7aa6c
95+ - name : Run go fix
96+ run : nix develop --command make go-fix
97+ - name : Fail if there are uncommitted changes
98+ run : git diff --exit-code
99+
59100 build-images :
60101 name : Build Images
61102 needs :
62103 - changes
63104 - kubebuilder-diff
64105 - lint
106+ - go-mod-tidy
107+ - go-fix
65108 if : needs.changes.outputs.go == 'true'
66109 runs-on : ubuntu-latest
67110 timeout-minutes : 15
@@ -82,37 +125,27 @@ jobs:
82125 push : false
83126 tags : ngrok/ngrok-operator:latest
84127
85- go-mod-tidy :
86- name : Go Mod Tidy Check
87- runs-on : ubuntu-latest
88- needs :
89- - changes
90- if : |
91- (needs.changes.outputs.go == 'true')
92- steps :
93- - uses : actions/checkout@v6
94- - uses : nixbuild/nix-quick-install-action@v34
95- - uses : DeterminateSystems/magic-nix-cache-action@b8276522d77f21bf19d3574e5bc99186a6c7aa6c
96- - run : go mod tidy
97- - run : git diff --exit-code go.mod
98- - run : git diff --exit-code go.sum
99-
100128 build-and-test :
101129 runs-on : ubuntu-latest
102130 needs :
103131 - changes
104132 - kubebuilder-diff
105133 - lint
134+ - go-mod-tidy
135+ - go-fix
106136 if : |
107- (github.event_name == 'push' && github.ref_name == 'main')
108- ||
137+ always() && !failure() && !cancelled() &&
109138 (
110- (needs.changes.outputs.actions == 'true') ||
111- (needs.changes.outputs.go == 'true') ||
112- (needs.changes.outputs.charts == 'true') ||
113- (needs.changes.outputs.chartyaml == 'true') ||
114- (needs.changes.outputs.tests == 'true') ||
115- (needs.changes.outputs.make == 'true')
139+ (github.event_name == 'push' && github.ref_name == 'main')
140+ ||
141+ (
142+ (needs.changes.outputs.actions == 'true') ||
143+ (needs.changes.outputs.go == 'true') ||
144+ (needs.changes.outputs.charts == 'true') ||
145+ (needs.changes.outputs.chartyaml == 'true') ||
146+ (needs.changes.outputs.tests == 'true') ||
147+ (needs.changes.outputs.make == 'true')
148+ )
116149 )
117150 permissions :
118151 contents : read
@@ -153,6 +186,9 @@ jobs:
153186 - changes
154187 - kubebuilder-diff
155188 - lint
189+ - go-mod-tidy
190+ - go-fix
191+ - helm
156192 # Only run one e2e test at a time to avoid stomping on each other
157193 concurrency :
158194 group : e2e
@@ -161,6 +197,7 @@ jobs:
161197 # Only run the e2e tests if on the main branch or in a merge queue and
162198 # files have changed that require e2e tests
163199 if : |
200+ always() && !failure() && !cancelled() &&
164201 (github.repository == 'ngrok/ngrok-operator') &&
165202 (
166203 (github.event_name == 'push' && github.ref_name == 'main') ||
@@ -189,12 +226,14 @@ jobs:
189226 - changes
190227 - kubebuilder-diff
191228 - lint
229+ - go-fix
192230 - e2e
193231 concurrency :
194232 group : e2e
195233 cancel-in-progress : false
196234 timeout-minutes : 30
197235 if : |
236+ always() && !failure() && !cancelled() &&
198237 (github.repository == 'ngrok/ngrok-operator') &&
199238 (
200239 (github.event_name == 'push' && github.ref_name == 'main') ||
@@ -236,12 +275,14 @@ jobs:
236275 - changes
237276 - kubebuilder-diff
238277 - lint
278+ - go-fix
239279 - e2e-multi-namespace
240280 concurrency :
241281 group : e2e
242282 cancel-in-progress : false
243283 timeout-minutes : 60
244284 if : |
285+ always() && !failure() && !cancelled() &&
245286 (github.repository == 'ngrok/ngrok-operator') &&
246287 (
247288 (github.event_name == 'push' && github.ref_name == 'main') ||
0 commit comments