From 6b755234685bb1d0cfeeb3770f25e9df3d111fde Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 20 Nov 2023 22:51:33 +0200 Subject: [PATCH] Makefile: speedup `release`, `publish` and `crossbuild` rules by using parallel make --- .github/workflows/main.yml | 2 +- Makefile | 31 +++++++++++++++++-------------- deployment/docker/Makefile | 12 ++++++------ 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 372c341686..8e1c95f62f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,4 +92,4 @@ jobs: - name: Build run: | - make vmcluster-crossbuild + make crossbuild diff --git a/Makefile b/Makefile index 70365f19b8..8d96b628d9 100644 --- a/Makefile +++ b/Makefile @@ -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))) @@ -72,14 +73,16 @@ vmcluster-windows-amd64: \ vmselect-windows-amd64 \ vmstorage-windows-amd64 -vmcluster-crossbuild: \ - vmcluster-linux-amd64 \ - vmcluster-linux-arm64 \ - vmcluster-linux-arm \ - vmcluster-linux-ppc64le \ - vmcluster-linux-386 \ - vmcluster-freebsd-amd64 \ - vmcluster-openbsd-amd64 +crossbuild: vmcluster-crossbuild + +vmcluster-crossbuild: + $(MAKE_PARALLEL) vmcluster-linux-amd64 \ + vmcluster-linux-arm64 \ + vmcluster-linux-arm \ + vmcluster-linux-ppc64le \ + vmcluster-linux-386 \ + vmcluster-freebsd-amd64 \ + vmcluster-openbsd-amd64 publish: \ publish-vminsert \ @@ -93,13 +96,13 @@ package: \ 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-vmcluster +release: + $(MAKE_PARALLEL) release-vmcluster release-vmcluster: \ release-vmcluster-linux-amd64 \ diff --git a/deployment/docker/Makefile b/deployment/docker/Makefile index 59dcc52921..474558918f 100644 --- a/deployment/docker/Makefile +++ b/deployment/docker/Makefile @@ -68,12 +68,12 @@ 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 \ - app-via-docker-linux-arm \ - app-via-docker-linux-arm64 \ - app-via-docker-linux-ppc64le \ - app-via-docker-linux-386 +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 \ + app-via-docker-linux-386 $(DOCKER) buildx build \ --platform=linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/386 \ --build-arg certs_image=$(CERTS_IMAGE) \