From e723bad0afb36823fb926db95fa4da43bb6e439f Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Mon, 28 Nov 2022 14:27:03 +0800 Subject: [PATCH] ci: let static checks don't depend on build Build is a time consumable operation, skip build while let ci run faster. Fixes: #5777 Signed-off-by: Bin Liu --- Makefile | 4 ++-- src/agent/Makefile | 2 ++ src/dragonball/Makefile | 3 +++ src/libs/Makefile | 3 +++ src/runtime-rs/Makefile | 2 ++ src/runtime/Makefile | 2 ++ src/tools/agent-ctl/Makefile | 3 +++ src/tools/kata-ctl/Makefile | 2 ++ src/tools/log-parser/Makefile | 3 +++ src/tools/runk/Makefile | 3 +++ src/tools/trace-forwarder/Makefile | 3 +++ utils.mk | 3 +++ 12 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c76af04a91..d4a3dad05f 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ TOOLS += log-parser TOOLS += runk TOOLS += trace-forwarder -STANDARD_TARGETS = build check clean install test vendor +STANDARD_TARGETS = build check clean install static-checks-build test vendor default: all @@ -37,7 +37,7 @@ generate-protocols: make -C src/agent generate-protocols # Some static checks rely on generated source files of components. -static-checks: build +static-checks: static-checks-build bash ci/static-checks.sh docs-url-alive-check: diff --git a/src/agent/Makefile b/src/agent/Makefile index f0e86fd6bc..51da58d3a7 100644 --- a/src/agent/Makefile +++ b/src/agent/Makefile @@ -107,6 +107,8 @@ endef ##TARGET default: build code default: $(TARGET) show-header +static-checks-build: $(GENERATED_CODE) + $(TARGET): $(GENERATED_CODE) $(TARGET_PATH) $(TARGET_PATH): show-summary diff --git a/src/dragonball/Makefile b/src/dragonball/Makefile index 279d872bbc..ab8e5b6947 100644 --- a/src/dragonball/Makefile +++ b/src/dragonball/Makefile @@ -16,6 +16,9 @@ build: @echo "INFO: cargo build..." cargo build --all-features --target $(TRIPLE) +static-checks-build: + @echo "INFO: static-checks-build do nothing.." + check: clippy format clippy: diff --git a/src/libs/Makefile b/src/libs/Makefile index 9ce0be19de..aabaa33913 100644 --- a/src/libs/Makefile +++ b/src/libs/Makefile @@ -16,6 +16,9 @@ default: build build: cargo build --all-features +static-checks-build: + @echo "INFO: static-checks-build do nothing.." + check: clippy format clippy: diff --git a/src/runtime-rs/Makefile b/src/runtime-rs/Makefile index a78d41770f..5dcd89e649 100644 --- a/src/runtime-rs/Makefile +++ b/src/runtime-rs/Makefile @@ -361,6 +361,8 @@ GENERATED_FILES += $(CONFIGS) runtime: $(TARGET) +static-checks-build: $(GENERATED_FILES) + $(TARGET): $(GENERATED_FILES) $(TARGET_PATH) $(TARGET_PATH): $(SOURCES) | show-summary diff --git a/src/runtime/Makefile b/src/runtime/Makefile index a96ee49dc6..0f49badd44 100644 --- a/src/runtime/Makefile +++ b/src/runtime/Makefile @@ -680,6 +680,8 @@ handle_vendor: vendor: handle_vendor ./hack/tree_status.sh +static-checks-build: $(GENERATED_FILES) + clean: $(QUIET_CLEAN)rm -f \ $(CONFIGS) \ diff --git a/src/tools/agent-ctl/Makefile b/src/tools/agent-ctl/Makefile index 99713f6c8d..c8fc72683a 100644 --- a/src/tools/agent-ctl/Makefile +++ b/src/tools/agent-ctl/Makefile @@ -11,6 +11,9 @@ default: build build: @RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) +static-checks-build: + @echo "INFO: static-checks-build do nothing.." + clean: cargo clean diff --git a/src/tools/kata-ctl/Makefile b/src/tools/kata-ctl/Makefile index e11af38457..167f85c3e3 100644 --- a/src/tools/kata-ctl/Makefile +++ b/src/tools/kata-ctl/Makefile @@ -36,6 +36,8 @@ $(TARGET): $(GENERATED_CODE) build: @RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) $(if $(findstring release,$(BUILD_TYPE)),--release) $(EXTRA_RUSTFEATURES) +static-checks-build: $(GENERATED_CODE) + $(GENERATED_FILES): %: %.in @sed $(foreach r,$(GENERATED_REPLACEMENTS),-e 's|@$r@|$($r)|g') "$<" > "$@" diff --git a/src/tools/log-parser/Makefile b/src/tools/log-parser/Makefile index bdef52ab76..0a680059b3 100644 --- a/src/tools/log-parser/Makefile +++ b/src/tools/log-parser/Makefile @@ -29,6 +29,9 @@ install: $(TARGET) install -d $(shell dirname $(DESTTARGET)) install $(TARGET) $(DESTTARGET) +static-checks-build: + @echo "INFO: static-checks-build do nothing.." + clean: rm -f $(TARGET) diff --git a/src/tools/runk/Makefile b/src/tools/runk/Makefile index 1dde1c6ea5..d025b6a893 100644 --- a/src/tools/runk/Makefile +++ b/src/tools/runk/Makefile @@ -34,6 +34,9 @@ default: build build: @RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) $(EXTRA_RUSTFEATURES) +static-checks-build: + @echo "INFO: static-checks-build do nothing.." + install: install -D $(TARGET_PATH) $(BINDIR)/$(TARGET) diff --git a/src/tools/trace-forwarder/Makefile b/src/tools/trace-forwarder/Makefile index b6b223c001..5a529e2117 100644 --- a/src/tools/trace-forwarder/Makefile +++ b/src/tools/trace-forwarder/Makefile @@ -11,6 +11,9 @@ default: build build: @RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) +static-checks-build: + @echo "INFO: static-checks-build do nothing.." + clean: cargo clean diff --git a/utils.mk b/utils.mk index bc4aa392c9..a7d559d347 100644 --- a/utils.mk +++ b/utils.mk @@ -39,6 +39,9 @@ $(2) : $(1)/$(2)/Makefile make -C $(1)/$(2) build-$(2) : $(2) +static-checks-build-$(2): + make -C $(1)/$(2) static-checks-build + check-$(2) : $(2) make -C $(1)/$(2) check