diff --git a/.gitignore b/.gitignore index c86b9d5..b3d0cba 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ coverage.txt *.test .envrc +dist/ +vendor/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..86faae8 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,52 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + # you may remove this if you don't use vgo + - go mod download + +builds: +- env: + - CGO_ENABLED=0 + goos: + - darwin + - linux + - windows + - freebsd + goarch: + - '386' + - amd64 + ignore: + - goos: darwin + goarch: 386 + +archive: + format_overrides: + - goos: windows + format: zip + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ .Tag }}-next" + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +brew: + github: + owner: goldeneggg + name: homebrew-tap + commit_author: + name: Fuminori Sakamoto + email: jpshadowapps@gmail.com + folder: Formula + homepage: 'https://github.com/goldeneggg/lsec2' + description: 'List view of aws ec2 instances' + test: | + system '#{bin}/lsec2 -v' diff --git a/.travis.yml b/.travis.yml index 7276d0e..6ff72d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,11 @@ language: go go: - 1.11.x + - master + +matrix: + allow_failures: + - go: master sudo: false @@ -16,3 +21,11 @@ script: after_success: - bash <(curl -s https://codecov.io/bash) + +deploy: + - provider: script + skip_cleanup: true + script: curl -sL http://git.io/goreleaser | bash + on: + tags: true + condition: $TRAVIS_OS_NAME = linux diff --git a/Makefile b/Makefile index 096e5c2..b32750f 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ PROF_TARGET := ./awsec2 .DEFAULT_GOAL := bin/$(NAME) +.PHONY: version version: @echo $(VERSION) @@ -17,26 +18,46 @@ mod-dl: bin/$(NAME): $(SRCS) @./scripts/build.sh bin/$(NAME) +.PHONY: install install: @go install -v -ldflags='$(LDFLAGS)' +.PHONY: test test: @go test -race -cover -v $(PACKAGES) ci-test: @./scripts/ci-test.sh +.PHONY: prof prof: @[ ! -d $(PROF_DIR) ] && mkdir $(PROF_DIR); go test -bench . -benchmem -blockprofile $(PROF_DIR)/block.out -cover -coverprofile $(PROF_DIR)/cover.out -cpuprofile $(PROF_DIR)/cpu.out -memprofile $(PROF_DIR)/mem.out $(PROF_TARGET) +.PHONY: vet vet: @go vet -n -x $(PACKAGES) +.PHONY: lint lint: @${GOBIN}/golint -set_exit_status $(PACKAGES) +.PHONY: validate validate: vet lint + +.PHONY: vendor +vendor: + @GO111MODULE=on go mod vendor + +vendor-build: + @./scripts/build.sh bin/$(NAME) "-mod vendor" + +lint-travis: + @travis lint .travis.yml + +test-goreleaser: + @goreleaser release --snapshot --skip-publish --rm-dist +.PHONY: release release: @./scripts/release.sh @@ -67,10 +88,13 @@ release-freebsd-386: release-freebsd-amd64: @./scripts/release.sh freebsd amd64 +.PHONY: upload upload: @./scripts/upload.sh +.PHONY: formula formula: @./scripts/upload.sh formula-only +.PHONY: publish publish: release upload diff --git a/README.md b/README.md index 4de50b2..13e346e 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,20 @@ List view of aws ec2 instances ### Using Homebrew for OS X ```sh -$ brew tap goldeneggg/lsec2 -$ brew install lsec2 +$ brew install goldeneggg/tap/lsec2 +``` + +___Note:___ + +If you have already installed an old version's lsec2 using `brew tap goldenegg/lsec2` command and `brew install lsec2` command, please uninstall old version. + +```sh +# uninstall old tap version +$ brew uninstall lsec2 +$ brew untap goldeneggg/lsec2 + +# and install new tap version +$ brew install goldeneggg/tap/lsec2 ``` ### Or `go get` diff --git a/scripts/build.sh b/scripts/build.sh index 8afade2..fa79dd0 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,13 +1,20 @@ #!/bin/bash -set -e +set -ex source scripts/_prepare.sh [ $# -lt 1 ] && { echo 'need to assign output target'; exit 1; } OUTPUT=${1} +shift + +if [ $# -ge 1 ] +then + OTHER_OPTS="$@" + echo "OTHER_OPTS = ${OTHER_OPTS}" +fi LDFLAGS=$(${MYDIR}/_ldflags.sh) echo "LDFLAGS=${LDFLAGS}, GOOS=${GOOS}, GOARCH=${GOARCH}" -go build -a -tags netgo -installsuffix netgo -ldflags="${LDFLAGS}" -o ${OUTPUT} +go build -a -tags netgo -installsuffix netgo -ldflags="${LDFLAGS}" ${OTHER_OPTS} -o ${OUTPUT} diff --git a/scripts/ci-test.sh b/scripts/ci-test.sh index ddb815f..9239ca2 100755 --- a/scripts/ci-test.sh +++ b/scripts/ci-test.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -eu +set -eux source scripts/_prepare.sh diff --git a/version.go b/version.go index a1bef18..b7688fa 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package main // VERSION info -const VERSION = "0.2.4" +const VERSION = "0.2.5"