chore: Use make target for protoc

Migrate the CI scripting of installing protoc to a Makefile target.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
SuperQ
2026-03-26 11:07:15 +01:00
parent 8fcd0a5d04
commit 9587b2ebc0
2 changed files with 20 additions and 9 deletions

View File

@@ -43,15 +43,8 @@ jobs:
- run: go test --tags=slicelabels -race ./cmd/prometheus ./model/textparse ./prompb/...
- run: go test --tags=forcedirectio -race ./tsdb/
- run: GOARCH=386 go test ./...
- run: |
VERSION="3.15.8"
env
set -x
curl -s -L https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-x86_64.zip > /tmp/protoc.zip
unzip -d /tmp /tmp/protoc.zip
chmod +x /tmp/bin/protoc
export PATH=/tmp/bin:$PATH
make proto
- run: make protoc
- run: make proto
- run: git diff --exit-code
test_go_oldest:

View File

@@ -31,6 +31,15 @@ GOYACC_VERSION ?= v0.6.0
include Makefile.common
ifeq (arm, $(GOHOSTARCH))
PROTOC_ARCH ?= aarch_64
else
PROTOC_ARCH ?= x86_64
endif
PROTOC_VERSION ?= 3.15.8
PROTOC_URL ?= https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-linux-$(PROTOC_ARCH).zip
DOCKER_IMAGE_NAME ?= prometheus
# Only build UI if PREBUILT_ASSETS_STATIC_DIR is not set
@@ -129,6 +138,15 @@ assets-tarball: assets
@echo '>> packaging assets'
scripts/package_assets.sh
.PHONY: protoc
protoc:
@echo ">> Installing protoc"
$(eval PROTOC_TMP := $(shell mktemp))
curl -s -o $(PROTOC_TMP) -L $(PROTOC_URL)
unzip -u $(PROTOC_TMP) bin/protoc -d $(FIRST_GOPATH)
chmod +x $(FIRST_GOPATH)/bin/protoc
rm -v $(PROTOC_TMP)
.PHONY: parser
parser:
@echo ">> running goyacc to generate the .go file."