Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wentao-zh committed Sep 14, 2018
1 parent de5a49e commit f16d177
Show file tree
Hide file tree
Showing 94 changed files with 12,004 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: go

go:
- 1.9

branches:
only:
- master
- /^v.*$/

install:
- go get -u github.com/golang/dep/cmd/dep

script:
- make deps
- make test
- make build


before_deploy:
- make release

deploy:
provider: releases
api_key:
secure: 4jDPdpCqfV+sPgnw2/8tGASDtaomfSyjCEtGKB8rFHwjkZ2K/FJSyjIA0OrO0QmG/WidQVf8hyEmBBwk3uKHgMbASxYSP4AquUhzUkdtN9gmEQC0D8S1cZBGoWh0ymAts17TpWG4ledRSABGVrpJJ+8VL8mFj8HUxUEqDfqIh2KFqukjYDxL9NvPpbgcK3zJw9g91YCdVyrBZcFihYjE2+visQVRxmOHkNRhdxQ+LgUHJKNWwxJi1Y2GrCu2xJ/92GoT7VbNZw7xPYvLR6TKDMYKbsv4Lr0UNCFh3Adm68h005/kLKSVFuLnl+8s5KRIB5WvR6r/+u0BtkNsLxIKQIqJz82SDvW6/MF7RNtC7jquSS4kYebefwev7XDbUlzAX8VN3/rWi4z//6uMjRRKNuVvX6Tu6kXd5fGeU25mLGVQpSOLtZkckqXaBN7WrC62EMyTOBkccHLaMCZl+TdFGI9wz6gRZ3k0wzk4InvsUMpVK03LNWvHt4RGQwD+MKO1i7PglAMVb83ZWJ4a3PPGjQT8DHUmi48Il1verm1Uk5c8NtlfA6QSyiJtjmz3tUpkZ+rlM8rA/pWaypPHRs2bd8Z92MY+SR1Bxi3J0cD3r63YeK9uIwd7K6N6I5WZmwMOUCNaDhDT6bn96QXnG3nFQ+sKKfWCrOErhY+mNkDR01E=
file_glob: true
file: dist/*
skip_cleanup: true
on:
tags: true

notifications:
email: false
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Change Log
162 changes: 162 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/ghodss/yaml"
version = "1.0.0"

[[constraint]]
branch = "master"
name = "github.com/mitchellh/go-homedir"

[[constraint]]
name = "github.com/spf13/cobra"
version = "0.0.3"

[[constraint]]
name = "github.com/spf13/viper"
version = "1.1.0"

[prune]
go-tests = true
unused-packages = true
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
VERSION := $(shell grep "version = " cmd/version.go | awk '{print $$4}' | sed 's/"//g')

PLATFORMS := linux/amd64 darwin/amd64 windows/amd64
temp = $(subst /, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))

COMMONENVVAR = GOOS=$(shell uname -s | tr A-Z a-z) GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m)))
BUILDENVVAR = CGO_ENABLED=0

all: build

deps:
git config --global url."[email protected]:".insteadOf "https://github.com/"
dep ensure

test:
$(COMMONENVVAR) $(BUILDENVVAR) go test ./... -v

build:
$(COMMONENVVAR) $(BUILDENVVAR) go vet ./...
$(COMMONENVVAR) $(BUILDENVVAR) go build -o nr *.go

tag: # used in client side to trigger a travis deployment job
ifndef VERSION
$(error VERSION is undefined - run using make tag VERSION=vX.Y.Z)
endif
git tag $(VERSION)

# Check to make sure the tag isn't "-dirty".
if git describe --tags --dirty | grep dirty; \
then echo current git working tree is "dirty". Make sure you do not have any uncommitted changes ;false; fi

git push --tags

$(PLATFORMS):
GOOS=$(os) GOARCH=$(arch) $(BUILDENVVAR) go build -o dist/nr-$(os)-$(arch) *.go

release: $(PLATFORMS)

.PHONY: all deps test build tag release $(PLATFORMS)
Loading

0 comments on commit f16d177

Please sign in to comment.