Skip to content

Commit 796c671

Browse files
committed
Small updates to travis and makeful for contributors
1 parent 2acfc86 commit 796c671

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ vendor/
3333
dist/
3434
release/
3535
build/
36+
37+
vendor
38+
coverage.txt

.travis.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ addons:
77
- rpm
88
go: 1.9
99
before_install:
10-
- go get github.com/mattn/goveralls
11-
- export DODPATH=$HOME/gopath/src/github.com/devopsdays/devopsdays-cli/testdata
10+
- make setup
11+
- export DODPATH=$HOME/gopath/src/github.com/devopsdays/devopsdays-cli/testdata
12+
- gem install fpm
1213
install:
1314
- make install
1415
script:
1516
- make travis
16-
- make test
17-
before_deploy:
18-
- go get -v github.com/inconshreveable/mousetrap
19-
- gem install fpm
20-
- which fpm
17+
- make ci
18+
- test -n "$TRAVIS_TAG"
2119
deploy:
2220
skip_cleanup: true
2321
provider: script

Makefile

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
package = github.com/devopsdays/devopsdays-cli
22

3+
SOURCE_FILES?=./...
4+
TEST_PATTERN?=.
5+
TEST_OPTIONS?=
6+
37
BINARY=devopsdays-cli
48

59
VERSION:=$(shell git describe --tags)
610
BUILD:=$(shell date +%FT%T%z)
711

812
LDFLAGS=-ldflags "-w -s -X github.com/devopsdays/devopsdays-cli/cmd.Version=${VERSION} -X github.com/devopsdays/devopsdays-cli/cmd.Build=${BUILD}"
913

14+
# Install all the build and lint dependencies
15+
setup:
16+
go get -u github.com/alecthomas/gometalinter
17+
go get -u github.com/golang/dep/cmd/dep
18+
go get -u github.com/pierrre/gotestcover
19+
go get -u golang.org/x/tools/cmd/cover
20+
go get -u github.com/inconshreveable/mousetrap
21+
go get -u github.com/mattn/goveralls
22+
# dep ensure
23+
gometalinter --install
24+
1025
build:
1126
go build ${LDFLAGS} -o release/${BINARY} $(package)
1227

@@ -16,7 +31,23 @@ install:
1631
go get -t -v ./...
1732

1833
test:
19-
go test ./...
34+
gotestcover $(TEST_OPTIONS) -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
35+
36+
# Run all the tests and opens the coverage report
37+
cover: test
38+
go tool cover -html=coverage.txt
39+
40+
# gofmt and goimports all go files
41+
fmt:
42+
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
43+
44+
# Run all the linters
45+
lint:
46+
gometalinter --vendor ./...
47+
48+
# Run all the tests and code checks
49+
# ci: test lint
50+
ci: test # will add lint later
2051

2152
deploy:
2253
# go get -v github.com/inconshreveable/mousetrap

0 commit comments

Comments
 (0)