-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (56 loc) · 1.61 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
NAME ?= gluedd-cli
PACKAGE_NAME ?= $(NAME)
PACKAGE_CONFLICT ?= $(PACKAGE_NAME)-beta
REVISION := $(shell git rev-parse --short HEAD || echo unknown)
VERSION := $(shell git describe --tags || echo dev)
VERSION := $(shell echo $(VERSION) | sed -e 's/^v//g')
ITTERATION := $(shell date +%s)
EXTENSIONS ?=
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
all: test build
help:
# make all => deps test lint build
# make deps - install all dependencies
# make test - run project tests
# make lint - check project code style
# make build - build project for all supported OSes
deps:
go env
# Installing dependencies...
go get golang.org/x/lint/golint
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
go get -u github.com/onsi/ginkgo/ginkgo
go get -u github.com/onsi/gomega/...
go get github.com/mitchellh/gox
lint:
golint ./... | grep -v "be unexported"
.PHONY: build
build:
go build
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: test
test:
ginkgo -r ./...
.PHONY: coverage
coverage:
go test ./... -race -coverprofile=coverage.txt -covermode=atomic
.PHONY: docker-build
docker-build:
docker build -t golang-gluedd .
docker run -e GOPATH=/ \
-v $(ROOT_DIR):/src/github.com/mudler/gluedd-cli \
--workdir /src/github.com/mudler/gluedd-cli \
--rm -ti golang-gluedd make build
.PHONY: docker-build-arm
docker-build:
docker build -t golang-gluedd .
docker run -e GOPATH=/ \
-e CGO_ENABLED=1 \
-e CC=arm-linux-gnueabihf-gcc \
-e GOOS=linux -e GOARCH=arm \
-v $(ROOT_DIR):/src/github.com/mudler/gluedd-cli \
--workdir /src/github.com/mudler/gluedd-cli \
--rm -ti golang-gluedd make build