-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (48 loc) · 1.11 KB
/
Makefile
File metadata and controls
59 lines (48 loc) · 1.11 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
GIT_COMMIT := $(shell git rev-parse HEAD)
BUILD_DATE := $(shell date +%Y-%m-%dT%H:%M:%S%z)
BIN_DIR := bin
$(BIN_DIR):
mkdir -p $(BIN_DIR)
# Install dependencies.
.PHONY: deps
deps:
@echo "Installing dependencies..."
go version
go mod tidy
go mod vendor
# Lint the code.
.PHONY: lint
lint:
golangci-lint run
# Format the code.
.PHONY: fmt
fmt:
go fmt ./...
goimports -w .
# Build the application.
.PHONY: build
build: deps
@echo "Building morpherctl..."
@echo "GIT_COMMIT=$(GIT_COMMIT)"
@echo "BUILD_DATE=$(BUILD_DATE)"
go build -ldflags="-s -w -X morpherctl/internal/version.GitCommit=$(GIT_COMMIT) -X morpherctl/internal/version.BuildDate=$(BUILD_DATE)" -o $(BIN_DIR)/morpherctl main.go
@echo "Done"
# Run all tests.
.PHONY: test
test:
go test -v ./...
# Run integration tests.
.PHONY: test-integration
test-integration:
go test -v ./test/integration/...
# Run tests with coverage.
.PHONY: test-coverage
test-coverage:
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Clean up test artifacts.
.PHONY: clean
clean:
@echo "Cleaning up..."
rm -rf $(BIN_DIR)
.DEFAULT_GOAL := build