2017-07-26 08:16:18 +03:00
|
|
|
TARGETS = darwin/amd64 linux/amd64 windows/amd64
|
|
|
|
DIST_DIRS = find * -type d -exec
|
|
|
|
|
2016-10-24 20:32:22 +03:00
|
|
|
.NOTPARALLEL:
|
|
|
|
|
2017-07-26 08:16:18 +03:00
|
|
|
.PHONY: bootstrap build test test_fmt validate-generated fmt lint ci devenv
|
2017-01-10 23:29:27 +03:00
|
|
|
|
2017-07-26 08:16:18 +03:00
|
|
|
# go option
|
|
|
|
GO ?= go
|
|
|
|
PKG := $(shell glide novendor)
|
|
|
|
TAGS :=
|
|
|
|
LDFLAGS :=
|
|
|
|
GOFLAGS :=
|
|
|
|
BINDIR := $(CURDIR)/bin
|
|
|
|
BINARIES := acs-engine
|
|
|
|
VERSION := $(shell git rev-parse HEAD)
|
2017-03-21 08:55:10 +03:00
|
|
|
|
2017-08-10 05:19:04 +03:00
|
|
|
GOFILES=`glide novendor | xargs go list`
|
2017-05-17 23:06:24 +03:00
|
|
|
|
2017-05-10 01:50:19 +03:00
|
|
|
all: build
|
|
|
|
|
2017-07-28 20:55:34 +03:00
|
|
|
.PHONY: generate
|
2017-07-26 08:16:18 +03:00
|
|
|
generate:
|
2017-05-17 23:06:24 +03:00
|
|
|
go generate -v $(GOFILES)
|
2017-07-26 08:16:18 +03:00
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: generate
|
|
|
|
GOBIN=$(BINDIR) $(GO) install $(GOFLAGS) -ldflags '$(LDFLAGS)'
|
|
|
|
cd test/acs-engine-test; go build
|
|
|
|
|
|
|
|
# usage: make clean build-cross dist VERSION=v0.4.0
|
|
|
|
.PHONY: build-cross
|
|
|
|
build-cross: LDFLAGS += -extldflags "-static"
|
|
|
|
build-cross:
|
|
|
|
CGO_ENABLED=0 gox -output="_dist/acs-engine-${VERSION}-{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
|
|
|
|
|
|
|
|
.PHONY: dist
|
|
|
|
dist:
|
|
|
|
( \
|
|
|
|
cd _dist && \
|
|
|
|
$(DIST_DIRS) cp ../LICENSE {} \; && \
|
|
|
|
$(DIST_DIRS) cp ../README.md {} \; && \
|
|
|
|
$(DIST_DIRS) tar -zcf {}.tar.gz {} \; && \
|
|
|
|
$(DIST_DIRS) zip -r {}.zip {} \; \
|
|
|
|
)
|
|
|
|
|
|
|
|
.PHONY: checksum
|
|
|
|
checksum:
|
|
|
|
for f in _dist/*.{gz,zip} ; do \
|
|
|
|
shasum -a 256 "$${f}" | awk '{print $$1}' > "$${f}.sha256" ; \
|
|
|
|
done
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
@rm -rf $(BINDIR) ./_dist
|
2016-10-24 20:32:22 +03:00
|
|
|
|
2017-08-04 20:02:43 +03:00
|
|
|
GIT_BASEDIR = $(shell git rev-parse --show-toplevel 2>/dev/null)
|
|
|
|
ifneq ($(GIT_BASEDIR),)
|
|
|
|
LDFLAGS += -X github.com/Azure/acs-engine/pkg/test.JUnitOutDir=${GIT_BASEDIR}/test/junit
|
|
|
|
endif
|
|
|
|
|
2017-08-07 22:46:40 +03:00
|
|
|
test:
|
2017-08-04 20:02:43 +03:00
|
|
|
ginkgo -r -ldflags='$(LDFLAGS)' .
|
2016-10-24 20:32:22 +03:00
|
|
|
|
2017-05-30 03:26:06 +03:00
|
|
|
.PHONY: test-style
|
|
|
|
test-style:
|
|
|
|
@scripts/validate-go.sh
|
2017-03-09 02:04:50 +03:00
|
|
|
|
2017-08-02 03:38:29 +03:00
|
|
|
.PHONY: test-e2e
|
|
|
|
test-e2e:
|
|
|
|
@test/e2e.sh
|
|
|
|
|
2017-07-26 08:16:18 +03:00
|
|
|
HAS_GLIDE := $(shell command -v glide;)
|
|
|
|
HAS_GOX := $(shell command -v gox;)
|
|
|
|
HAS_GIT := $(shell command -v git;)
|
|
|
|
HAS_GOBINDATA := $(shell command -v go-bindata;)
|
2017-08-02 03:38:29 +03:00
|
|
|
HAS_GOMETALINTER := $(shell command -v gometalinter;)
|
2017-08-04 20:02:43 +03:00
|
|
|
HAS_GINKGO := $(shell command -v ginkgo;)
|
2017-07-26 08:16:18 +03:00
|
|
|
|
|
|
|
.PHONY: bootstrap
|
|
|
|
bootstrap:
|
|
|
|
ifndef HAS_GLIDE
|
|
|
|
go get -u github.com/Masterminds/glide
|
|
|
|
endif
|
|
|
|
ifndef HAS_GOX
|
|
|
|
go get -u github.com/mitchellh/gox
|
|
|
|
endif
|
|
|
|
ifndef HAS_GOBINDATA
|
|
|
|
go get github.com/jteeuwen/go-bindata/...
|
|
|
|
endif
|
|
|
|
ifndef HAS_GIT
|
|
|
|
$(error You must install Git)
|
2017-08-02 03:38:29 +03:00
|
|
|
endif
|
|
|
|
ifndef HAS_GOMETALINTER
|
|
|
|
go get -u github.com/alecthomas/gometalinter
|
|
|
|
gometalinter --install
|
2017-07-26 08:16:18 +03:00
|
|
|
endif
|
|
|
|
glide install
|
2017-08-04 20:02:43 +03:00
|
|
|
ifndef HAS_GINKGO
|
|
|
|
go get -u github.com/onsi/ginkgo/ginkgo
|
|
|
|
endif
|
|
|
|
|
2017-07-26 08:16:18 +03:00
|
|
|
|
2017-07-29 08:08:37 +03:00
|
|
|
ci: bootstrap test-style build test lint
|
2017-07-25 03:24:09 +03:00
|
|
|
./scripts/coverage.sh --coveralls
|
|
|
|
|
|
|
|
.PHONY: coverage
|
|
|
|
coverage:
|
|
|
|
@scripts/coverage.sh
|
2016-10-24 20:32:22 +03:00
|
|
|
|
2016-10-27 01:41:17 +03:00
|
|
|
devenv:
|
2017-05-16 00:10:29 +03:00
|
|
|
./scripts/devenv.sh
|
2017-07-26 08:16:18 +03:00
|
|
|
|
|
|
|
include versioning.mk
|