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 46e58f3669
commit 6b75523468
No known key found for this signature in database
GPG Key ID: 52C003EE2BCDB9EB
3 changed files with 24 additions and 21 deletions

View File

@ -92,4 +92,4 @@ jobs:
- name: Build - name: Build
run: | run: |
make vmcluster-crossbuild make crossbuild

View File

@ -1,5 +1,6 @@
PKG_PREFIX := github.com/VictoriaMetrics/VictoriaMetrics 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') DATEINFO_TAG ?= $(shell date -u +'%Y%m%d-%H%M%S')
BUILDINFO_TAG ?= $(shell echo $$(git describe --long --all | tr '/' '-')$$( \ 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))) git diff-index --quiet HEAD -- || echo '-dirty-'$$(git diff-index -u HEAD | openssl sha1 | cut -d' ' -f2 | cut -c 1-8)))
@ -72,8 +73,10 @@ vmcluster-windows-amd64: \
vmselect-windows-amd64 \ vmselect-windows-amd64 \
vmstorage-windows-amd64 vmstorage-windows-amd64
vmcluster-crossbuild: \ crossbuild: vmcluster-crossbuild
vmcluster-linux-amd64 \
vmcluster-crossbuild:
$(MAKE_PARALLEL) vmcluster-linux-amd64 \
vmcluster-linux-arm64 \ vmcluster-linux-arm64 \
vmcluster-linux-arm \ vmcluster-linux-arm \
vmcluster-linux-ppc64le \ vmcluster-linux-ppc64le \
@ -93,13 +96,13 @@ package: \
publish-release: publish-release:
rm -rf bin/* rm -rf bin/*
git checkout $(TAG) && LATEST_TAG=stable $(MAKE) release publish && \ git checkout $(TAG) && $(MAKE) release && LATEST_TAG=stable $(MAKE) publish && \
git checkout $(TAG)-cluster && LATEST_TAG=cluster-stable $(MAKE) release publish && \ git checkout $(TAG)-cluster && $(MAKE) release && LATEST_TAG=cluster-stable $(MAKE) publish && \
git checkout $(TAG)-enterprise && LATEST_TAG=enterprise-stable $(MAKE) release publish && \ git checkout $(TAG)-enterprise && $(MAKE) release && LATEST_TAG=enterprise-stable $(MAKE) publish && \
git checkout $(TAG)-enterprise-cluster && LATEST_TAG=enterprise-cluster-stable $(MAKE) release publish git checkout $(TAG)-enterprise-cluster && $(MAKE) release && LATEST_TAG=enterprise-cluster-stable $(MAKE) publish
release: \ release:
release-vmcluster $(MAKE_PARALLEL) release-vmcluster
release-vmcluster: \ release-vmcluster: \
release-vmcluster-linux-amd64 \ release-vmcluster-linux-amd64 \

View File

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