-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from berndtj/add-makefile
Add makefile for easy releases
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
GIT_VERSION = $(shell git describe --tags --dirty) | ||
VERSION ?= $(GIT_VERSION) | ||
|
||
VERSION_PACKAGE := github.com/dispatchframework/funky/pkg/version | ||
|
||
GO_LDFLAGS := -X $(VERSION_PACKAGE).version=$(VERSION) | ||
GO_LDFLAGS += -X $(VERSION_PACKAGE).buildDate=$(shell date +'%Y-%m-%dT%H:%M:%SZ') | ||
GO_LDFLAGS += -X $(VERSION_PACKAGE).commit=$(shell git rev-parse HEAD) | ||
|
||
|
||
.PHONY: all | ||
all: linux | ||
|
||
.PHONY: test | ||
test: ## run tests | ||
@echo running tests... | ||
$(GO) test -v $(shell go list -v ./... | grep -v /vendor/ | grep -v integration ) | ||
|
||
.PHONY: linux | ||
linux: | ||
GOOS=linux go build -ldflags "$(GO_LDFLAGS)" -o funky main.go | ||
|
||
.PHONY: release | ||
release: linux | ||
tar -czf funky$(VERSION).linux-amd64.tgz funky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/////////////////////////////////////////////////////////////////////// | ||
// Copyright (c) 2018 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
/////////////////////////////////////////////////////////////////////// | ||
|
||
package version | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
|
||
"github.com/vmware/dispatch/pkg/api/v1" | ||
) | ||
|
||
// Filled by -ldflags passed to `go build` | ||
var ( | ||
version string | ||
commit string | ||
buildDate string | ||
) | ||
|
||
// NO TESTS | ||
|
||
// Get returns information about the version/build | ||
func Get() *v1.Version { | ||
return &v1.Version{ | ||
Version: version, | ||
Commit: commit, | ||
BuildDate: buildDate, | ||
GoVersion: runtime.Version(), | ||
Compiler: runtime.Compiler, | ||
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), | ||
} | ||
} |