-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
890 additions
and
50 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,5 @@ | ||
.* | ||
!.gitignore | ||
!.travis.yml | ||
goxz/ | ||
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
language: go | ||
go: | ||
- tip | ||
script: | ||
- make lint | ||
- make test | ||
after_script: | ||
- make cover |
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,34 @@ | ||
|
||
# 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]] | ||
name = "github.com/mholt/archiver" | ||
version = "2.0.0" | ||
|
||
[[constraint]] | ||
name = "github.com/pkg/errors" | ||
version = "0.8.0" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "golang.org/x/sync" |
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,40 @@ | ||
CURRENT_REVISION = $(shell git rev-parse --short HEAD) | ||
BUILD_LDFLAGS = "-X github.com/Songmu/goxz.revision=$(CURRENT_REVISION)" | ||
ifdef update | ||
u=-u | ||
endif | ||
|
||
deps: | ||
go get ${u} github.com/golang/dep/cmd/dep | ||
dep ensure | ||
|
||
devel-deps: deps | ||
go get ${u} github.com/golang/lint/golint | ||
go get ${u} github.com/mattn/goveralls | ||
go get ${u} github.com/motemen/gobump | ||
go get ${u} github.com/Songmu/goxz | ||
go get ${u} github.com/Songmu/ghch | ||
go get ${u} github.com/tcnksm/ghr | ||
|
||
test: deps | ||
go test | ||
|
||
lint: devel-deps | ||
go vet | ||
golint -set_exit_status | ||
|
||
cover: devel-deps | ||
goveralls | ||
|
||
build: deps | ||
go build -ldflags=$(BUILD_LDFLAGS) ./cmd/goxz | ||
|
||
crossbuild: devel-deps | ||
goxz -pv=v$(shell gobump show -r) -build-ldflags=$(BUILD_LDFLAGS) \ | ||
-d=./dist/v$(shell gobump show -r) | ||
|
||
release: | ||
_tools/releng | ||
_tools/upload_artifacts | ||
|
||
.PHONY: test deps devel-deps lint cover crossbuild release |
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 |
---|---|---|
@@ -1,58 +1,66 @@ | ||
## goxz | ||
|
||
Goのツールをパラレルクロスビルドして必要なファイルを抽出してarchiveに詰めてくれる君 | ||
Just do cross building and archiving go tools conventionally | ||
|
||
- goxcから必要機能を抜き出して軽量にしたもの | ||
- 古いGoのケアも不要 | ||
- デフォルトで良い感じになっているように | ||
- provides `goxc` subset | ||
- only provides cross building and archiving | ||
- no older Go support | ||
- no complicated configuration and behaivors | ||
- convention over configuration | ||
|
||
## usage | ||
|
||
```console | ||
% gozx -d ./dist \ | ||
-build-ldflags=... -os=linux,darwin,windows -arch=amd64 \ | ||
./cmd/{{exename}} [...] | ||
# in your repository | ||
% gozx -v 0.0.1 -os=linux,darwin -arch=amd64 ./cmd/mytool [...] | ||
|
||
% tree dist | ||
dist/ | ||
├── {{Package}}_{{Version}}_{{GOOS}}_{{GOARCH}}.zip | ||
# archives are built into `./goxz` directory | ||
% tree ./goxz | ||
goxz/ | ||
├── yourapp_0.0.1_darwin_amd64.zip | ||
└── ... | ||
``` | ||
|
||
## 同梱物 | ||
- `LICENSE(?:.*)` | ||
- `README(?:.*)` | ||
- `INSTALL(?:.*)` | ||
- `CREDIT(?:.*)` | ||
|
||
## ファイル名の仕様 | ||
{{Package}}_{{Version}}_{{OS}}_{{Arch}}.zip | ||
|
||
- Package(AppName?)はデフォルトでリポジトリ名 | ||
- 複数実行ファイルを同梱するかもしれないので | ||
- {{Version}} は入れるか否か | ||
- 入れるほうが好みだけど | ||
- 入れるのがデフォルトで、入れないオプションつくる? | ||
- バージョン指定ない場合は入れないとか(goxcもそうか) | ||
- linuxのみ(BSD系も?)tar.gzにするのがデフォルトで、zipに統一するオプションを別途作るのが良い? | ||
- goxcはデフォではlinuxのみtar.gz | ||
- テンプレート記法(最初はなくて良さそう) | ||
- goxc: {{.ExeName}}_{{.Version}}_{{.Os}}_{{.Arch}}{{.Ext}} | ||
- 同梱物指定 (FileGatheringRule) | ||
- ゆくゆく | ||
|
||
## その他オプション | ||
- `os` and `arch` | ||
- osはdefault linux/darwin/win のみ(案) | ||
- archはdefault arm64 のみ(案) | ||
- `-bc` | ||
- os/arch と bc それぞれは独立して動くで良い? | ||
- 良さそう | ||
- bc指定がされていて、 os/arch 設定が明にされていない場合は、デフォルトビルドはおこなわない | ||
- `-pv` でバージョン指定 | ||
- `-build-ldflags` 実装は必須 | ||
- `-build-tags` はあっても良いかもなぁ | ||
- `-o` オプションは作ってもよい? | ||
- あっても良いけど複数コマンドビルドとの食い合せが悪い | ||
- `go build` と同じ挙動で良さそうか (同じファイルを上書きする) | ||
## Included resources | ||
|
||
following files are included to archives automatically. | ||
|
||
- `LICENSE*` | ||
- `README*` | ||
- `INSTALL*` | ||
- `CREDIT*` | ||
|
||
Custumizable file gathering rules may be provided in future. | ||
|
||
## Archive naming specification | ||
|
||
`{{Package}}_{{Version}}_{{OS}}_{{Arch}}.{{Ext}}` | ||
or | ||
`{{Package}}_{{OS}}_{{Arch}}.{{Ext}}` | ||
|
||
- `{{Package}}` | ||
- directory name of the project by default | ||
- you can specify it with `-n` option | ||
- `{{Version}}` | ||
- When the version is specified by `-pv` option, that is contained in archive name | ||
- `{{Ext}}` | ||
- `.zip` is by default on "windows" and "darwin", `.tar.gz` is by default on other os. | ||
- use `-z` option to use zip always to compress. | ||
- No file naming notations are available yet | ||
- ref. goxc: `{{.ExeName}}_{{.Version}}_{{.Os}}_{{.Arch}}{{.Ext}}` | ||
|
||
## Options | ||
- `os` | ||
- os: linux,darwin and windows by default | ||
- `arch` | ||
- arc: arm64 only by default | ||
- `-pv` for version specification | ||
- `-build-ldflags` / `-build-tags` | ||
- `-o` output filename | ||
- not compatible with multiple package building | ||
- `-build` (not implemented) | ||
- specify build constarints | ||
- os/arch と build はそれぞれは独立して動くで良い? | ||
- 良さそう(ダメかも) | ||
- もしくは両方指定できない? | ||
- buildが指定がされていて、 os/arch 設定が明にされていない場合は、デフォルトビルドはおこなわない |
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,12 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo current version: $(gobump show -r) | ||
read -p "input next version: " next_version | ||
|
||
gobump set $next_version -w | ||
ghch -w -N v$next_version | ||
|
||
git ci -am "Checking in changes prior to tagging of version v$next_version" | ||
git tag v$next_version | ||
git push && git push --tags |
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,6 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
ver=v$(gobump show -r) | ||
make crossbuild | ||
ghr $ver dist/$ver |
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,9 @@ | ||
version: "{build}" | ||
clone_folder: c:\gopath\src\github.com\Songmu\goxz | ||
environment: | ||
GOPATH: c:\gopath | ||
build: false | ||
test_script: | ||
- go get -d -v -t ./... | ||
- go tool vet -all . | ||
- go test ./... |
Oops, something went wrong.