Skip to content

Commit b28368b

Browse files
authored
build: Use devbox instead of asdf (#96)
1 parent adfbb4d commit b28368b

26 files changed

+402
-234
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: 73 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ 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
3333

3434
- name: Run unit tests
35-
run: make test
35+
run: devbox run -- make test
3636

3737
- name: Annotate tests
3838
if: always()
@@ -48,76 +48,97 @@ jobs:
4848
with:
4949
fetch-depth: 0
5050

51-
- name: Install asdf
52-
uses: asdf-vm/actions/setup@v2
51+
- name: Install devbox
52+
uses: jetpack-io/[email protected]
5353
with:
54-
asdf_branch: v0.11.3
54+
enable-cache: true
5555

5656
- name: Build and install on KinD
57-
run: make dev.run-on-kind
57+
run: devbox run -- make dev.run-on-kind
5858
env:
5959
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060

6161
- name: Run e2e tests
62-
run: make e2e-test
62+
run: devbox run -- make e2e-test
6363
env:
6464
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6565

6666
- name: Cleanup KinD cluster
6767
if: always()
68-
run: make kind.delete
68+
run: devbox run -- make kind.delete
6969

70-
lint:
70+
lint-go:
7171
runs-on: ubuntu-22.04
7272
steps:
7373
- name: Check out code
7474
uses: actions/checkout@v3
7575

76-
- name: Gather tool versions
77-
uses: endorama/asdf-parse-tool-versions@v1
76+
- name: Install devbox
77+
uses: jetpack-io/[email protected]
78+
with:
79+
enable-cache: true
80+
81+
- name: Export golang and golangci-lint versions
7882
id: versions
83+
run: |
84+
echo "golangci-lint=$(devbox run -- golangci-lint version --format short)" >>"${GITHUB_OUTPUT}"
85+
echo "golang=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>"${GITHUB_OUTPUT}"
7986
8087
- name: golangci-lint
8188
uses: reviewdog/action-golangci-lint@v2
8289
with:
8390
fail_on_error: true
8491
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 }}
92+
golangci_lint_version: v${{ steps.versions.outputs.golangci-lint }}
93+
go_version: v${{ steps.versions.outputs.golang }}
8794

88-
pre-commit:
95+
lint-gha:
8996
runs-on: ubuntu-22.04
9097
steps:
9198
- name: Check out code
9299
uses: actions/checkout@v3
93100

94-
- name: Gather tool versions
95-
uses: endorama/asdf-parse-tool-versions@v1
96-
id: versions
97-
98-
- uses: actions/setup-go@v4
101+
- name: actionlint
102+
uses: reviewdog/action-actionlint@v1
99103
with:
100-
go-version: ${{ fromJson(steps.versions.outputs.tools).golang }}
101-
check-latest: false
102-
cache: true
104+
fail_on_error: true
105+
reporter: github-pr-review
103106

104-
- uses: mfinelli/setup-shfmt@v2
107+
lint-dockerfile:
108+
runs-on: ubuntu-22.04
109+
steps:
110+
- name: Check out code
111+
uses: actions/checkout@v3
112+
113+
- name: actionlint
114+
uses: reviewdog/action-hadolint@v1
105115
with:
106-
shfmt-version: ${{ fromJson(steps.versions.outputs.tools).shfmt }}
116+
fail_on_error: true
117+
reporter: github-pr-review
107118

108-
- name: Install asdf
109-
uses: asdf-vm/actions/setup@v2
119+
pre-commit:
120+
runs-on: ubuntu-22.04
121+
steps:
122+
- name: Check out code
123+
uses: actions/checkout@v3
110124
with:
111-
asdf_branch: v0.11.3
125+
ref: ${{ github.event.pull_request.head.sha }}
112126

113-
- name: Install helm-docs
114-
run: make install-tool.helm-docs
127+
- name: Install devbox
128+
uses: jetpack-io/[email protected]
129+
with:
130+
enable-cache: true
115131

116-
- uses: pre-commit/[email protected]
132+
- name: Set up pre-commit cache
133+
uses: actions/cache@v3
117134
with:
118-
extra_args: --all-files --show-diff-on-failure
135+
path: ~/.cache/pre-commit
136+
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
137+
138+
- name: Run pre-commit
139+
run: devbox run -- make pre-commit
119140
env:
120-
SKIP: no-commit-to-branch,golangci-lint
141+
SKIP: no-commit-to-branch,golangci-lint,actionlint-system
121142

122143
lint-test-helm:
123144
runs-on: ubuntu-22.04
@@ -127,70 +148,53 @@ jobs:
127148
with:
128149
fetch-depth: 0
129150

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
136-
with:
137-
version: v${{ fromJson(steps.versions.outputs.tools).helm }}
138-
139-
- uses: actions/setup-python@v4
151+
- name: Install devbox
152+
uses: jetpack-io/[email protected]
140153
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 }}
154+
enable-cache: true
149155

150156
- name: Run chart-testing (list-changed)
151157
id: list-changed
152158
run: |
153-
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
159+
git fetch origin main:main
160+
changed=$(devbox run -- ct list-changed --target-branch ${{ github.event.repository.default_branch }})
154161
if [[ -n "$changed" ]]; then
155162
echo "changed=true" >> "$GITHUB_OUTPUT"
156163
fi
157164
158165
- if: steps.list-changed.outputs.changed == 'true'
159166
name: Run chart-testing (lint)
160-
run: ct lint --config charts/ct-config.yaml
167+
run: devbox run -- ct lint --config charts/ct-config.yaml
161168

162169
- if: steps.list-changed.outputs.changed == 'true'
163170
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 }}
171+
run: |
172+
devbox run -- kind create cluster \
173+
--image=ghcr.io/mesosphere/kind-node:"$(kubectl version --output=json --client | gojq --raw-output .clientVersion.gitVersion)" \
174+
--name=chart-testing
169175
env:
170176
KUBECONFIG: ct-kind-kubeconfig
171177

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

182182
- if: steps.list-changed.outputs.changed == 'true'
183183
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)"
184+
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)"
185185

186186
- if: steps.list-changed.outputs.changed == 'true'
187187
name: Setup Cluster API and cert-manager
188-
run: make clusterctl.init
188+
run: devbox run -- make clusterctl.init
189189
env:
190190
KIND_KUBECONFIG: ct-kind-kubeconfig
191191

192192
- if: steps.list-changed.outputs.changed == 'true'
193193
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)"
194+
run: devbox run -- ct install --config charts/ct-config.yaml --helm-extra-set-args "--set=image.tag=$(jq -r .version dist/metadata.json)"
195195
env:
196196
KUBECONFIG: ct-kind-kubeconfig
197+
198+
- if: steps.list-changed.outputs.changed == 'true' && always()
199+
name:
200+
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/recover-secret.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.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 }}

0 commit comments

Comments
 (0)