Skip to content

Commit

Permalink
chore: new release system.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Feb 4, 2018
1 parent 894c4ae commit a3e68fb
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 295 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ cover.out
bibikoffi.toml
bibikoffi
myrmica-bibikoffi
unsecure/
unsecured/
dist/
6 changes: 6 additions & 0 deletions .gometalinter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"Vendor": true,
"Sort": [ "path", "line", "column", "linter", "severity"],
"Disable": ["gas", "maligned"],
"Exclude": ["unsecured/.*"]
}
22 changes: 20 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: go

go: master
go:
- 1.9.x
- master

sudo: false

Expand All @@ -9,6 +11,22 @@ notifications:
on_success: never
on_failure: change

before_install: go get -u github.com/golang/dep/cmd/dep
before_install:
# Download and install dep
- curl -sI https://github.com/golang/dep/releases/latest | grep -Fi Location | tr -d '\r' | sed "s/tag/download/g" | awk -F " " '{ print $2 "/dep-linux-amd64"}' | wget --output-document=$GOPATH/bin/dep -i -
- chmod +x $GOPATH/bin/dep
# Install linters and misspell
- go get -u github.com/alecthomas/gometalinter
- gometalinter --install

install: make dependencies

deploy:
- provider: releases
api_key: ${GITHUB_TOKEN}
file: dist/bibikoffi*
skip_cleanup: true
overwrite: true
file_glob: true
on:
tags: true
25 changes: 17 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
.PHONY: all

default: clean test-unit validate build
GOFILES := $(shell go list -f '{{range $$index, $$element := .GoFiles}}{{$$.Dir}}/{{$$element}}{{"\n"}}{{end}}' ./... | grep -v '/vendor/')

default: clean checks test build-crossbinary

test: clean
go test -v -cover ./...

dependencies:
dep ensure
dep ensure -v

clean:
rm -f cover.out

build:
go build

validate:
./_script/make.sh validate-gofmt validate-govet validate-golint validate-misspell
checks: check-fmt
gometalinter --vendor ./...

test-unit:
./_script/make.sh test-unit
check-fmt: SHELL := /bin/bash
check-fmt:
diff -u <(echo -n) <(gofmt -d $(GOFILES))

clean:
rm -f cover.out bibikoffi
build-crossbinary:
./_script/crossbinary
14 changes: 0 additions & 14 deletions Makefile.old

This file was deleted.

28 changes: 0 additions & 28 deletions _script/.validate

This file was deleted.

30 changes: 30 additions & 0 deletions _script/crossbinary
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e

if [ -z "$VERSION" ]; then
VERSION=$(git rev-parse HEAD)
fi

if [ -z "$DATE" ]; then
DATE=$(date -u '+%Y-%m-%d_%I:%M:%S%p')
fi

VERSION_PACKAGE='github.com/containous/bibikoffi/meta'
GO_BUILD_CMD="go build -ldflags"
GO_BUILD_OPT="-s -w -X ${VERSION_PACKAGE}.Version=${VERSION} -X ${VERSION_PACKAGE}.BuildDate=${DATE}"

rm -rf dist/

# Build binaries
OS_PLATFORM_ARG=(linux windows darwin)
OS_ARCH_ARG=(amd64)
for OS in ${OS_PLATFORM_ARG[@]}; do
BIN_EXT=''
if [ "$OS" == "windows" ]; then
BIN_EXT='.exe'
fi
for ARCH in ${OS_ARCH_ARG[@]}; do
echo "Building binary for ${OS}/${ARCH}..."
GOARCH=${ARCH} GOOS=${OS} CGO_ENABLED=0 ${GO_BUILD_CMD} "${GO_BUILD_OPT}" -o "dist/bibikoffi_${OS}-${ARCH}${BIN_EXT}"
done
done
30 changes: 0 additions & 30 deletions _script/make.sh

This file was deleted.

56 changes: 0 additions & 56 deletions _script/test-unit

This file was deleted.

30 changes: 0 additions & 30 deletions _script/validate-gofmt

This file was deleted.

31 changes: 0 additions & 31 deletions _script/validate-golint

This file was deleted.

31 changes: 0 additions & 31 deletions _script/validate-govet

This file was deleted.

33 changes: 0 additions & 33 deletions _script/validate-misspell

This file was deleted.

Loading

0 comments on commit a3e68fb

Please sign in to comment.