Skip to content

Commit a04d3f7

Browse files
authored
ci: use mise for tool management (#1053)
This PR introduces [mise](https://github.com/jdx/mise) to manage and install tools for our dev environments and CI. It cleans up our messy tool situation, where we previously had `/tools.go`, `/tools/go.mod` and some manually installed tools as well. It also replaces GitHub actions used for installing tools. Since the action is cached, installing Go + all needed tools only takes 3 seconds, where it before took 9 seconds just to install Go alone, which is another nice benefit.
1 parent 3df4aa3 commit a04d3f7

15 files changed

Lines changed: 64 additions & 502 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,13 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717

18-
- name: Set up Go
19-
uses: actions/setup-go@v5
18+
- name: Set up tools
19+
uses: jdx/mise-action@v2
2020
with:
21-
go-version: "1.24"
22-
23-
- name: Download tools
24-
run: go -C ./tools mod download
21+
version: v2025.5.9
2522

2623
- name: Run GoReleaser
27-
uses: goreleaser/goreleaser-action@v6
28-
with:
29-
version: 2.x
30-
args: release --clean --snapshot --skip=sign
24+
run: goreleaser release --clean --snapshot --skip=sign
3125

3226
- uses: actions/upload-artifact@v4
3327
with:

.github/workflows/ci.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717

18-
- name: Set up Go
19-
uses: actions/setup-go@v5
18+
- name: Set up tools
19+
uses: jdx/mise-action@v2
2020
with:
21-
go-version: "1.24"
21+
version: v2025.5.9
2222

2323
- name: Run gofmt
2424
run: diff -u <(echo -n) <(gofmt -d -s .)
2525

2626
- name: Run golangci-lint
2727
uses: golangci/golangci-lint-action@v6
2828
with:
29-
# Required: the version of golangci-lint is required and must be specified with patch version
30-
version: v1.64.8 # renovate: datasource=github-releases depName=golangci/golangci-lint
29+
# golangci-lint was already installed in a previous step.
30+
install-mode: none
3131
# In general linting is quite fast with warm caches, but a fresh run might take some time.
3232
args: --timeout 5m
3333

@@ -37,10 +37,10 @@ jobs:
3737
- name: Checkout
3838
uses: actions/checkout@v4
3939

40-
- name: Set up Go
41-
uses: actions/setup-go@v5
40+
- name: Set up tools
41+
uses: jdx/mise-action@v2
4242
with:
43-
go-version: "1.24"
43+
version: v2025.5.9
4444

4545
- name: Run tests
4646
run: go test -coverpkg=./... -coverprofile=coverage.txt -v -race ./...
@@ -62,10 +62,10 @@ jobs:
6262
- name: Checkout
6363
uses: actions/checkout@v4
6464

65-
- name: Set up Go
66-
uses: actions/setup-go@v5
65+
- name: Set up tools
66+
uses: jdx/mise-action@v2
6767
with:
68-
go-version: "1.24"
68+
version: v2025.5.9
6969

7070
- uses: hetznercloud/tps-action@main
7171

@@ -91,10 +91,10 @@ jobs:
9191
- name: Checkout
9292
uses: actions/checkout@v4
9393

94-
- name: Set up Go
95-
uses: actions/setup-go@v5
94+
- name: Set up tools
95+
uses: jdx/mise-action@v2
9696
with:
97-
go-version: "1.24"
97+
version: v2025.5.9
9898

9999
- name: Delete old generated files
100100
run: find . -name 'zz_*.go' -delete
@@ -114,10 +114,10 @@ jobs:
114114
- name: Checkout
115115
uses: actions/checkout@v4
116116

117-
- name: Set up Go
118-
uses: actions/setup-go@v5
117+
- name: Set up tools
118+
uses: jdx/mise-action@v2
119119
with:
120-
go-version: "1.24"
120+
version: v2025.5.9
121121

122122
- name: Run go mod tidy
123123
run: go mod tidy

.github/workflows/release.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ jobs:
2121
username: ${{ secrets.DOCKER_USER }}
2222
password: ${{ secrets.DOCKER_PASSWORD }}
2323

24-
- name: Set up Go
25-
uses: actions/setup-go@v5
24+
- name: Set up tools
25+
uses: jdx/mise-action@v2
2626
with:
27-
go-version: "1.24"
28-
29-
- name: Download tools
30-
run: go -C ./tools mod download
27+
version: v2025.5.9
3128

3229
- name: Import GPG key
3330
id: import_gpg
@@ -37,10 +34,7 @@ jobs:
3734
passphrase: ${{ secrets.GPG_PASSPHRASE }}
3835

3936
- name: Run GoReleaser
40-
uses: goreleaser/goreleaser-action@v6
41-
with:
42-
version: 2.x
43-
args: release --clean --skip=validate
37+
run: goreleaser release --clean --skip=validate
4438
env:
4539
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4640
QUILL_SIGN_P12: ${{ secrets.APPLE_CERTIFICATE_P12_FILE }}

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ builds:
2929
hooks:
3030
post:
3131
- cmd: >
32-
go -C ./tools run github.com/anchore/quill/cmd/quill
32+
quill
3333
sign-and-notarize "{{ .Path }}"
3434
--dry-run={{ .IsSnapshot }}
3535
--ad-hoc={{ .IsSnapshot }}

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Developing hcloud-cli
22

3+
## Installing tools
4+
5+
We recommend installing tools using [mise](https://github.com/jdx/mise). Once mise is installed and activated
6+
in your env, run `mise install` in this repository to install all required tools. Tools will then be automatically
7+
added to your `PATH` when entering the directory.
8+
39
## Generated files
410

511
This repository contains generated files, mainly for testing purposes. These files are generated by running

go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,8 @@ require (
5959
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
6060
go.uber.org/atomic v1.9.0 // indirect
6161
go.uber.org/multierr v1.9.0 // indirect
62-
golang.org/x/mod v0.24.0 // indirect
6362
golang.org/x/net v0.40.0 // indirect
64-
golang.org/x/sync v0.14.0 // indirect
6563
golang.org/x/sys v0.33.0 // indirect
66-
golang.org/x/tools v0.31.0 // indirect
6764
google.golang.org/protobuf v1.36.5 // indirect
6865
gopkg.in/yaml.v3 v3.0.1 // indirect
6966
)

go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,8 @@ go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
129129
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
130130
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
131131
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
132-
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
133-
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
134132
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
135133
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
136-
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
137-
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
138134
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
139135
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
140136
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
@@ -143,8 +139,6 @@ golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
143139
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
144140
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
145141
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
146-
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
147-
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
148142
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
149143
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
150144
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

internal/hcapi2/mock/mock_gen.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
package mock
22

3-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_action_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ActionClient
4-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_certificate_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 CertificateClient
5-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_datacenter_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 DatacenterClient
6-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_image_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ImageClient
7-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_iso_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ISOClient
8-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_firewall_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 FirewallClient
9-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_floating_ip_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 FloatingIPClient
10-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_primary_ip_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PrimaryIPClient
11-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_location_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LocationClient
12-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_loadbalancer_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LoadBalancerClient
13-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_loadbalancer_type_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LoadBalancerTypeClient
14-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_network_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 NetworkClient
15-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_server_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ServerClient
16-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_server_type_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ServerTypeClient
17-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_ssh_key_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 SSHKeyClient
18-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_volume_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 VolumeClient
19-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_placement_group_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PlacementGroupClient
20-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_rdns_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 RDNSClient
21-
//go:generate go run go.uber.org/mock/mockgen -package mock -destination zz_pricing_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PricingClient
3+
//go:generate mockgen -package mock -destination zz_action_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ActionClient
4+
//go:generate mockgen -package mock -destination zz_certificate_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 CertificateClient
5+
//go:generate mockgen -package mock -destination zz_datacenter_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 DatacenterClient
6+
//go:generate mockgen -package mock -destination zz_image_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ImageClient
7+
//go:generate mockgen -package mock -destination zz_iso_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ISOClient
8+
//go:generate mockgen -package mock -destination zz_firewall_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 FirewallClient
9+
//go:generate mockgen -package mock -destination zz_floating_ip_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 FloatingIPClient
10+
//go:generate mockgen -package mock -destination zz_primary_ip_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PrimaryIPClient
11+
//go:generate mockgen -package mock -destination zz_location_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LocationClient
12+
//go:generate mockgen -package mock -destination zz_loadbalancer_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LoadBalancerClient
13+
//go:generate mockgen -package mock -destination zz_loadbalancer_type_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LoadBalancerTypeClient
14+
//go:generate mockgen -package mock -destination zz_network_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 NetworkClient
15+
//go:generate mockgen -package mock -destination zz_server_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ServerClient
16+
//go:generate mockgen -package mock -destination zz_server_type_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ServerTypeClient
17+
//go:generate mockgen -package mock -destination zz_ssh_key_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 SSHKeyClient
18+
//go:generate mockgen -package mock -destination zz_volume_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 VolumeClient
19+
//go:generate mockgen -package mock -destination zz_placement_group_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PlacementGroupClient
20+
//go:generate mockgen -package mock -destination zz_rdns_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 RDNSClient
21+
//go:generate mockgen -package mock -destination zz_pricing_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PricingClient

internal/state/command_helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/hetznercloud/hcloud-go/v2/hcloud"
99
)
1010

11-
//go:generate go run go.uber.org/mock/mockgen -package state -destination zz_command_helper_mock.go . ActionWaiter,TokenEnsurer
11+
//go:generate mockgen -package state -destination zz_command_helper_mock.go . ActionWaiter,TokenEnsurer
1212

1313
type ActionWaiter interface {
1414
WaitForActions(context.Context, *cobra.Command, ...*hcloud.Action) error

internal/testutil/terminal/terminal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/hetznercloud/cli/internal/ui"
77
)
88

9-
//go:generate go run go.uber.org/mock/mockgen -package terminal -destination zz_terminal_mock.go . Terminal
9+
//go:generate mockgen -package terminal -destination zz_terminal_mock.go . Terminal
1010

1111
type Terminal interface {
1212
StdoutIsTerminal() bool

0 commit comments

Comments
 (0)