forked from redhat-developer/odo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (60 loc) · 1.71 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
73
74
75
PROJECT := github.com/redhat-developer/ocdev
GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
PKGS := $(shell go list ./... | grep -v $(PROJECT)/vendor)
BUILD_FLAGS := -ldflags="-w -X $(PROJECT)/cmd.GITCOMMIT=$(GITCOMMIT)"
default: bin
.PHONY: bin
bin:
go build ${BUILD_FLAGS} -o ocdev main.go
.PHONY: install
install:
go install ${BUILD_FLAGS}
# run all validation tests
.PHONY: validate
validate: gofmt vet lint
.PHONY: gofmt
gofmt:
./scripts/check-gofmt.sh
# golint errors are only recommendations
.PHONY: lint
lint:
golint $(PKGS)
.PHONY: vet
vet:
go vet $(PKGS)
# install tools used for building, tests and validations
.PHONY: goget-tools
goget-tools:
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/golang/lint/golint
go get -u github.com/mitchellh/gox
# Run unit tests and collect coverage
.PHONY: test-coverage
test-coverage:
./scripts/generate-coverage.sh
# compile for multiple platforms
.PHONY: cross
cross:
gox -osarch="darwin/amd64 linux/amd64 linux/arm windows/amd64" -output="dist/bin/{{.OS}}-{{.Arch}}/ocdev" $(BUILD_FLAGS)
.PHONY: generate-cli-docs
generate-cli-docs:
go run scripts/generate-cli-documentation.go
# create gzipped binaries in ./dist/release/
# for uploading to GitHub release page
# run make cross before this!
.PHONY: prepare-release
prepare-release: cross
./scripts/prepare-release.sh
.PHONY: test
test:
go test -race $(PKGS)
# create deb and rpm packages using fpm in ./dist/pkgs/
# run make cross before this!
.PHONY: packages
packages:
./scripts/create-packages.sh
# upload packages greated by 'make packages' to bintray repositories
# run 'make cross' and 'make packages' before this!
.PHONY: upload-packages
upload-packages:
./scripts/upload-packages.sh