forked from temporalio/samples-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (41 loc) · 1.43 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
############################# Main targets #############################
# Run all checks, build, and test.
install: clean staticcheck errcheck workflowcheck bins test
########################################################################
##### Variables ######
UNIT_TEST_DIRS := $(sort $(dir $(shell find . -name "*_test.go")))
MAIN_FILES := $(shell find . -name "main.go")
TEST_TIMEOUT := 20s
COLOR := "\e[1;36m%s\e[0m\n"
define NEWLINE
endef
##### Targets ######
bins:
@printf $(COLOR) "Build samples..."
$(foreach MAIN_FILE,$(MAIN_FILES), go build -o bin/$(shell dirname "$(MAIN_FILE)") $(shell dirname "$(MAIN_FILE)")$(NEWLINE))
test:
@printf $(COLOR) "Run unit tests..."
@rm -f test.log
$(foreach UNIT_TEST_DIR,$(UNIT_TEST_DIRS),\
@go test -timeout $(TEST_TIMEOUT) -race $(UNIT_TEST_DIR) | tee -a test.log \
$(NEWLINE))
@! grep -q "^--- FAIL" test.log
staticcheck:
@printf $(COLOR) "Run static check..."
@GO111MODULE=off go get -u honnef.co/go/tools/cmd/staticcheck
@staticcheck ./...
errcheck:
@printf $(COLOR) "Run error check..."
@GO111MODULE=off go get -u github.com/kisielk/errcheck
@errcheck ./...
workflowcheck:
@printf $(COLOR) "Run workflow check..."
@go install go.temporal.io/sdk/contrib/tools/workflowcheck
@workflowcheck -show-pos ./...
update-sdk:
go get -u go.temporal.io/api@master
go get -u go.temporal.io/sdk@master
go mod tidy
clean:
rm -rf bin
ci-build: staticcheck errcheck workflowcheck bins test