-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
72 lines (57 loc) · 1.8 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
GOLANG_VERSION=$(shell go env GOVERSION)
# go tool nm ./luet | grep Commit
override LDFLAGS += -X "github.com/MottainaiCI/lxd-compose/cmd.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
override LDFLAGS += -X "github.com/MottainaiCI/lxd-compose/cmd.BuildCommit=$(shell git rev-parse HEAD)"
override LDFLAGS += -X "github.com/MottainaiCI/lxd-compose/cmd.BuildGoVersion=$(GOLANG_VERSION)"
NAME ?= lxd-compose
PACKAGE_NAME ?= $(NAME)
REVISION := $(shell git rev-parse --short HEAD || echo dev)
VERSION := $(shell git describe --tags || echo $(REVISION))
VERSION := $(shell echo $(VERSION) | sed -e 's/^v//g')
BUILD_PLATFORMS ?= -osarch="linux/amd64" -osarch="linux/386" -osarch="linux/arm"
.PHONY: all
all: deps build
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: test
test:
GO111MODULE=off go get github.com/onsi/ginkgo/v2/ginkgo
GO111MODULE=off go get github.com/onsi/gomega/...
ginkgo -r -flake-attempts 3 ./...
.PHONY: coverage
coverage:
go test ./... -coverprofile=coverage.txt -race -covermode=atomic
.PHONY: test-coverage
test-coverage:
scripts/ginkgo.coverage.sh --codecov
.PHONY: clean
clean:
rm -rf release/
.PHONY: deps
deps:
go env
# Installing dependencies...
GO111MODULE=on go install -mod=mod golang.org/x/lint/golint
GO111MODULE=on go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
go get github.com/onsi/gomega/...
ginkgo version
.PHONY: build
build:
CGO_ENABLED=0 go build -ldflags '$(LDFLAGS)'
.PHONY: build-small
build-small:
@$(MAKE) LDFLAGS+="-s -w" build
upx --brute -1 $(NAME)
.PHONY: lint
lint:
golint ./... | grep -v "be unexported"
.PHONY: vendor
vendor:
go mod vendor
.PHONY: goreleaser-snapshot
goreleaser-snapshot:
rm -rf dist/ || true
goreleaser release --skip=validate,publish --snapshot --verbose
run-tasks: build
@cd tests/tasks && ../../lxd-compose a lxd-compose-ubuntu --destroy