forked from tchen0123/supergiant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (38 loc) · 1.6 KB
/
Copy pathMakefile
File metadata and controls
52 lines (38 loc) · 1.6 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
export GO111MODULE=on
DOCKER_IMAGE_NAME := supergiant/control
DOCKER_IMAGE_TAG := $(shell git describe --tags --always | tr -d v || echo 'latest')
VERSION := $(shell git describe --always --long --dirty)
.PHONY: build test push release
fmt: gofmt goimports
gofmt:
@FLAGS="-w" build/gofmt.sh
goimports:
@FLAGS="-w -local github.com/supergiant/control" build/goimports.sh
lint:
# TODO: enable the test directory when e2e tests will be updated
build/golangci-lint.sh
get-tools:
go get -u golang.org/x/tools/cmd/goimports
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1
go get github.com/rakyll/statik
build-image:
docker build -t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) .
test:
go test -mod=vendor ./pkg/...
build:
GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -mod=vendor -o dist/controlplane-linux -a -installsuffix cgo -ldflags='-extldflags "-static" -w -s -X main.version=${VERSION}' ./cmd/controlplane
GOOS=darwin CGO_ENABLED=0 GOARCH=amd64 go build -mod=vendor -o dist/controlplane-osx -a -installsuffix cgo -ldflags='-extldflags "-static" -w -s -X main.version=${VERSION}' ./cmd/controlplane
GOOS=windows CGO_ENABLED=0 GOARCH=amd64 go build -mod=vendor -o dist/controlplane-windows -a -installsuffix cgo -ldflags='-extldflags "-static" -w -s -X main.version=${VERSION}' ./cmd/controlplane
push:
docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
release: build push
build-ui:
npm install --prefix ./cmd/ui/assets
npm run build --prefix ./cmd/ui/assets
statik -src=./cmd/ui/assets/dist
gogen:
go generate ./pkg/account
vendor-sync:
go mod tidy
go mod download
go mod vendor