未验证 提交 7033e8db 编写于 作者: Y Yaron Schneider 提交者: GitHub

added build step to makefile (#42)

上级 38c2eacf
################################################## ################################################################################
# Variables # # Variables #
################################################## ################################################################################
ARCH?=amd64
CGO?=0
TARGET_OS?=linux
##################################################
# Variables #
##################################################
GIT_VERSION = $(shell git describe --always --abbrev=7)
GIT_COMMIT = $(shell git rev-list -1 HEAD) GIT_COMMIT = $(shell git rev-list -1 HEAD)
DATE = $(shell date -u +"%Y.%m.%d.%H.%M.%S") GIT_VERSION = $(shell git describe --always --abbrev=7 --dirty)
TARGETS ?= darwin linux windows
ARCH ?= amd64
CGO ?= 0
BINARIES ?= action assigner controller
ifdef REL_VERSION
ACTIONS_VERSION := $(REL_VERSION)
else
ACTIONS_VERSION := edge
endif
################################################################################
# Go build details #
################################################################################
BASE_PACKAGE_NAME := github.com/actionscore/actions
################################################################################
# Dependencies #
################################################################################
.PHONY: dep
dep:
ifeq ($(shell command -v dep 2> /dev/null),)
go get -u -v github.com/golang/dep/cmd/dep
endif
.PHONY: deps
deps: dep
dep ensure -v
################################################################################
# Build #
################################################################################
.PHONY: build
build:
set -e; \
for b in $(BINARIES); do \
for t in $(TARGETS); do \
CGO_ENABLED=$(CGO) GOOS=$$t GOARCH=$(ARCH) go build \
-ldflags "-X $(BASE_PACKAGE_NAME)/pkg/version.commit=$(GIT_VERSION) -X $(BASE_PACKAGE_NAME)/pkg/version.version=$(ACTIONS_VERSION)" \
-o dist/"$$t"_$(ARCH)/$$b \
cmd/$$b/main.go; \
done; \
done;
################################################## ################################################################################
# Tests # # Tests #
################################################## ################################################################################
.PHONY: test .PHONY: test
test: test:
go test ./pkg/... go test ./pkg/...
...@@ -7,7 +7,7 @@ var ( ...@@ -7,7 +7,7 @@ var (
) )
// Version returns the Actions version. This is either a semantic version // Version returns the Actions version. This is either a semantic version
// number or else, in the case of unreleased code, the string "devel". // number or else, in the case of unreleased code, the string "edge".
func Version() string { func Version() string {
return version return version
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册