27 Star 245 Fork 108

GVPgo-atomci/atomci

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
colynn.liu 提交于 2022-06-06 21:13 . feat: add version print
INSTALL_DIR ?= ./atomci
GO_TAGS ?=
CGO_ENABLED ?= 0
GO_PACKAGES ?= ./...
GO_BUILD = go build -v -tags="${GO_TAGS}"
NAME = atomci
export CGO_ENABLED := ${CGO_ENABLED}
export PROJECT_ROOT := $(CURDIR)
VERSION := v1.5.1
BuildTS = $(shell date -u '+%Y-%m-%d %I:%M:%S')
COMMIT_ID=$(shell git rev-parse --short HEAD)
BRANCH_NAME=$(shell git rev-parse --abbrev-ref HEAD)
project=$(shell go list -m)
LDFLAGS += -X "$(project)/version.BuildTS=$(BuildTS)"
LDFLAGS += -X "$(project)/version.GitHash=$(COMMIT_ID)"
LDFLAGS += -X "$(project)/version.Version=$(VERSION)"
LDFLAGS += -X "$(project)/version.GitBranch=$(BRANCH_NAME)"
## linux-amd64: Compile linux-amd64 package
linux-amd64:
@env GOOS=linux GOARCH=amd64 go build -o deploy/binary/$(NAME)-linux-amd64 cmd/atomci/main.go
## linux-arm64: Compile linux-amd64 package
linux-arm64:
@env GOOS=linux GOARCH=arm64 go build -o deploy/binary/$(NAME)-linux-arm64 cmd/atomci/main.go
.PHONY: build
## build: Compile the packages.
build:
@go build -ldflags '$(LDFLAGS)' -o $(NAME) cmd/atomci/main.go
.PHONY: run
## run: Build and Run in local mode.
run: build
@./$(NAME)
.PHONY: web
web:
cd web; yarn run dev
.PHONY: lint
lint:
go vet -structtag=false -tags="${GO_TAGS}" ${GO_PACKAGES}
# NOTE: cgo is required by go test
.PHONY: test
test:
CGO_ENABLED=1 go test -v -race -cover -failfast -vet=off -tags="${GO_TAGS}" ${GO_PACKAGES}
.PHONY: clean
clean:
rm -f $(NAME)
go clean -cache ${GO_PACKAGES}
.PHONY: help
all: help
# help: show this help message
help: Makefile
@echo
@echo " Choose a command to run in "$(NAME)":"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/goatom/atomci.git
git@gitee.com:goatom/atomci.git
goatom
atomci
atomci
master

搜索帮助