Makefile: speedup release, publish and crossbuild rules by using parallel make

This commit is contained in:
Aliaksandr Valialkin 2023-11-20 22:51:33 +02:00
parent fbab838dc0
commit 81ddee4f3a
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
3 changed files with 164 additions and 161 deletions

View file

@ -92,5 +92,4 @@ jobs:
- name: Build
run: |
make victoria-metrics-crossbuild
make vmuitils-crossbuild
make crossbuild

View file

@ -1,5 +1,6 @@
PKG_PREFIX := github.com/VictoriaMetrics/VictoriaMetrics
MAKE_PARALLEL := $(MAKE) -j `cat /proc/cpuinfo | grep -c processor`
DATEINFO_TAG ?= $(shell date -u +'%Y%m%d-%H%M%S')
BUILDINFO_TAG ?= $(shell echo $$(git describe --long --all | tr '/' '-')$$( \
git diff-index --quiet HEAD -- || echo '-dirty-'$$(git diff-index -u HEAD | openssl sha1 | cut -d' ' -f2 | cut -c 1-8)))
@ -55,8 +56,8 @@ package: \
package-vmrestore \
package-vmctl
vmutils: \
vmagent \
vmutils:
$(MAKE_PARALLEL) vmagent \
vmalert \
vmalert-tool \
vmauth \
@ -64,8 +65,8 @@ vmutils: \
vmrestore \
vmctl
vmutils-pure: \
vmagent-pure \
vmutils-pure:
$(MAKE_PARALLEL) vmagent-pure \
vmalert-pure \
vmalert-tool-pure \
vmauth-pure \
@ -73,8 +74,8 @@ vmutils-pure: \
vmrestore-pure \
vmctl-pure
vmutils-linux-amd64: \
vmagent-linux-amd64 \
vmutils-linux-amd64:
$(MAKE_PARALLEL) vmagent-linux-amd64 \
vmalert-linux-amd64 \
vmalert-tool-linux-amd64 \
vmauth-linux-amd64 \
@ -82,8 +83,8 @@ vmutils-linux-amd64: \
vmrestore-linux-amd64 \
vmctl-linux-amd64
vmutils-linux-arm64: \
vmagent-linux-arm64 \
vmutils-linux-arm64:
$(MAKE_PARALLEL) vmagent-linux-arm64 \
vmalert-linux-arm64 \
vmalert-tool-linux-arm64 \
vmauth-linux-arm64 \
@ -91,8 +92,8 @@ vmutils-linux-arm64: \
vmrestore-linux-arm64 \
vmctl-linux-arm64
vmutils-linux-arm: \
vmagent-linux-arm \
vmutils-linux-arm:
$(MAKE_PARALLEL) vmagent-linux-arm \
vmalert-linux-arm \
vmalert-tool-linux-arm \
vmauth-linux-arm \
@ -100,8 +101,8 @@ vmutils-linux-arm: \
vmrestore-linux-arm \
vmctl-linux-arm
vmutils-linux-386: \
vmagent-linux-386 \
vmutils-linux-386:
$(MAKE_PARALLEL) vmagent-linux-386 \
vmalert-linux-386 \
vmalert-tool-linux-386 \
vmauth-linux-386 \
@ -109,8 +110,8 @@ vmutils-linux-386: \
vmrestore-linux-386 \
vmctl-linux-386
vmutils-linux-ppc64le: \
vmagent-linux-ppc64le \
vmutils-linux-ppc64le:
$(MAKE_PARALLEL) vmagent-linux-ppc64le \
vmalert-linux-ppc64le \
vmalert-tool-linux-ppc64le \
vmauth-linux-ppc64le \
@ -118,8 +119,8 @@ vmutils-linux-ppc64le: \
vmrestore-linux-ppc64le \
vmctl-linux-ppc64le
vmutils-darwin-amd64: \
vmagent-darwin-amd64 \
vmutils-darwin-amd64:
$(MAKE_PARALLEL) vmagent-darwin-amd64 \
vmalert-darwin-amd64 \
vmalert-tool-darwin-amd64 \
vmauth-darwin-amd64 \
@ -127,8 +128,8 @@ vmutils-darwin-amd64: \
vmrestore-darwin-amd64 \
vmctl-darwin-amd64
vmutils-darwin-arm64: \
vmagent-darwin-arm64 \
vmutils-darwin-arm64:
$(MAKE_PARALLEL) vmagent-darwin-arm64 \
vmalert-darwin-arm64 \
vmalert-tool-darwin-arm64 \
vmauth-darwin-arm64 \
@ -136,8 +137,8 @@ vmutils-darwin-arm64: \
vmrestore-darwin-arm64 \
vmctl-darwin-arm64
vmutils-freebsd-amd64: \
vmagent-freebsd-amd64 \
vmutils-freebsd-amd64:
$(MAKE_PARALLEL) vmagent-freebsd-amd64 \
vmalert-freebsd-amd64 \
vmalert-tool-freebsd-amd64 \
vmauth-freebsd-amd64 \
@ -145,8 +146,8 @@ vmutils-freebsd-amd64: \
vmrestore-freebsd-amd64 \
vmctl-freebsd-amd64
vmutils-openbsd-amd64: \
vmagent-openbsd-amd64 \
vmutils-openbsd-amd64:
$(MAKE_PARALLEL) vmagent-openbsd-amd64 \
vmalert-openbsd-amd64 \
vmalert-tool-openbsd-amd64 \
vmauth-openbsd-amd64 \
@ -154,8 +155,8 @@ vmutils-openbsd-amd64: \
vmrestore-openbsd-amd64 \
vmctl-openbsd-amd64
vmutils-windows-amd64: \
vmagent-windows-amd64 \
vmutils-windows-amd64:
$(MAKE_PARALLEL) vmagent-windows-amd64 \
vmalert-windows-amd64 \
vmalert-tool-windows-amd64 \
vmauth-windows-amd64 \
@ -163,8 +164,10 @@ vmutils-windows-amd64: \
vmrestore-windows-amd64 \
vmctl-windows-amd64
victoria-metrics-crossbuild: \
victoria-metrics-linux-386 \
crossbuild: victoria-metrics-crossbuild vmutils-crossbuild
victoria-metrics-crossbuild:
$(MAKE_PARALLEL) victoria-metrics-linux-386 \
victoria-metrics-linux-amd64 \
victoria-metrics-linux-arm64 \
victoria-metrics-linux-arm \
@ -175,8 +178,9 @@ victoria-metrics-crossbuild: \
victoria-metrics-freebsd-amd64 \
victoria-metrics-openbsd-amd64
vmutils-crossbuild: \
vmutils-linux-386 \
vmutils-crossbuild:
# Do not use MAKE_PARALLEL, since every vmutils-* target already runs in parallel
$(MAKE) vmutils-linux-386 \
vmutils-linux-amd64 \
vmutils-linux-arm64 \
vmutils-linux-arm \
@ -190,17 +194,17 @@ vmutils-crossbuild: \
publish-release:
rm -rf bin/*
git checkout $(TAG) && LATEST_TAG=stable $(MAKE) release publish && \
git checkout $(TAG)-cluster && LATEST_TAG=cluster-stable $(MAKE) release publish && \
git checkout $(TAG)-enterprise && LATEST_TAG=enterprise-stable $(MAKE) release publish && \
git checkout $(TAG)-enterprise-cluster && LATEST_TAG=enterprise-cluster-stable $(MAKE) release publish
git checkout $(TAG) && $(MAKE) release && LATEST_TAG=stable $(MAKE) publish && \
git checkout $(TAG)-cluster && $(MAKE) release && LATEST_TAG=cluster-stable $(MAKE) publish && \
git checkout $(TAG)-enterprise && $(MAKE) release && LATEST_TAG=enterprise-stable $(MAKE) publish && \
git checkout $(TAG)-enterprise-cluster && $(MAKE) release && LATEST_TAG=enterprise-cluster-stable $(MAKE) publish
release: \
release-victoria-metrics \
release-vmutils
release-victoria-metrics: \
release-victoria-metrics-linux-386 \
release-victoria-metrics:
$(MAKE_PARALLEL) release-victoria-metrics-linux-386 \
release-victoria-metrics-linux-amd64 \
release-victoria-metrics-linux-arm \
release-victoria-metrics-linux-arm64 \
@ -256,8 +260,8 @@ release-victoria-metrics-windows-goarch: victoria-metrics-windows-$(GOARCH)-prod
cd bin && rm -rf \
victoria-metrics-windows-$(GOARCH)-prod.exe
release-victoria-logs: \
release-victoria-logs-linux-386 \
release-victoria-logs:
$(MAKE_PARALLEL) release-victoria-logs-linux-386 \
release-victoria-logs-linux-amd64 \
release-victoria-logs-linux-arm \
release-victoria-logs-linux-arm64 \
@ -313,8 +317,8 @@ release-victoria-logs-windows-goarch: victoria-logs-windows-$(GOARCH)-prod
cd bin && rm -rf \
victoria-logs-windows-$(GOARCH)-prod.exe
release-vmutils: \
release-vmutils-linux-386 \
release-vmutils:
$(MAKE_PARALLEL) release-vmutils-linux-386 \
release-vmutils-linux-amd64 \
release-vmutils-linux-arm64 \
release-vmutils-linux-arm \

View file

@ -68,8 +68,8 @@ package-via-docker: package-base
--tag $(DOCKER_NAMESPACE)/$(APP_NAME):$(PKG_TAG)$(APP_SUFFIX)$(RACE) \
-f app/$(APP_NAME)/deployment/Dockerfile bin)
publish-via-docker: \
app-via-docker-linux-amd64 \
publish-via-docker:
$(MAKE_PARALLEL) app-via-docker-linux-amd64 \
app-via-docker-linux-arm \
app-via-docker-linux-arm64 \
app-via-docker-linux-ppc64le \