Skip to content

Commit 29d8b5b

Browse files
committed
build: Use devbox instead of asdf
1 parent adfbb4d commit 29d8b5b

24 files changed

+402
-211
lines changed

.envrc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
strict_env
1+
# Automatically sets up your devbox environment whenever you cd into this
2+
# directory via our direnv integration:
23

3-
source_env_if_exists .envrc.local-asdf
4+
eval "$(devbox generate direnv --print-envrc)"
45

5-
use asdf
6-
7-
PATH_add .local/bin
8-
9-
source_env_if_exists envrc.local
10-
11-
command -v yamale &>/dev/null || pip install yamale
6+
# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
7+
# for more details

.github/workflows/checks.yml

Lines changed: 90 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,20 @@ jobs:
2626
- name: Check out code
2727
uses: actions/checkout@v3
2828

29-
- name: Install asdf
30-
uses: asdf-vm/actions/setup@v2
29+
- name: Install devbox
30+
uses: jetpack-io/[email protected]
3131
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-
3343
3444
- name: Run unit tests
3545
run: make test
@@ -48,10 +58,20 @@ jobs:
4858
with:
4959
fetch-depth: 0
5060

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
5368
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-
5575
5676
- name: Build and install on KinD
5777
run: make dev.run-on-kind
@@ -73,49 +93,64 @@ jobs:
7393
- name: Check out code
7494
uses: actions/checkout@v3
7595

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
78112
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
79116
80117
- name: golangci-lint
81118
uses: reviewdog/action-golangci-lint@v2
82119
with:
83120
fail_on_error: true
84121
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 }}
87124

88125
pre-commit:
89126
runs-on: ubuntu-22.04
90127
steps:
91128
- name: Check out code
92129
uses: actions/checkout@v3
93130

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]
99133
with:
100-
go-version: ${{ fromJson(steps.versions.outputs.tools).golang }}
101-
check-latest: false
102-
cache: true
134+
enable-cache: true
103135

104-
- uses: mfinelli/setup-shfmt@v2
136+
- name: Go cache
137+
uses: actions/cache@v3
105138
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
110148
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') }}
115151

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
119154
env:
120155
SKIP: no-commit-to-branch,golangci-lint
121156

@@ -127,70 +162,62 @@ jobs:
127162
with:
128163
fetch-depth: 0
129164

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]
136167
with:
137-
version: v${{ fromJson(steps.versions.outputs.tools).helm }}
168+
enable-cache: true
138169

139-
- uses: actions/setup-python@v4
170+
- name: Go cache
171+
uses: actions/cache@v3
140172
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-
149179
150180
- name: Run chart-testing (list-changed)
151181
id: list-changed
152182
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 }})
154184
if [[ -n "$changed" ]]; then
155185
echo "changed=true" >> "$GITHUB_OUTPUT"
156186
fi
157187
158188
- if: steps.list-changed.outputs.changed == 'true'
159189
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
161191

162192
- if: steps.list-changed.outputs.changed == 'true'
163193
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
169198
env:
170199
KUBECONFIG: ct-kind-kubeconfig
171200

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-
178201
- if: steps.list-changed.outputs.changed == 'true'
179202
name: Build Docker images
180-
run: make release-snapshot
203+
run: devbox run -- make release-snapshot
181204

182205
- if: steps.list-changed.outputs.changed == 'true'
183206
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)"
185208

186209
- if: steps.list-changed.outputs.changed == 'true'
187210
name: Setup Cluster API and cert-manager
188-
run: make clusterctl.init
211+
run: devbox run -- make clusterctl.init
189212
env:
190213
KIND_KUBECONFIG: ct-kind-kubeconfig
191214

192215
- if: steps.list-changed.outputs.changed == 'true'
193216
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)"
195218
env:
196219
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

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ jobs:
3030
with:
3131
languages: ${{ matrix.language }}
3232

33-
- name: Install tools via asdf
34-
uses: asdf-vm/actions/install@master
33+
- name: Install devbox
34+
uses: jetpack-io/devbox-install[email protected]
3535
with:
36-
asdf_branch: v0.11.3
36+
enable-cache: true
3737

3838
- name: Build
39-
run: make build-snapshot
39+
run: devbox run -- make build-snapshot
4040

4141
- name: Perform CodeQL Analysis
4242
uses: github/codeql-action/analyze@v2

.github/workflows/release-please.yaml

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
branches:
99
- main
1010

11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
actions: write
15+
1116
jobs:
1217
release-please:
1318
runs-on: ubuntu-22.04
@@ -21,54 +26,8 @@ jobs:
2126
changelog-notes-type: github
2227

2328
- if: ${{ steps.release-please.outputs.release_created }}
24-
uses: actions/checkout@v3
25-
with:
26-
fetch-depth: 0
27-
28-
- if: ${{ steps.release-please.outputs.release_created }}
29-
name: Fetch all tags
30-
run: git fetch --force --tags
31-
32-
- if: ${{ steps.release-please.outputs.release_created }}
33-
name: Set up Docker Buildx
34-
uses: docker/setup-buildx-action@v2
35-
36-
- if: ${{ steps.release-please.outputs.release_created }}
37-
name: Gather tool versions
38-
uses: endorama/asdf-parse-tool-versions@v1
39-
id: versions
40-
41-
- if: ${{ steps.release-please.outputs.release_created }}
42-
name: Login to GitHub Container Registry
43-
uses: docker/login-action@v2
44-
with:
45-
registry: ghcr.io
46-
username: ${{ github.actor }}
47-
password: ${{ secrets.GITHUB_TOKEN }}
48-
49-
- if: ${{ steps.release-please.outputs.release_created }}
50-
name: Install go
51-
uses: actions/setup-go@v4
52-
with:
53-
go-version: ${{ fromJson(steps.versions.outputs.tools).golang }}
54-
check-latest: false
55-
cache: true
56-
57-
- if: ${{ steps.release-please.outputs.release_created }}
58-
name: Run goreleaser
59-
uses: goreleaser/goreleaser-action@v4
60-
with:
61-
distribution: goreleaser
62-
version: ${{ fromJson(steps.versions.outputs.tools).goreleaser }}
63-
args: release --clean
64-
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
67-
- if: ${{ steps.release-please.outputs.release_created }}
68-
name: Publish Helm chart
69-
uses: stefanprodan/[email protected]
29+
name: Run release workflow
30+
uses: benc-uk/workflow-dispatch@v121
7031
with:
71-
token: ${{ secrets.GITHUB_TOKEN }}
72-
app_version: ${{ steps.release-please.outputs.tag_name }}
73-
chart_version: ${{ steps.release-please.outputs.tag_name }}
74-
target_dir: repo
32+
workflow: release-tag.yaml
33+
ref: ${{ steps.release-please.outputs.tag_name }}

.github/workflows/release-tag.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2021-2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: release
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
tags:
10+
- v*
11+
12+
permissions:
13+
contents: write
14+
packages: write
15+
16+
jobs:
17+
release-tag:
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
ref: ${{ github.ref }}
23+
fetch-depth: 0
24+
25+
- name: Install devbox
26+
uses: jetpack-io/[email protected]
27+
with:
28+
enable-cache: true
29+
30+
- name: Go cache
31+
uses: actions/cache@v3
32+
with:
33+
path: |
34+
~/.cache/go-build
35+
~/go/pkg/mod
36+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
37+
restore-keys: |
38+
${{ runner.os }}-go-
39+
40+
- name: Login to GitHub Container Registry
41+
uses: docker/login-action@v2
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Release
48+
run: devbox run -- make release
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Publish Helm chart
53+
uses: stefanprodan/[email protected]
54+
with:
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
app_version: ${{ github.ref_name }}
57+
chart_version: ${{ github.ref_name }}
58+
target_dir: repo

0 commit comments

Comments
 (0)