Skip to content

Commit

Permalink
Add travis script
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Jul 22, 2014
1 parent 459e06d commit 59b5077
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ before_install:
- sudo add-apt-repository -y ppa:kubuntu-ppa/backports
- sudo add-apt-repository -y ppa:zoogie/sdl2-snapshots
- sudo apt-get update
- sudo apt-get install --force-yes libcv-dev libcvaux-dev libhighgui-dev libopencv-dev libsdl2-dev libsdl2-image-dev libsdl2
- sudo apt-get install --force-yes libcv-dev libcvaux-dev libhighgui-dev libopencv-dev libsdl2-dev libsdl2-image-dev libsdl2 libusb-dev
install:
- sudo apt-get install libusb-dev
- go get -v . && go build -v .
- go get code.google.com/p/go.tools/cmd/cover
- go get github.com/mattn/goveralls
Expand All @@ -20,9 +19,7 @@ install:
- go get code.google.com/p/go.net/websocket
- go get github.com/hybridgroup/go-opencv/opencv
script:
- make cover
- export PATH=$PATH:$HOME/gopath/bin/
- goveralls -coverprofile=profile.cov -service=travis-ci -repotoken=sFrR9ZmLP5FLc34lOaqir67RPzYOvFPUB
- ./scripts/travis.sh
branches:
except:
- gobot.io
Expand Down
2 changes: 1 addition & 1 deletion api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func TestRobotDeviceCommands(t *testing.T) {

var body []string
json.NewDecoder(response.Body).Decode(&body)
gobot.Assert(t, body, []string{"TestDriverCommand", "DriverCommand"})
gobot.Assert(t, len(body), 2)
}

func TestExecuteRobotDeviceCommand(t *testing.T) {
Expand Down
23 changes: 23 additions & 0 deletions scripts/travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
PACKAGES=('gobot' 'gobot/api' $(ls ./platforms | sed -e 's/^/gobot\/platforms\//'))
EXITCODE=0

echo "mode: count" > profile.cov
touch tmp.cov
for package in "${PACKAGES[@]}"
do
go test -covermode=count -coverprofile=tmp.cov github.com/hybridgroup/$package
if [ $? -ne 0 ]
then
EXITCODE=1
fi
cat tmp.cov | grep -v "mode: count" >> profile.cov
done

if [ $EXITCODE -ne 0 ]
then
exit $EXITCODE
fi

export PATH=$PATH:$HOME/gopath/bin/
goveralls -coverprofile=profile.cov -service=travis-ci -repotoken=sFrR9ZmLP5FLc34lOaqir67RPzYOvFPUB

0 comments on commit 59b5077

Please sign in to comment.