@@ -26,10 +26,20 @@ jobs:
26
26
- name : Check out code
27
27
uses : actions/checkout@v3
28
28
29
- - name : Install asdf
30
- uses : asdf-vm/actions/setup@v2
29
+ - name : Install devbox
30
+ uses :
jetpack-io/[email protected]
31
31
with :
32
- asdf_branch : v0.11.3
32
+ enable-cache : true
33
+
34
+ - name : Go cache
35
+ uses : actions/cache@v3
36
+ with :
37
+ path : |
38
+ ~/.cache/go-build
39
+ ~/go/pkg/mod
40
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
41
+ restore-keys : |
42
+ ${{ runner.os }}-go-
33
43
34
44
- name : Run unit tests
35
45
run : make test
@@ -48,10 +58,20 @@ jobs:
48
58
with :
49
59
fetch-depth : 0
50
60
51
- - name : Install asdf
52
- uses : asdf-vm/actions/setup@v2
61
+ - name : Install devbox
62
+ uses :
jetpack-io/[email protected]
63
+ with :
64
+ enable-cache : true
65
+
66
+ - name : Go cache
67
+ uses : actions/cache@v3
53
68
with :
54
- asdf_branch : v0.11.3
69
+ path : |
70
+ ~/.cache/go-build
71
+ ~/go/pkg/mod
72
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
73
+ restore-keys : |
74
+ ${{ runner.os }}-go-
55
75
56
76
- name : Build and install on KinD
57
77
run : make dev.run-on-kind
@@ -73,49 +93,64 @@ jobs:
73
93
- name : Check out code
74
94
uses : actions/checkout@v3
75
95
76
- - name : Gather tool versions
77
- uses : endorama/asdf-parse-tool-versions@v1
96
+ - name : Install devbox
97
+ uses :
jetpack-io/[email protected]
98
+ with :
99
+ enable-cache : true
100
+
101
+ - name : Go cache
102
+ uses : actions/cache@v3
103
+ with :
104
+ path : |
105
+ ~/.cache/go-build
106
+ ~/go/pkg/mod
107
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
108
+ restore-keys : |
109
+ ${{ runner.os }}-go-
110
+
111
+ - name : Export golang and golangci-lint versions
78
112
id : versions
113
+ run : |
114
+ echo "golangci-lint=v$(devbox run -- golangci-lint version --format short)" >>$GITHUB_OUTPUT
115
+ echo "golang=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>$GITHUB_OUTPUT
79
116
80
117
- name : golangci-lint
81
118
uses : reviewdog/action-golangci-lint@v2
82
119
with :
83
120
fail_on_error : true
84
121
reporter : github-pr-review
85
- golangci_lint_version : v${{ fromJson( steps.versions.outputs.tools) .golangci-lint }}
86
- go_version : v${{ fromJson( steps.versions.outputs.tools) .golang }}
122
+ golangci_lint_version : v${{ steps.versions.outputs.golangci-lint }}
123
+ go_version : v${{ steps.versions.outputs.golang }}
87
124
88
125
pre-commit :
89
126
runs-on : ubuntu-22.04
90
127
steps :
91
128
- name : Check out code
92
129
uses : actions/checkout@v3
93
130
94
- - name : Gather tool versions
95
- uses : endorama/asdf-parse-tool-versions@v1
96
- id : versions
97
-
98
- - uses : actions/setup-go@v4
131
+ - name : Install devbox
132
+ uses :
jetpack-io/[email protected]
99
133
with :
100
- go-version : ${{ fromJson(steps.versions.outputs.tools).golang }}
101
- check-latest : false
102
- cache : true
134
+ enable-cache : true
103
135
104
- - uses : mfinelli/setup-shfmt@v2
136
+ - name : Go cache
137
+ uses : actions/cache@v3
105
138
with :
106
- shfmt-version : ${{ fromJson(steps.versions.outputs.tools).shfmt }}
107
-
108
- - name : Install asdf
109
- uses : asdf-vm/actions/setup@v2
139
+ path : |
140
+ ~/.cache/go-build
141
+ ~/go/pkg/mod
142
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
143
+ restore-keys : |
144
+ ${{ runner.os }}-go-
145
+
146
+ - name : Set up pre-commit cache
147
+ uses : actions/cache@v3
110
148
with :
111
- asdf_branch : v0.11.3
112
-
113
- - name : Install helm-docs
114
- run : make install-tool.helm-docs
149
+ path : ~/.cache/pre-commit
150
+ key : pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
115
151
116
- -
uses :
pre-commit/[email protected]
117
- with :
118
- extra_args : --all-files --show-diff-on-failure
152
+ - name : Run pre-commit
153
+ run : devbox run -- make pre-commit
119
154
env :
120
155
SKIP : no-commit-to-branch,golangci-lint
121
156
@@ -127,70 +162,62 @@ jobs:
127
162
with :
128
163
fetch-depth : 0
129
164
130
- - name : Gather tool versions
131
- uses : endorama/asdf-parse-tool-versions@v1
132
- id : versions
133
-
134
- - name : Set up Helm
135
- uses : azure/setup-helm@v3
165
+ - name : Install devbox
166
+ uses :
jetpack-io/[email protected]
136
167
with :
137
- version : v${{ fromJson(steps.versions.outputs.tools).helm }}
168
+ enable-cache : true
138
169
139
- - uses : actions/setup-python@v4
170
+ - name : Go cache
171
+ uses : actions/cache@v3
140
172
with :
141
- python-version : ' 3.10'
142
- check-latest : true
143
-
144
- - name : Set up chart-testing
145
- uses : helm/chart-testing-action@v2
146
- with :
147
- version : v${{ fromJson(steps.versions.outputs.tools).helm-ct }}
148
- yamllint_version : ${{ fromJson(steps.versions.outputs.tools).yamllint }}
173
+ path : |
174
+ ~/.cache/go-build
175
+ ~/go/pkg/mod
176
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
177
+ restore-keys : |
178
+ ${{ runner.os }}-go-
149
179
150
180
- name : Run chart-testing (list-changed)
151
181
id : list-changed
152
182
run : |
153
- changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
183
+ changed=$(devbox run -- ct list-changed --target-branch ${{ github.event.repository.default_branch }})
154
184
if [[ -n "$changed" ]]; then
155
185
echo "changed=true" >> "$GITHUB_OUTPUT"
156
186
fi
157
187
158
188
- if : steps.list-changed.outputs.changed == 'true'
159
189
name : Run chart-testing (lint)
160
- run : ct lint --config charts/ct-config.yaml
190
+ run : devbox run -- ct lint --config charts/ct-config.yaml
161
191
162
192
- if : steps.list-changed.outputs.changed == 'true'
163
193
name : Create kind cluster
164
- uses : helm/kind-action@v1
165
- with :
166
- version : v${{ fromJson(steps.versions.outputs.tools).kind }}
167
- kubectl_version : v${{ fromJson(steps.versions.outputs.tools).kubectl }}
168
- node_image : ghcr.io/mesosphere/kind-node:v${{ fromJson(steps.versions.outputs.tools).kubectl }}
194
+ run : |
195
+ devbox run -- kind create cluster \
196
+ --image=ghcr.io/mesosphere/kind-node:$(kubectl version --output=json --client | gojq --raw-output .clientVersion.gitVersion) \
197
+ --name=chart-testing
169
198
env :
170
199
KUBECONFIG : ct-kind-kubeconfig
171
200
172
- - if : steps.list-changed.outputs.changed == 'true'
173
- name : Install asdf
174
- uses : asdf-vm/actions/setup@v2
175
- with :
176
- asdf_branch : v0.11.3
177
-
178
201
- if : steps.list-changed.outputs.changed == 'true'
179
202
name : Build Docker images
180
- run : make release-snapshot
203
+ run : devbox run -- make release-snapshot
181
204
182
205
- if : steps.list-changed.outputs.changed == 'true'
183
206
name : Sideload docker image
184
- run : kind load docker-image --name chart-testing "$(jq -r '.[] | select(.type == "Docker Image" and .goos == "linux" and .goarch == "amd64").name' dist/artifacts.json)"
207
+ run : devbox run -- kind load docker-image --name chart-testing "$(jq -r '.[] | select(.type == "Docker Image" and .goos == "linux" and .goarch == "amd64").name' dist/artifacts.json)"
185
208
186
209
- if : steps.list-changed.outputs.changed == 'true'
187
210
name : Setup Cluster API and cert-manager
188
- run : make clusterctl.init
211
+ run : devbox run -- make clusterctl.init
189
212
env :
190
213
KIND_KUBECONFIG : ct-kind-kubeconfig
191
214
192
215
- if : steps.list-changed.outputs.changed == 'true'
193
216
name : Run chart-testing (install)
194
- run : ct install --config charts/ct-config.yaml --helm-extra-set-args "--set=image.tag=$(jq -r .version dist/metadata.json)"
217
+ run : devbox run -- ct install --config charts/ct-config.yaml --helm-extra-set-args "--set=image.tag=$(jq -r .version dist/metadata.json)"
195
218
env :
196
219
KUBECONFIG : ct-kind-kubeconfig
220
+
221
+ - if : steps.list-changed.outputs.changed == 'true' && always()
222
+ name :
223
+ run : devbox run -- kind delete cluster --name chart-testing || true
0 commit comments