Update TravisCI to goclean script.
- Also update to use the new container-based builds - Add coveralls.io support - Update build badge to use SVG - Add badges for coverage, license, and godoc - For now, set it to change to he v2 directory - This will need to be changed once the v1 code is replaced
This commit is contained in:
parent
cb7c24141a
commit
f4fc117b66
3 changed files with 55 additions and 7 deletions
14
.travis.yml
14
.travis.yml
|
@ -5,14 +5,16 @@ go:
|
|||
sudo: false
|
||||
before_install:
|
||||
- gotools=golang.org/x/tools
|
||||
- if [ "$TRAVIS_GO_VERSION" = "release" ] || [ "$TRAVIS_GO_VERSION" = "go1.3.3" ]; then gotools=code.google.com/p/go.tools; fi
|
||||
- if [ "$TRAVIS_GO_VERSION" = "release" ]; then gotools=code.google.com/p/go.tools; fi
|
||||
install:
|
||||
- go get -d -t -v ./...
|
||||
- go get $gotools/cmd/vet
|
||||
- go get -v github.com/GeertJohan/fgt
|
||||
- go get -v $gotools/cmd/cover
|
||||
- go get -v $gotools/cmd/vet
|
||||
- go get -v github.com/bradfitz/goimports
|
||||
- go get -v github.com/golang/lint/golint
|
||||
- go get -v github.com/mattn/goveralls
|
||||
script:
|
||||
- export PATH=$PATH:$HOME/gopath/bin
|
||||
- go vet
|
||||
- fgt golint -min_confidence=0.9 .
|
||||
- go test -v
|
||||
- ./goclean.sh
|
||||
after_success:
|
||||
- goveralls -coverprofile=profile.cov -service=travis-ci
|
||||
|
|
|
@ -2,7 +2,10 @@ btcjson
|
|||
=======
|
||||
|
||||
[![Build Status](https://travis-ci.org/btcsuite/btcjson.png?branch=master)]
|
||||
(https://travis-ci.org/btcsuite/btcjson)
|
||||
(https://travis-ci.org/btcsuite/btcjson) [![Coverage Status]
|
||||
(https://img.shields.io/coveralls/btcsuite/btcjson.svg)]
|
||||
(https://coveralls.io/r/btcsuite/btcjson?branch=master) [![ISC License]
|
||||
(http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
|
||||
Package btcjson implements concrete types for marshalling to and from the
|
||||
bitcoin JSON-RPC API. A comprehensive suite of tests is provided to ensure
|
||||
|
@ -62,6 +65,9 @@ server, and to handle the replies (putting them in useful Go data structures).
|
|||
|
||||
## Documentation
|
||||
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)]
|
||||
(http://godoc.org/github.com/btcsuite/btcjson)
|
||||
|
||||
Full `go doc` style documentation for the project can be viewed online without
|
||||
installing this package by using the GoDoc site
|
||||
[here](http://godoc.org/github.com/btcsuite/btcjson).
|
||||
|
|
40
goclean.sh
Executable file
40
goclean.sh
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
# The script does automatic checking on a Go package and its sub-packages, including:
|
||||
# 1. gofmt (http://golang.org/cmd/gofmt/)
|
||||
# 2. goimports (https://github.com/bradfitz/goimports)
|
||||
# 3. golint (https://github.com/golang/lint)
|
||||
# 4. go vet (http://golang.org/cmd/vet)
|
||||
# 5. race detector (http://blog.golang.org/race-detector)
|
||||
# 6. test coverage (http://blog.golang.org/cover)
|
||||
|
||||
set -e
|
||||
|
||||
# Automatic checks
|
||||
cd v2/btcjson
|
||||
test -z "$(gofmt -l -w . | tee /dev/stderr)"
|
||||
test -z "$(goimports -l -w . | tee /dev/stderr)"
|
||||
test -z "$(golint . | tee /dev/stderr)"
|
||||
go vet ./...
|
||||
go test -race ./...
|
||||
|
||||
# Run test coverage on each subdirectories and merge the coverage profile.
|
||||
|
||||
echo "mode: count" > profile.cov
|
||||
|
||||
# Standard go tooling behavior is to ignore dirs with leading underscors
|
||||
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
|
||||
do
|
||||
if ls $dir/*.go &> /dev/null; then
|
||||
go test -covermode=count -coverprofile=$dir/profile.tmp $dir
|
||||
if [ -f $dir/profile.tmp ]; then
|
||||
cat $dir/profile.tmp | tail -n +2 >> profile.cov
|
||||
rm $dir/profile.tmp
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
go tool cover -func profile.cov
|
||||
|
||||
# To submit the test coverage result to coveralls.io,
|
||||
# use goveralls (https://github.com/mattn/goveralls)
|
||||
# goveralls -coverprofile=profile.cov -service=travis-ci
|
Loading…
Add table
Reference in a new issue