Skip to content

Commit

Permalink
Merge pull request #13 from goldeneggg/goreleaser
Browse files Browse the repository at this point in the history
 add goreleaser (and fix some tools)
  • Loading branch information
goldeneggg authored Feb 26, 2019
2 parents ecf6c88 + e2a59df commit a59a902
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ coverage.txt
*.test

.envrc
dist/
vendor/
52 changes: 52 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
folder: Formula
homepage: 'https://github.com/goldeneggg/lsec2'
description: 'List view of aws ec2 instances'
test: |
system '#{bin}/lsec2 -v'
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ language: go

go:
- 1.11.x
- master

matrix:
allow_failures:
- go: master

sudo: false

Expand All @@ -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
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PROF_TARGET := ./awsec2

.DEFAULT_GOAL := bin/$(NAME)

.PHONY: version
version:
@echo $(VERSION)

Expand All @@ -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

Expand Down Expand Up @@ -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
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
11 changes: 9 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -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}
2 changes: 1 addition & 1 deletion scripts/ci-test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -eu
set -eux

source scripts/_prepare.sh

Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main

// VERSION info
const VERSION = "0.2.4"
const VERSION = "0.2.5"

0 comments on commit a59a902

Please sign in to comment.