-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (29 loc) · 923 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.PHONY: all build clean lint prepare-test test ci-test
BUILD_DIR := ./build
TMP_DIR := ./tmp
APPS := $(notdir $(wildcard ./cmd/*))
COMMIT_HASH := $(shell git rev-parse --short HEAD)
DATE := $(shell date +"%Y%m%d-%H%M%S")
VERSION := $(COMMIT_HASH)-$(DATE)
LDFLAGS := -s -w -X main.Version=$(VERSION)
GOFLAGS := -trimpath -mod=readonly -buildvcs=false
all: build
build:
$(foreach APP,$(APPS), \
CGO_ENABLED=0 \
go build $(GOFLAGS) -ldflags='$(LDFLAGS)' -o $(BUILD_DIR)/$(APP) ./cmd/$(APP) \
|| exit 1; \
)
clean:
$(RM) -rv $(BUILD_DIR) $(TMP_DIR) *.out
lint:
golangci-lint run -v
prepare-test:
git submodule update --init --remote
test:
./scripts/prepare_test_repos.sh $(TMP_DIR)
go test -v ./...
ci-test:
./scripts/prepare_test_repos.sh $(TMP_DIR)
./scripts/run_foreach_test_repos.sh $(TMP_DIR) "sed -i '3i \ \ \"sandboxExecServer\": \"172.17.0.1:5051\",' conf.json"
GITHUB_ACTOR="" go test -v ./...