-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (29 loc) · 1.27 KB
/
Makefile
File metadata and controls
37 lines (29 loc) · 1.27 KB
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
BINARY_NAME=lstk
ifeq ($(OS),Windows_NT)
BINARY_NAME=lstk.exe
endif
BUILD_DIR=bin
.PHONY: build clean test test-integration lint mock-generate
$(BUILD_DIR)/$(BINARY_NAME):
go build -o $(BUILD_DIR)/$(BINARY_NAME) .
build: clean $(BUILD_DIR)/$(BINARY_NAME)
clean:
rm -rf $(BUILD_DIR)
test:
@JUNIT=""; [ -n "$$CREATE_JUNIT_REPORT" ] && JUNIT="--junitfile test-results.xml"; \
go run gotest.tools/gotestsum@latest --format testname $$JUNIT -- ./cmd/... ./internal/...
test-integration: $(BUILD_DIR)/$(BINARY_NAME)
@JUNIT=""; [ -n "$$CREATE_JUNIT_REPORT" ] && JUNIT="--junitfile ../../test-integration-results.xml"; \
if [ "$$(uname)" = "Darwin" ]; then \
cd test/integration && LSTK_KEYRING=file go run gotest.tools/gotestsum@latest --format testname $$JUNIT -- -count=1 ./...; \
else \
cd test/integration && go run gotest.tools/gotestsum@latest --format testname $$JUNIT -- -count=1 ./...; \
fi
mock-generate:
go generate ./...
lint:
@EXPECTED=$$(awk '/^golangci-lint/ {print $$2}' .tool-versions); \
INSTALLED=$$(golangci-lint version --short 2>/dev/null | sed 's/^v//'); \
[ "$$INSTALLED" = "$$EXPECTED" ] || { echo "golangci-lint $$EXPECTED required (found: $$INSTALLED)"; exit 1; }
golangci-lint run --tests ./...
(cd test/integration && golangci-lint run --tests ./...)