-
Notifications
You must be signed in to change notification settings - Fork 9
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 #70 from masutaka/golang
Introduce golang
- Loading branch information
Showing
47 changed files
with
1,376 additions
and
1,084 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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
*.gem | ||
/.bundle | ||
/.envrc | ||
/.yardoc | ||
/doc | ||
/vendor/bundle | ||
/github-nippou | ||
/lib/bindata.go | ||
/pkg | ||
/vendor |
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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
language: ruby | ||
rvm: | ||
- 2.4.1 | ||
- 2.3.4 | ||
before_install: gem install -N bundler | ||
before_script: bin/validate-version.sh | ||
language: go | ||
|
||
go: | ||
- 1.9.1 | ||
|
||
os: | ||
- linux | ||
- osx | ||
|
||
install: | ||
- echo "skipping travis default" | ||
|
||
script: | ||
- make test-all |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,42 @@ | ||
|
||
# Gopkg.toml example | ||
# | ||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | ||
# 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" | ||
|
||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/google/go-github" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/skratchdot/open-golang" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/spf13/cobra" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "golang.org/x/oauth2" | ||
|
||
[[constraint]] | ||
branch = "v2" | ||
name = "gopkg.in/yaml.v2" |
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,115 @@ | ||
NAME := github-nippou | ||
SRCS := $(shell find . -type f ! -path ./lib/bindata.go -name '*.go') | ||
CONFIGS := $(wildcard config/*) | ||
VERSION := v$(shell grep 'const Version ' lib/version.go | sed -E 's/.*"(.+)"$$/\1/') | ||
PACKAGES := $(shell go list ./...) | ||
|
||
all: $(NAME) | ||
|
||
# Install dependencies for development | ||
.PHONY: deps | ||
deps: dep go-bindata gox ghr | ||
dep ensure | ||
|
||
.PHONY: dep | ||
dep: | ||
ifeq ($(shell command -v dep 2> /dev/null),) | ||
go get github.com/golang/dep/cmd/dep | ||
endif | ||
|
||
.PHONY: go-bindata | ||
go-bindata: | ||
ifeq ($(shell command -v go-bindata 2> /dev/null),) | ||
go get github.com/jteeuwen/go-bindata/... | ||
endif | ||
|
||
.PHONY: gox | ||
gox: | ||
ifeq ($(shell command -v gox 2> /dev/null),) | ||
go get github.com/mitchellh/gox | ||
endif | ||
|
||
.PHONY: ghr | ||
ghr: | ||
ifeq ($(shell command -v ghr 2> /dev/null),) | ||
go get github.com/tcnksm/ghr | ||
endif | ||
|
||
# Build binary | ||
$(NAME): lib/bindata.go $(SRCS) | ||
go build -o $(NAME) | ||
|
||
lib/bindata.go: $(CONFIGS) | ||
go-bindata -nocompress -pkg lib -o lib/bindata.go config | ||
|
||
# Install binary to $GOPATH/bin | ||
.PHONY: install | ||
install: | ||
go install | ||
|
||
# Clean binary | ||
.PHONY: clean | ||
clean: | ||
rm -f $(NAME) | ||
|
||
# Test for development | ||
.PHONY: test | ||
test: | ||
go test -v $(PACKAGES) | ||
|
||
# Test for CI | ||
.PHONY: test-all | ||
test-all: deps-ci vet lint test | ||
|
||
.PHONY: deps-ci | ||
deps-ci: golint | ||
|
||
.PHONY: golint | ||
golint: | ||
ifeq ($(shell command -v golint 2> /dev/null),) | ||
go get github.com/golang/lint/golint | ||
endif | ||
|
||
.PHONY: vet | ||
vet: | ||
go vet $(PACKAGES) | ||
|
||
.PHONY: lint | ||
lint: | ||
echo $(PACKAGES) | xargs -n1 golint | ||
|
||
# Generate binary archives for GitHub release | ||
.PHONY: dist | ||
dist: cross-build | ||
if [ -d pkg ]; then \ | ||
rm -rf pkg/dist; \ | ||
fi | ||
|
||
mkdir -p pkg/dist/$(VERSION) | ||
|
||
for PLATFORM in $$(find pkg -mindepth 1 -maxdepth 1 -type d); do \ | ||
PLATFORM_NAME=$$(basename $$PLATFORM); \ | ||
ARCHIVE_NAME=$(NAME)_$(VERSION)_$${PLATFORM_NAME}; \ | ||
\ | ||
if [ $$PLATFORM_NAME = "dist" ]; then \ | ||
continue; \ | ||
fi; \ | ||
\ | ||
pushd $$PLATFORM; \ | ||
zip $(CURDIR)/pkg/dist/$(VERSION)/$${ARCHIVE_NAME}.zip *; \ | ||
popd; \ | ||
done | ||
|
||
pushd pkg/dist/$(VERSION); \ | ||
shasum -a 256 * > $(VERSION)_SHASUMS; \ | ||
popd | ||
|
||
.PHONY: cross-build | ||
cross-build: deps lib/bindata.go | ||
rm -rf pkg/* | ||
gox -os="darwin linux windows" -arch="386 amd64" -output "pkg/{{.OS}}_{{.Arch}}/{{.Dir}}" | ||
|
||
# Release binary archives to GitHub | ||
.PHONY: release | ||
release: | ||
ghr $(VERSION) pkg/dist/$(VERSION) |
Oops, something went wrong.