Integrate travis

This commit is contained in:
Alexander Neumann 2015-05-10 22:43:42 +02:00
parent 5f13e199c6
commit fdac4655c6
3 changed files with 62 additions and 20 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/.gopath /.gopath
/restic
cmd/dirdiff/dirdiff cmd/dirdiff/dirdiff
cmd/gentestdata/gentestdata cmd/gentestdata/gentestdata
cmd/restic/restic cmd/restic/restic

View File

@ -8,6 +8,9 @@ os:
- linux - linux
- osx - osx
env:
- SFTP_PATH="/usr/lib/openssh/sftp-server"
notifications: notifications:
irc: irc:
channels: channels:
@ -15,23 +18,17 @@ notifications:
on_success: change on_success: change
on_failure: change on_failure: change
env: GOX_OS="linux darwin openbsd freebsd"
install: install:
- go get github.com/mattn/goveralls - go get github.com/mattn/goveralls
- go get github.com/mitchellh/gox - go get github.com/mitchellh/gox
- gox -build-toolchain -os "$GOX_OS" - gox -build-toolchain -os "$GOX_OS"
- go get -v -t ./...
script: script:
- go build -ldflags "-s" ./... - make restic
- go build -ldflags "-s" -o restic ./cmd/restic - make gox
- sh -c 'cd cmd/restic && gox -verbose -os "$GOX_OS" && ls -al' - make test
- go test -v ./... - make test-integration
- ./testsuite.sh - make all.cov
- sh -c "cd backend && go test -v -test.sftppath /usr/lib/openssh/sftp-server ./..."
- go list ./... | while read pkg; do go test -covermode=count -coverprofile=$(base64 <<< $pkg).cov $pkg; done
- 'echo "mode: count" > all.cov; tail -q -n +2 *.cov >> all.cov'
- goveralls -coverprofile=all.cov -service=travis-ci -repotoken "$COVERALLS_TOKEN" - goveralls -coverprofile=all.cov -service=travis-ci -repotoken "$COVERALLS_TOKEN"
- gofmt -l *.go */*.go */*/*.go - gofmt -l *.go */*.go */*/*.go
- test -z "$(gofmt -l *.go */*.go */*/*.go)" - test -z "$(gofmt -l *.go */*.go */*/*.go)"

View File

@ -1,15 +1,59 @@
.PHONY: clean all debug test .PHONY: all clean env test bench gox test-integration
all: TMPGOPATH=$(PWD)/.gopath
for dir in ./cmd/* ; do \ VENDORPATH=$(PWD)/Godeps/_workspace
(echo "$$dir"; cd "$$dir"; go build) \ BASE=github.com/restic/restic
done BASEPATH=$(TMPGOPATH)/src/$(BASE)
debug: GOPATH=$(TMPGOPATH):$(VENDORPATH)
(cd cmd/restic; go build -a -tags debug)
test: GOTESTFLAGS ?= -v
./testsuite.sh GOX_OS ?= linux darwin openbsd freebsd
SFTP_PATH ?= /usr/lib/ssh/sftp-server
export GOPATH GOX_OS
all: restic
.gopath:
mkdir -p .gopath/src/github.com/restic
ln -sf ../../../.. .gopath/src/github.com/restic/restic
restic: .gopath
cd $(BASEPATH) && \
go build -a -ldflags "-s" -o restic ./cmd/restic
restic.debug: .gopath
cd $(BASEPATH) && \
go build -a -tags debug -o restic ./cmd/restic
clean: clean:
rm -rf .gopath restic *.cov restic_*
go clean ./... go clean ./...
test: .gopath
cd $(BASEPATH) && \
go test $(GOTESTFLAGS) ./...
bench: .gopath
cd $(BASEPATH) && \
go test GOTESTFLAGS) bench ./...
gox: .gopath
cd $(BASEPATH) && \
gox -verbose -os "$(GOX_OS)" ./cmd/restic
test-integration:
cd $(BASEPATH)/backend && \
go test $(GOTESTFLAGS) -test.sftppath $(SFTP_PATH) ./...
all.cov:
cd $(BASEPATH) && \
go list ./... | \
while read pkg; do \
go test -covermode=count -coverprofile=$$(base64 <<< $$pkg).cov $$pkg; \
done
echo "mode: count" > all.cov; tail -q -n +2 *.cov >> all.cov
env:
@echo export GOPATH=\"$(GOPATH)\"