-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (43 loc) · 2 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
BRANCH := $(shell git rev-parse --symbolic-full-name --abbrev-ref HEAD)
SUMMARY := $(shell bash .ci/version)
VERSION := $(shell cat VERSION)
OS := $(shell uname -s | awk '{print tolower($$0)}')
GOARCH = amd64
PACKAGE_NAME = $(shell head -n1 go.mod | awk '{print $$2}')
NAME := $(shell basename $(PACKAGE_NAME))
LDFLAGS = "-X $(PACKAGE_NAME)/pkg/common.SUMMARY=$(SUMMARY) -X $(PACKAGE_NAME)/pkg/common.BRANCH=$(BRANCH) -X $(PACKAGE_NAME)/pkg/common.VERSION=$(VERSION)"
vendor:
go mod vendor
release: generate vendor
@mkdir -p release/
go build -mod=vendor -ldflags $(LDFLAGS) -o release/$(NAME)_linux_$(GOARCH) main.go
release-all: generate vendor
@mkdir -p release/
go build -mod=vendor -ldflags $(LDFLAGS) -o release/$(NAME)_linux_$(GOARCH) main.go
GOARCH=arm64 go build -mod=vendor -ldflags $(LDFLAGS) -o release/$(NAME)_linux_arm64 main.go
GOOS=darwin go build -mod=vendor -ldflags $(LDFLAGS) -o release/$(NAME)_darwin_$(GOARCH) main.go
GOOS=windows go build -mod=vendor -ldflags $(LDFLAGS) -o release/$(NAME)_windows_$(GOARCH).exe main.go
pkg/box/blob.go:
@go generate ./...
build-ui:
$(MAKE) -C ui build
build: build-ui generate vendor
@mkdir -p release/
@go build -ldflags $(LDFLAGS) -o release/$(NAME)-$(OS)-$(GOARCH) main.go
build-static: generate
@mkdir -p release/
@go build -ldflags '-w -extldflags "-static"' -o release/pipeliner-$(OS)-$(GOARCH)-static main.go
generate: pkg/box/blob.go
docker:
@docker build -t ekristen/pipeliner .
check-swagger:
which swagger || (GO111MODULE=off go get -u github.com/go-swagger/go-swagger/cmd/swagger)
swagger: check-swagger
GO111MODULE=on go mod vendor && GO111MODULE=off swagger generate spec -o ./docs/swagger.yaml --scan-models
serve-swagger: check-swagger
docs-build:
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material build
docs-serve:
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
snapshot:
SUMMARY=$(SUMMARY) VERSION=$(VERSION) BRANCH=$(BRANCH) goreleaser release --snapshot --skip-publish --rm-dist