From 2ac4d5f8e944b851b8832183e0b8fcbeb1a14f99 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Sat, 15 Jun 2024 04:26:18 -0400 Subject: [PATCH] chore: update test workflow --- Makefile | 10 +++++++--- scripts/prepare_test_repos.sh | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d5ba0a4..cea7f45 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,23 @@ -.PHONY: all clean test +.PHONY: all build clean prepare-test test BUILD_DIR = ./build +TMP_DIR = ./tmp APPS := $(notdir $(wildcard ./cmd/*)) FLAGS := "-s -w" -all: +all: build + +build: $(foreach APP,$(APPS), go build -ldflags=$(FLAGS) -o $(BUILD_DIR)/$(APP) ./cmd/$(APP);) clean: rm -rf $(BUILD_DIR)/* + rm -rf $(TMP_DIR)/* rm -rf *.out prepare-test: git submodule update --init --remote test: - ./scripts/prepare_test_repos.sh + ./scripts/prepare_test_repos.sh $(TMP_DIR) go test -coverprofile cover.out -v ./... diff --git a/scripts/prepare_test_repos.sh b/scripts/prepare_test_repos.sh index fc877b4..de93557 100755 --- a/scripts/prepare_test_repos.sh +++ b/scripts/prepare_test_repos.sh @@ -2,7 +2,7 @@ set -ex declare -A repo_names -tmp_dir="./tmp" +tmp_dir=${1:-./tmp} submodules_dir="$tmp_dir/submodules" rm -rf $submodules_dir mkdir -p $submodules_dir