Skip to content

Commit

Permalink
ci: let static checks don't depend on build
Browse files Browse the repository at this point in the history
Build is a time consumable operation, skip build while let
ci run faster.

Fixes: kata-containers#5777

Signed-off-by: Bin Liu <[email protected]>
  • Loading branch information
liubin committed Nov 28, 2022
1 parent f02bb1a commit e723bad
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand 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:
Expand Down
2 changes: 2 additions & 0 deletions src/agent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/dragonball/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions src/libs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions src/runtime-rs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ GENERATED_FILES += $(CONFIGS)

runtime: $(TARGET)

static-checks-build: $(GENERATED_FILES)

$(TARGET): $(GENERATED_FILES) $(TARGET_PATH)

$(TARGET_PATH): $(SOURCES) | show-summary
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ handle_vendor:
vendor: handle_vendor
./hack/tree_status.sh

static-checks-build: $(GENERATED_FILES)

clean:
$(QUIET_CLEAN)rm -f \
$(CONFIGS) \
Expand Down
3 changes: 3 additions & 0 deletions src/tools/agent-ctl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/tools/kata-ctl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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') "$<" > "$@"

Expand Down
3 changes: 3 additions & 0 deletions src/tools/log-parser/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions src/tools/runk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions src/tools/trace-forwarder/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions utils.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e723bad

Please sign in to comment.