-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
51 lines (42 loc) · 1.81 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
CHECKER_BIN=$(PWD)/tmp/bin
COMMIT ?= $(shell git describe --dirty --long --always --abbrev=15)
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
VERSION ?= "latest"
$(CHECKER_BIN)/.installed: $(CHECKER_BIN)/.installed ## Install static checkers
@echo "🚚 Downloading binaries.."
@GOBIN=$(CHECKER_BIN) go install mvdan.cc/gofumpt@latest
@GOBIN=$(CHECKER_BIN) go install golang.org/x/vuln/cmd/govulncheck@latest
@GOBIN=$(CHECKER_BIN) go install github.com/securego/gosec/v2/cmd/gosec@latest
@GOBIN=$(CHECKER_BIN) go install github.com/swaggo/swag/cmd/swag@latest
@GOBIN=$(CHECKER_BIN) go install github.com/air-verse/air@latest
@touch $(CHECKER_BIN)/.installed
lint: $(CHECKER_BIN)/.installed ## Lint the source code
@echo "🧹 Cleaning go.mod.."
@go mod tidy
@echo "🧹 Formatting files.."
@go fmt ./...
@$(CHECKER_BIN)/gofumpt -l -w .
@echo "🧹 Vetting go.mod.."
@go vet ./...
@echo "🧹 GoCI Lint.."
@golangci-lint run ./...
vuln: $(CHECKER_BIN)/.installed ## Check for vulnerabilities
@echo "🔍 Checking for vulnerabilities"
@#$(CHECKER_BIN)/govulncheck -test ./...
@$(CHECKER_BIN)/gosec -quiet -exclude=G104 ./...
run: $(CHECKER_BIN)/.installed ## Run Cache
@go run semantic-cache -o ./dist;
build: ## Build
@echo "🔨Building Semantic Cache binary.."
@echo "Build Date: $(BUILD_DATE)"
@go build -o ./dist;
test: ## Run tests
@go test -v -count=1 -race -shuffle=on -coverprofile=coverage.out ./...
test-cov: ## Run tests with coverage
@go tool cover -func=coverage.out
telemetry-up: ## Start observability services needed to receive Glides signals
@docker-compose --profile telemetry up --wait
@echo "Jaeger UI: http://localhost:16686/"
@echo "Grafana UI: http://localhost:3000/"
telemetry-down: ## Shutdown observability services needed to receive Glides signals
@docker-compose --profile telemetry down