-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shameless copy of the amazing one found in https://github.com/jessfraz/amicontained Remove goxc (which is not maintained anymore). Binaries are uploaded by Travis CI when building tag.
- Loading branch information
Showing
10 changed files
with
195 additions
and
38 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 |
---|---|---|
|
@@ -43,5 +43,5 @@ _testmain.go | |
*.test | ||
*.prof | ||
|
||
# goxc | ||
.goxc.local.json | ||
# Cross Platform builds | ||
cross/ |
This file was deleted.
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 |
---|---|---|
@@ -1,8 +1,32 @@ | ||
language: go | ||
sudo: false | ||
go: | ||
- tip | ||
- 1.8.x | ||
before_install: | ||
- go get github.com/mattn/goveralls | ||
script: | ||
- $HOME/gopath/bin/goveralls -service=travis-ci | ||
- make all release | ||
before_deploy: | ||
- make prepare-bintray | ||
deploy: | ||
- provider: releases | ||
api_key: | ||
secure: Oom3MCaI+y3UWCe44rewz3mtqJ19CDapW4txDmcmijedrrmY8X8q4QefgUONIlXj40uyhOmsLFUHcxCOPzQ/cxpEHh5rpr1hQZodAIM7bdhh6PxfjF9b2P5ZtFJjI5EkRqxTxmNX1lNYMHI4OAN+TE0ui7A0EPGFVHuJtGZUV5dZc7EBhLxNkBppNYIq2ZYoKitCETDC3+EPZi3+QRSKNHbmIeJtDT3dTHzMdJA18ExbxHc37wjuZhUJlZAWR6HnbDWykl5fUVHA8rPEYSwl8C34ANxfXjSOP+woO4jJOhllHdHW/XpbN4xC2OBGOK6zn/LR8nmCZ/lRit9o8G9ZQ7rJALOL+IDDyblt2STB9vzFosIObYSQPPflzDeT1zeDPeZbHkzZNPF89MS3cJRVW9BXWoHEQdS6AWYHzXLE+VdnFLyzhKtlC0HKoA+/20pbFkIsn4SGJMXULlr7jSmBVgmHuVO/6q5fBp/70EjZShO/gzhvdl2oMzhi42RNMLUJzsPJuzDODVTR+QEwqxsk5SWdBWj4pBphbl3A+7Yygzwub++mdrxe0oVHtvSpj8xYAPSPU7V7AGWHPCKxyXK84Lyil0x3fpzGMe7SLd1MNWaGp5iTtkOD6K7H/RPSfugy0CgjoxGxj3SNkllr/n4imc6spNKXOB5Rh7PAj9D+hXw= | ||
go: 1.8.x | ||
file_glob: true | ||
file: cross/* | ||
skip_cleanup: true | ||
on: | ||
repo: jcgay/parallel-git-repo | ||
tags: true | ||
- provider: bintray | ||
user: jcgay | ||
key: | ||
secure: obUD+i5GcosTbTld+EDF/2dzOnNV1uYDOC8UTnsyZsAmFRJCUfzCK3A4AiUYXlhf7InA/YlnCcIYrPceY74O6GSPoYldV/m77wOmFO91e4LdwnOzSK/GjXIQpY58/uIe1nmqX5A8AbRNI0CPsRXKiwL3huSLOZbKSb6ls8W4Vi9N/MeqZAKPQtIvAxzjhh8Tt729cddEVk0Ym9BomDaSLRxNRAEBCjuRWyiqz2rA2DdKWSCswBCGa3FPC6L8yffY6ylJS0O6IQBsYrTOzuAJNM6byP7HE8b98v28ZMCBrQ8g39IYtF497A59KjVwCmAcUep4CNPkNsx0i+4YZx3WjGjsvbAArgHymdln3+ENDiAaBnOiQz2F3iSm/JVhtUxb2C0hDzNEoUhbOCLr0cdWOXLFjFyGE444CZgd6vOvh/nX8yYqhOeIyycv5ovOb+gd2QqmA85ZwBUzPx9FHgJWOvEueU/NZQN9zFpvYMLtAy/cLiijZR1DXH3Y56q/BrX5rUrbR/NxjUelyO71zRRGU5j7p4KWY8Rvk4eX653AZqFNXIC+JIK2CbN3K6l8I5AS3zG0scwkuP1+pZo0RSY83OliquyDZnkJB1BmqbYGkNCZs95/GrMh2E6ZkwPw8x/8gIyS+es+WebN7JI36r5/eOCKZWJZBCYiUclUmYfSkpw= | ||
go: 1.8.x | ||
file: bintray/descriptor.json | ||
skip_cleanup: true | ||
on: | ||
repo: jcgay/parallel-git-repo | ||
tags: true |
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,122 @@ | ||
# Prepare a GNU sed for macOS users (brew install gnu-sed) | ||
sed = $(shell { command -v gsed || command -v sed; } 2>/dev/null) | ||
|
||
# Set an output prefix, which is the local directory if not specified | ||
PREFIX?=$(shell pwd) | ||
|
||
# Setup name variables for the package/tool | ||
NAME := parallel-git-repo | ||
PKG := github.com/jcgay/$(NAME) | ||
|
||
# Set any default go build tags | ||
BUILDTAGS := | ||
|
||
# Set the build dir, where built cross-compiled binaries will be output | ||
BUILDDIR := ${PREFIX}/cross | ||
|
||
# Populate version variables | ||
# Add to compile time flags | ||
VERSION := $(shell cat version/VERSION) | ||
GITCOMMIT := $(shell git rev-parse --short HEAD) | ||
GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no) | ||
ifneq ($(GITUNTRACKEDCHANGES),) | ||
GITCOMMIT := $(GITCOMMIT)-dirty | ||
endif | ||
CTIMEVAR=-X $(PKG)/version.GITCOMMIT=$(GITCOMMIT) -X $(PKG)/version.VERSION=$(VERSION) | ||
GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)" | ||
GO_LDFLAGS_STATIC=-ldflags "-w $(CTIMEVAR) -extldflags -static" | ||
|
||
# List the GOOS and GOARCH to build | ||
GOOSARCHES = linux/amd64 linux/386 darwin/amd64 windows/amd64 | ||
|
||
TODAY = $(shell date +"%Y-%m-%d") | ||
|
||
all: clean build fmt lint test vet install ## Runs a clean, build, fmt, lint, test, vet and install | ||
|
||
.PHONY: build | ||
build: $(NAME) ## Builds a dynamic executable or package | ||
|
||
$(NAME): *.go version/VERSION | ||
@echo "+ $@" | ||
go build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . | ||
|
||
.PHONY: static | ||
static: ## Builds a static executable | ||
@echo "+ $@" | ||
CGO_ENABLED=0 go build \ | ||
-tags "$(BUILDTAGS) static_build" \ | ||
${GO_LDFLAGS_STATIC} -o $(NAME) . | ||
|
||
.PHONY: fmt | ||
fmt: ## Verifies all files have men `gofmt`ed | ||
@echo "+ $@" | ||
@gofmt -s -l . | grep -v vendor | tee /dev/stderr | ||
|
||
.PHONY: lint | ||
lint: ## Verifies `golint` passes | ||
@echo "+ $@" | ||
@golint ./... | grep -v vendor | tee /dev/stderr | ||
|
||
.PHONY: test | ||
test: ## Runs the go tests | ||
@echo "+ $@" | ||
@go test -v -tags "$(BUILDTAGS)" $(shell go list ./... | grep -v vendor) | ||
|
||
.PHONY: vet | ||
vet: ## Verifies `go vet` passes | ||
@echo "+ $@" | ||
@go vet $(shell go list ./... | grep -v vendor) | tee /dev/stderr | ||
|
||
.PHONY: install | ||
install: ## Installs the executable or package | ||
@echo "+ $@" | ||
@go install . | ||
|
||
define buildpretty | ||
mkdir -p $(BUILDDIR)/$(1)/$(2); | ||
GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
-o $(BUILDDIR)/$(1)/$(2)/$(NAME) \ | ||
-a -tags "$(BUILDTAGS) static_build netgo" \ | ||
-installsuffix netgo ${GO_LDFLAGS_STATIC} .; | ||
md5sum $(BUILDDIR)/$(1)/$(2)/$(NAME) > $(BUILDDIR)/$(1)/$(2)/$(NAME).md5; | ||
sha256sum $(BUILDDIR)/$(1)/$(2)/$(NAME) > $(BUILDDIR)/$(1)/$(2)/$(NAME).sha256; | ||
endef | ||
|
||
.PHONY: cross | ||
cross: *.go version/VERSION ## Builds the cross-compiled binaries, creating a clean directory structure (eg. GOOS/GOARCH/binary) | ||
@echo "+ $@" | ||
$(foreach GOOSARCH,$(GOOSARCHES), $(call buildpretty,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH)))) | ||
|
||
define buildrelease | ||
GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
-o $(BUILDDIR)/$(NAME)-$(1)-$(2) \ | ||
-a -tags "$(BUILDTAGS) static_build netgo" \ | ||
-installsuffix netgo ${GO_LDFLAGS_STATIC} .; | ||
md5sum $(BUILDDIR)/$(NAME)-$(1)-$(2) > $(BUILDDIR)/$(NAME)-$(1)-$(2).md5; | ||
sha256sum $(BUILDDIR)/$(NAME)-$(1)-$(2) > $(BUILDDIR)/$(NAME)-$(1)-$(2).sha256; | ||
endef | ||
|
||
.PHONY: release | ||
release: *.go version/VERSION ## Builds the cross-compiled binaries, naming them in such a way for release (eg. binary-GOOS-GOARCH) | ||
@echo "+ $@" | ||
$(foreach GOOSARCH,$(GOOSARCHES), $(call buildrelease,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH)))) | ||
|
||
.PHONY: tag | ||
tag: ## Create a new git tag to prepare to build a release | ||
git tag -sa $(VERSION) -m "$(VERSION)" | ||
@echo "Run git push origin $(VERSION) to push your new tag to GitHub and trigger a travis build." | ||
|
||
.PHONY: prepare-bintray | ||
prepare-bintray: ## Update bintray/descriptor.json with current version | ||
$(sed) -i s/%VERSION%/$(VERSION)/g bintray/descriptor.json | ||
$(sed) -i s/%DATE%/$(TODAY)/g bintray/descriptor.json | ||
|
||
.PHONY: clean | ||
clean: ## Cleanup any build binaries or packages | ||
@echo "+ $@" | ||
$(RM) $(NAME) | ||
$(RM) -r $(BUILDDIR) | ||
|
||
.PHONY: help | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
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
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,31 @@ | ||
{ | ||
"package": { | ||
"name": "parallel-git-repo", | ||
"repo": "tools", | ||
"subject": "jcgay", | ||
"desc": "Run command on git repositories in parallel", | ||
"website_url": "https://github.com/jcgay/parallel-git-repo", | ||
"issue_tracker_url": "https://github.com/jcgay/parallel-git-repo/issues", | ||
"vcs_url": "https://github.com/jcgay/parallel-git-repo.git", | ||
"github_use_tag_release_notes": true, | ||
"github_release_notes_file": "CHANGELOG.md", | ||
"licenses": ["MIT"], | ||
"labels": ["git", "parallel", "go"], | ||
"public_download_numbers": false, | ||
"public_stats": false | ||
}, | ||
|
||
"version": { | ||
"name": "%VERSION%", | ||
"desc": "%VERSION%", | ||
"released": "%DATE%", | ||
"vcs_tag": "%VERSION%", | ||
"gpgSign": false | ||
}, | ||
|
||
"files": | ||
[ | ||
{"includePattern": "cross/(.*)", "uploadPattern": "$1"} | ||
], | ||
"publish": true | ||
} |
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
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
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 @@ | ||
v1.0.0 |
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,7 @@ | ||
package version | ||
|
||
// VERSION indicates which version of the binary is running. | ||
var VERSION = "unknown-snapshot" | ||
|
||
// GITCOMMIT indicates which git hash the binary was built off of | ||
var GITCOMMIT = "unknown-commit" |