From a234856a505a6605050d4bbab72fe0ad48ed76af Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Thu, 19 Dec 2024 14:00:03 -0700 Subject: [PATCH] dev-infrastructure: parallelize fmt, lint Signed-off-by: Steve Kuznetsov --- dev-infrastructure/Makefile | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/dev-infrastructure/Makefile b/dev-infrastructure/Makefile index 82bb47856..c6638f914 100644 --- a/dev-infrastructure/Makefile +++ b/dev-infrastructure/Makefile @@ -27,23 +27,18 @@ list: @grep '^[^#[:space:]].*:' Makefile .PHONY: list -fmt: - set -e; \ - FILES="$$(find . -type f -name "*.bicep*" ! -name "*.tmpl.bicepparam")"; \ - for file in $$FILES; do \ - echo "az bicep format --file $${file}"; \ - az bicep format --file $$file; \ - done -.PHONY: fmt - -lint: - set -e; \ - FILES="$$(find . -type f -name "*.bicep*" ! -name "*.tmpl.bicepparam")"; \ - for file in $$FILES; do \ - echo "az bicep lint --file $${file}"; \ - az bicep lint --file $$file; \ - done -.PHONY: lint +modules := $(wildcard ./templates/*.bicep) +parameters := $(filter-out $(wildcard ./templates/*.tmpl.bicepparam),$(wildcard ./templates/*.bicepparam)) + +fmt: $(modules:.bicep=.bicep.fmt) $(parameters:.bicepparam=.biceparam.fmt) + +lint: $(modules:.bicep=.bicep.lint) $(parameters:.bicepparam=.biceparam.lint) + +%.bicep.fmt %.bicepparam.fmt: + az bicep format --file $(basename $@) + +%.bicep.lint %.bicepparam.lint: + az bicep lint --file $(basename $@) feature-registration: # hardcoded to eastus as this is a subscription deployment, not a resource group @az deployment sub create \