-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
51 lines (39 loc) · 1.45 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
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
all: ci-lint ci-test install
###############################################################################
# Build / Install
###############################################################################
LD_FLAGS = -X github.com/fissionlabsio/juno/cmd.Version=$(VERSION) \
-X github.com/fissionlabsio/juno/cmd.Commit=$(COMMIT)
BUILD_FLAGS := -ldflags '$(LD_FLAGS)'
build: go.sum
ifeq ($(OS),Windows_NT)
@echo "building juno binary..."
@go build -mod=readonly $(BUILD_FLAGS) -o build/juno.exe .
else
@echo "building juno binary..."
@go build -mod=readonly $(BUILD_FLAGS) -o build/juno .
endif
install: go.sum
@echo "installing juno binary..."
@go install -mod=readonly $(BUILD_FLAGS) .
###############################################################################
# Tests / CI
###############################################################################
coverage:
@echo "viewing test coverage..."
@go tool cover --html=coverage.out
ci-test:
@echo "executing unit tests..."
@go test -mod=readonly -v -coverprofile coverage.out ./...
ci-lint:
@echo "running GolangCI-Lint..."
@GO111MODULE=on golangci-lint run
@echo "formatting..."
@find . -name '*.go' -type f -not -path "*.git*" | xargs gofmt -d -s
@echo "verifying modules..."
@go mod verify
clean:
rm -f tools-stamp ./build/**
.PHONY: install build ci-test ci-lint coverage clean