Skip to content

Commit e074afc

Browse files
committed
Manage CLI tools by aquaproj/aqua
1 parent 009072d commit e074afc

File tree

7 files changed

+219
-39
lines changed

7 files changed

+219
-39
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Setup Aqua
2+
description: Install Aqua CLI
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Restore aqua cache
7+
uses: actions/cache/restore@v4
8+
with:
9+
path: ~/.local/share/aquaproj-aqua
10+
key: v1-aqua-installer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('aqua.yaml') }}
11+
restore-keys: |
12+
v1-aqua-installer-${{ runner.os }}-${{ runner.arch }}-
13+
14+
- name: Install aqua
15+
uses: aquaproj/aqua-installer@e2d0136abcf70b7a2f6f505720640750557c4b33 # v3.1.1
16+
with:
17+
aqua_version: v2.48.1
18+
working_directory: ${{ inputs.working_directory }}
19+
# aqua-installer runs aqua with -l option by default, so packages that aren't run in the workflow aren't cached.
20+
aqua_opts: ""
21+
22+
- name: Save aqua cache
23+
if: github.ref_name == 'main'
24+
uses: actions/cache/save@v4
25+
with:
26+
path: ~/.local/share/aquaproj-aqua
27+
key: v1-aqua-installer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('aqua.yaml') }}

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
- uses: actions/setup-go@v5
1616
with:
1717
go-version-file: go.mod
18+
- name: Setup Aqua
19+
uses: ./.github/actions/setup-aqua
1820
- name: Cache Tools
1921
id: cache-tools
2022
uses: actions/cache@v4
@@ -50,4 +52,6 @@ jobs:
5052
- uses: actions/setup-go@v5
5153
with:
5254
go-version-file: go.mod
55+
- name: Setup Aqua
56+
uses: ./.github/actions/setup-aqua
5357
- run: make test MYSQL_VERSION=${{ matrix.mysql-version }}

.github/workflows/release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
- uses: actions/setup-go@v5
1414
with:
1515
go-version-file: go.mod
16+
- name: Setup Aqua
17+
uses: ./.github/actions/setup-aqua
1618
- run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build/moco-agent
1719
- name: Create Release
1820
env:

Makefile

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,17 @@ endif
1313

1414
GO_FILES := $(shell find . -name '*.go' -print)
1515

16-
PROTOC := PATH=$(PWD)/bin:$(PATH) $(PWD)/bin/protoc -I=$(PWD)/include:.
17-
PROTOC_BIN := $(PWD)/bin/protoc
18-
PROTOC_GEN_GO := $(PWD)/bin/protoc-gen-go
19-
PROTOC_GEN_GO_GRPC := $(PWD)/bin/protoc-gen-go-grpc
20-
PROTOC_GEN_DOC := $(PWD)/bin/protoc-gen-doc
21-
PROTOC_VERSION := 29.3
22-
PROTOC_GEN_GO_VERSION := $(shell awk '/google.golang.org\/protobuf/ {print substr($$2, 2)}' go.mod)
23-
PROTOC_GEN_GO_GRPC_VERSON=1.5.1
24-
PROTOC_GEN_DOC_VERSION=1.5.1
16+
PROTOC := protoc
2517

2618
.PHONY: all
2719
all: build/moco-agent
2820

21+
.PHONY: aqua-install
22+
aqua-install:
23+
aqua install
24+
2925
.PHONY: validate
30-
validate: setup
26+
validate: setup aqua-install
3127
test -z "$$(gofmt -s -l . | tee /dev/stderr)"
3228
staticcheck ./...
3329
test -z "$$(custom-checker -restrictpkg.packages=html/template,log $$(go list -tags='$(GOTAGS)' ./... ) 2>&1 | tee /dev/stderr)"
@@ -50,50 +46,26 @@ build/moco-agent: $(GO_FILES)
5046
go build -o $@ ./cmd/moco-agent
5147

5248
.PHONY: proto
53-
proto: proto/agentrpc.pb.go proto/agentrpc_grpc.pb.go docs/agentrpc.md
49+
proto: aqua-install proto/agentrpc.pb.go proto/agentrpc_grpc.pb.go docs/agentrpc.md
5450

55-
proto/agentrpc.pb.go: proto/agentrpc.proto $(PROTOC_BIN) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC)
51+
proto/agentrpc.pb.go: proto/agentrpc.proto
5652
$(PROTOC) --go_out=module=github.com/cybozu-go/moco-agent:. $<
5753

58-
proto/agentrpc_grpc.pb.go: proto/agentrpc.proto $(PROTOC_BIN) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC)
54+
proto/agentrpc_grpc.pb.go: proto/agentrpc.proto
5955
$(PROTOC) --go-grpc_out=module=github.com/cybozu-go/moco-agent:. $<
6056

61-
docs/agentrpc.md: proto/agentrpc.proto $(PROTOC_BIN) $(PROTOC_GEN_DOC)
57+
docs/agentrpc.md: proto/agentrpc.proto
6258
$(PROTOC) --doc_out=docs --doc_opt=markdown,$@ $<
6359

64-
$(PROTOC_BIN):
65-
mkdir -p bin
66-
curl -sfL -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-linux-x86_64.zip
67-
unzip -o protoc.zip bin/protoc 'include/*'
68-
rm -f protoc.zip
69-
70-
$(PROTOC_GEN_GO):
71-
mkdir -p bin
72-
GOBIN=$(PWD)/bin go install google.golang.org/protobuf/cmd/protoc-gen-go@v$(PROTOC_GEN_GO_VERSION)
73-
74-
$(PROTOC_GEN_GO_GRPC):
75-
mkdir -p bin
76-
GOBIN=$(PWD)/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v$(PROTOC_GEN_GO_GRPC_VERSON)
77-
78-
$(PROTOC_GEN_DOC):
79-
mkdir -p bin
80-
GOBIN=$(PWD)/bin go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v$(PROTOC_GEN_DOC_VERSION)
81-
8260
.PHONY: setup
83-
setup: custom-checker staticcheck $(PROTOC_BIN) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) $(PROTOC_GEN_DOC)
61+
setup: custom-checker
8462

8563
.PHONY: custom-checker
8664
custom-checker:
8765
if ! which custom-checker >/dev/null; then \
8866
env GOFLAGS= go install github.com/cybozu-go/golang-custom-analyzer/cmd/custom-checker@latest; \
8967
fi
9068

91-
.PHONY: staticcheck
92-
staticcheck:
93-
if ! which staticcheck >/dev/null; then \
94-
env GOFLAGS= go install honnef.co/go/tools/cmd/staticcheck@latest; \
95-
fi
96-
9769
.PHONY: clean
9870
clean:
9971
rm -rf build

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ Docker images are available on [GitHub Container Registry](https://github.com/or
1717

1818
[releases]: https://github.com/cybozu-go/moco-agent/releases
1919
[MOCO]: https://github.com/cybozu-go/moco
20+
21+
## Development
22+
23+
### Prerequisites
24+
25+
This project uses [aqua](https://aquaproj.github.io/) to manage development tools. Before starting development, please install aqua by following the instructions at https://aquaproj.github.io/docs/install.
26+
27+
Once aqua is installed, the required development tools will be automatically installed when you run make commands.

aqua-checksums.json

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
{
2+
"checksums": [
3+
{
4+
"id": "github_release/github.com/dominikh/go-tools/2025.1.1/staticcheck_darwin_amd64.tar.gz",
5+
"checksum": "D66E2D65EFC02C314B578B28A8DB3008F82F8FC1C8EB6EDCBE04B3C3444A1F8A",
6+
"algorithm": "sha256"
7+
},
8+
{
9+
"id": "github_release/github.com/dominikh/go-tools/2025.1.1/staticcheck_darwin_arm64.tar.gz",
10+
"checksum": "CE1911C11EC2C079936A80163DBA10156C7C79FD1423D432B2A24825A22F5E8D",
11+
"algorithm": "sha256"
12+
},
13+
{
14+
"id": "github_release/github.com/dominikh/go-tools/2025.1.1/staticcheck_linux_amd64.tar.gz",
15+
"checksum": "AE320E410225295ECB2A2CD406113E3C2FE40521AAED984DD11DC41A0A50B253",
16+
"algorithm": "sha256"
17+
},
18+
{
19+
"id": "github_release/github.com/dominikh/go-tools/2025.1.1/staticcheck_linux_arm64.tar.gz",
20+
"checksum": "B135FD89DBC875F20D83E66948FFF256AF738B33B48A64024C0752F29EA1EB13",
21+
"algorithm": "sha256"
22+
},
23+
{
24+
"id": "github_release/github.com/dominikh/go-tools/2025.1.1/staticcheck_windows_amd64.tar.gz",
25+
"checksum": "434D2FC10049A39FE069C6370CD45C1330871B01A4500FAC970FCD6BFB1D1FE9",
26+
"algorithm": "sha256"
27+
},
28+
{
29+
"id": "github_release/github.com/grpc/grpc-go/cmd/protoc-gen-go-grpc/v1.5.1/protoc-gen-go-grpc.v1.5.1.darwin.amd64.tar.gz",
30+
"checksum": "C12C259D59C8B451F24B6ABDAD6D055FD0884C5268B7247FD7E5EC9D2432D1F1",
31+
"algorithm": "sha256"
32+
},
33+
{
34+
"id": "github_release/github.com/grpc/grpc-go/cmd/protoc-gen-go-grpc/v1.5.1/protoc-gen-go-grpc.v1.5.1.darwin.arm64.tar.gz",
35+
"checksum": "D6083FEB51DCFE59F26793E99EF01EF5EAC68B64294EC2546711F614AC5878F3",
36+
"algorithm": "sha256"
37+
},
38+
{
39+
"id": "github_release/github.com/grpc/grpc-go/cmd/protoc-gen-go-grpc/v1.5.1/protoc-gen-go-grpc.v1.5.1.linux.amd64.tar.gz",
40+
"checksum": "A6CAC4EA731E54AEA304AD44D704A69D1CDC82997084B33637E21A89DC9229D6",
41+
"algorithm": "sha256"
42+
},
43+
{
44+
"id": "github_release/github.com/grpc/grpc-go/cmd/protoc-gen-go-grpc/v1.5.1/protoc-gen-go-grpc.v1.5.1.linux.arm64.tar.gz",
45+
"checksum": "370A7CFA5786E61E6FDC5AA8F689E35C2D27D036A49CAAC7AA25F962C89A01E8",
46+
"algorithm": "sha256"
47+
},
48+
{
49+
"id": "github_release/github.com/grpc/grpc-go/cmd/protoc-gen-go-grpc/v1.5.1/protoc-gen-go-grpc.v1.5.1.windows.amd64.tar.gz",
50+
"checksum": "C2AD1460C9E34B5B37759826DA61220BE6EE0A8A11431723D205512A69319991",
51+
"algorithm": "sha256"
52+
},
53+
{
54+
"id": "github_release/github.com/grpc/grpc-go/cmd/protoc-gen-go-grpc/v1.5.1/protoc-gen-go-grpc.v1.5.1.windows.arm64.tar.gz",
55+
"checksum": "D63AA664B0453DF18E0FE6AF0D30CC434377A6AD4D6B1843EEEE404CE25F2B1F",
56+
"algorithm": "sha256"
57+
},
58+
{
59+
"id": "github_release/github.com/protocolbuffers/protobuf-go/v1.36.4/protoc-gen-go.v1.36.4.darwin.amd64.tar.gz",
60+
"checksum": "237C9756CBA9705EEEA037BEC57BD95B9EABBE702DA3D3BA4AD9C6EB56C181BC",
61+
"algorithm": "sha256"
62+
},
63+
{
64+
"id": "github_release/github.com/protocolbuffers/protobuf-go/v1.36.4/protoc-gen-go.v1.36.4.darwin.arm64.tar.gz",
65+
"checksum": "C795CA96CD21EE2776D2D9AF503FC06D07804E9FF4781332B31895086266BC27",
66+
"algorithm": "sha256"
67+
},
68+
{
69+
"id": "github_release/github.com/protocolbuffers/protobuf-go/v1.36.4/protoc-gen-go.v1.36.4.linux.amd64.tar.gz",
70+
"checksum": "F6495E38CEFA9B3E36598E8431C8CE0748D06166A22492D4CF3EFEF199BF21DC",
71+
"algorithm": "sha256"
72+
},
73+
{
74+
"id": "github_release/github.com/protocolbuffers/protobuf-go/v1.36.4/protoc-gen-go.v1.36.4.linux.arm64.tar.gz",
75+
"checksum": "7BF77D649927F86FBEA31CC5415FF8A26D42F4BA89304E139D5C3CCA2B50549B",
76+
"algorithm": "sha256"
77+
},
78+
{
79+
"id": "github_release/github.com/protocolbuffers/protobuf-go/v1.36.4/protoc-gen-go.v1.36.4.windows.amd64.zip",
80+
"checksum": "AEB5A42A4396D63D4EC88567EAA5038E120518F24A2610AFB04CF03DC5CD3238",
81+
"algorithm": "sha256"
82+
},
83+
{
84+
"id": "github_release/github.com/protocolbuffers/protobuf-go/v1.36.4/protoc-gen-go.v1.36.4.windows.arm64.zip",
85+
"checksum": "938867FE9894D0EB1DBE60F663B499DCAC9E8DADB0DA99439B9E2ACCE2A7CFAE",
86+
"algorithm": "sha256"
87+
},
88+
{
89+
"id": "github_release/github.com/protocolbuffers/protobuf/v29.3/protoc-29.3-linux-aarch_64.zip",
90+
"checksum": "6427349140E01F06E049E707A58709A4F221AE73AB9A0425BC4A00C8D0E1AB32",
91+
"algorithm": "sha256"
92+
},
93+
{
94+
"id": "github_release/github.com/protocolbuffers/protobuf/v29.3/protoc-29.3-linux-x86_64.zip",
95+
"checksum": "3E866620C5BE27664F3D2FA2D656B5F3E09B5152B42F1BEDBF427B333E90021A",
96+
"algorithm": "sha256"
97+
},
98+
{
99+
"id": "github_release/github.com/protocolbuffers/protobuf/v29.3/protoc-29.3-osx-aarch_64.zip",
100+
"checksum": "2B8A3403CD097F95F3BA656E14B76C732B6B26D7F183330B11E36EF2BC028765",
101+
"algorithm": "sha256"
102+
},
103+
{
104+
"id": "github_release/github.com/protocolbuffers/protobuf/v29.3/protoc-29.3-osx-x86_64.zip",
105+
"checksum": "9A788036D8F9854F7B03C305DF4777CF0E54E5B081E25BF15252DA87E0E90875",
106+
"algorithm": "sha256"
107+
},
108+
{
109+
"id": "github_release/github.com/protocolbuffers/protobuf/v29.3/protoc-29.3-win64.zip",
110+
"checksum": "57EA59E9F551AD8D71FFAA9B5CFBE0CA1F4E720972A1DB7EC2D12AB44BFF9383",
111+
"algorithm": "sha256"
112+
},
113+
{
114+
"id": "github_release/github.com/pseudomuto/protoc-gen-doc/v1.5.1/protoc-gen-doc_1.5.1_darwin_amd64.tar.gz",
115+
"checksum": "F429E5A5DDD886BFB68265F2F92C1C6A509780B7ADCAF7A8B3BE943F28E144BA",
116+
"algorithm": "sha256"
117+
},
118+
{
119+
"id": "github_release/github.com/pseudomuto/protoc-gen-doc/v1.5.1/protoc-gen-doc_1.5.1_darwin_arm64.tar.gz",
120+
"checksum": "6E8C737D9A67A6A873A3F1D37ED8BB2A0A9996F6DCF6701AA1048C7BD798AAF9",
121+
"algorithm": "sha256"
122+
},
123+
{
124+
"id": "github_release/github.com/pseudomuto/protoc-gen-doc/v1.5.1/protoc-gen-doc_1.5.1_linux_amd64.tar.gz",
125+
"checksum": "47CD72B07E6DAB3408D686A65D37D3A6AB616DA7D8B564B2BD2A2963A72B72FD",
126+
"algorithm": "sha256"
127+
},
128+
{
129+
"id": "github_release/github.com/pseudomuto/protoc-gen-doc/v1.5.1/protoc-gen-doc_1.5.1_linux_arm64.tar.gz",
130+
"checksum": "172E6A191DACED8EB31EBCD90D4523A1AFFA6D07900A89B548421823DDA796FE",
131+
"algorithm": "sha256"
132+
},
133+
{
134+
"id": "github_release/github.com/pseudomuto/protoc-gen-doc/v1.5.1/protoc-gen-doc_1.5.1_windows_amd64.tar.gz",
135+
"checksum": "8ACF0BF64EDA29183B4C6745C3C6A12562FD9A8AB08D61788CF56E6659C66B3B",
136+
"algorithm": "sha256"
137+
},
138+
{
139+
"id": "github_release/github.com/pseudomuto/protoc-gen-doc/v1.5.1/protoc-gen-doc_1.5.1_windows_arm64.tar.gz",
140+
"checksum": "BF8BC651C17E64BFEC663192E660655C2BCC415F6DFF9E88201D8B07FB23D493",
141+
"algorithm": "sha256"
142+
},
143+
{
144+
"id": "registries/github_content/github.com/aquaproj/aqua-registry/v4.346.0/registry.yaml",
145+
"checksum": "68E1512DFAB0878E0788890012C28BE47E3B43738EB4910C6B867394482671EE",
146+
"algorithm": "sha256"
147+
}
148+
]
149+
}

aqua.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/aquaproj/aqua/main/json-schema/aqua-yaml.json
3+
# aqua - Declarative CLI Version Manager
4+
# https://aquaproj.github.io/
5+
checksum:
6+
enabled: true
7+
require_checksum: true
8+
# supported_envs:
9+
# - all
10+
registries:
11+
- type: standard
12+
ref: v4.346.0 # renovate: depName=aquaproj/aqua-registry
13+
packages:
14+
- name: protocolbuffers/protobuf/[email protected]
15+
- name: protocolbuffers/protobuf-go/[email protected]
16+
- name: grpc/grpc-go/protoc-gen-go-grpc@cmd/protoc-gen-go-grpc/v1.5.1
17+
- name: pseudomuto/[email protected]
18+
- name: dominikh/go-tools/[email protected]

0 commit comments

Comments
 (0)