File tree Expand file tree Collapse file tree 3 files changed +40
-8
lines changed
Expand file tree Collapse file tree 3 files changed +40
-8
lines changed Original file line number Diff line number Diff line change @@ -33,3 +33,6 @@ vendor/
3333dist /
3434release /
3535build /
36+
37+ vendor
38+ coverage.txt
Original file line number Diff line number Diff line change @@ -7,17 +7,15 @@ addons:
77 - rpm
88go : 1.9
99before_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
1213install :
1314- make install
1415script :
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"
2119deploy :
2220 skip_cleanup : true
2321 provider : script
Original file line number Diff line number Diff line change 11package = github.com/devopsdays/devopsdays-cli
22
3+ SOURCE_FILES? =./...
4+ TEST_PATTERN? =.
5+ TEST_OPTIONS? =
6+
37BINARY =devopsdays-cli
48
59VERSION: =$(shell git describe --tags)
610BUILD: =$(shell date +% FT% T% z)
711
812LDFLAGS =-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+
1025build :
1126 go build ${LDFLAGS} -o release/${BINARY} $(package )
1227
@@ -16,7 +31,23 @@ install:
1631 go get -t -v ./...
1732
1833test :
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
2152deploy :
2253 # go get -v github.com/inconshreveable/mousetrap
You can’t perform that action at this time.
0 commit comments