From 4bae8737054b1c78ebba4ca7ec2261ae9571ce8b Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Mon, 3 Aug 2015 09:34:39 -0500 Subject: [PATCH] Add travis CI --- .travis.yml | 10 ++++++++++ Makefile | 42 ++++++++++++++++++++++-------------------- README.md | 1 + 3 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..25950375 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: go +sudo: false + +os: + - linux + - osx + +go: + - 1.4.2 + - tip diff --git a/Makefile b/Makefile index 79fd2aae..7fd19661 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .DEFAULT_GOAL=test -UNAME = $(shell uname) +UNAME=$(shell uname) PREFIX=github.com/derekparker/delve -GOVERSION = $(shell go version) +GOVERSION=$(shell go version) # We must compile with -ldflags="-s" to omit # DWARF info on OSX when compiling with the @@ -10,44 +10,49 @@ GOVERSION = $(shell go version) # unable to execute. # See https://github.com/golang/go/issues/11887#issuecomment-126117692. ifneq (,$(findstring 1.5, $(GOVERSION))) -FLAGS=-ldflags="-s" + FLAGS=-ldflags="-s" endif -build: - go build $(FLAGS) github.com/derekparker/delve/cmd/dlv +# If we're on OSX make sure the proper CERT env var is set. ifeq "$(UNAME)" "Darwin" ifeq "$(CERT)" "" - $(error You must provide a CERT env var) + $(error You must provide a CERT environment variable in order to codesign the binary.) endif +endif + +deps: + go get -u github.com/peterh/liner + go get -u github.com/spf13/cobra + go get -u golang.org/x/sys/unix + go get -u github.com/davecheney/profile + +build: deps + go build $(FLAGS) github.com/derekparker/delve/cmd/dlv +ifeq "$(UNAME)" "Darwin" codesign -s $(CERT) ./dlv endif -install: +install: deps go install $(FLAGS) github.com/derekparker/delve/cmd/dlv ifeq "$(UNAME)" "Darwin" -ifeq "$(CERT)" "" - $(error You must provide a CERT env var) -endif codesign -s $(CERT) $(GOPATH)/bin/dlv endif -test: +test: deps ifeq "$(UNAME)" "Darwin" -ifeq "$(CERT)" "" - $(error You must provide a CERT env var) -endif +ifeq "$(TRAVIS)" "true" + sudo -E go test -v ./... +else go test $(PREFIX)/terminal $(PREFIX)/dwarf/frame $(PREFIX)/dwarf/op $(PREFIX)/dwarf/util $(PREFIX)/source $(PREFIX)/dwarf/line go test -c $(FLAGS) $(PREFIX)/proc && codesign -s $(CERT) ./proc.test && ./proc.test $(TESTFLAGS) && rm ./proc.test go test -c $(FLAGS) $(PREFIX)/service/test && codesign -s $(CERT) ./test.test && ./test.test $(TESTFLAGS) && rm ./test.test +endif else go test -v ./... endif test-proc-run: ifeq "$(UNAME)" "Darwin" -ifeq "$(CERT)" "" - $(error You must provide a CERT env var) -endif go test -c $(FLAGS) $(PREFIX)/proc && codesign -s $(CERT) ./proc.test && ./proc.test -test.run $(RUN) && rm ./proc.test else go test $(PREFIX) -run $(RUN) @@ -55,9 +60,6 @@ endif test-integration-run: ifeq "$(UNAME)" "Darwin" -ifeq "$(CERT)" "" - $(error You must provide a CERT env var) -endif go test -c $(FLAGS) $(PREFIX)/service/test && codesign -s $(CERT) ./test.test && ./test.test -test.run $(RUN) && rm ./test.test else go test $(PREFIX)/service/rest -run $(RUN) diff --git a/README.md b/README.md index 3c04f064..380ce74a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/derekparker/delve/master/LICENSE) [![GoDoc](https://godoc.org/github.com/derekparker/delve?status.svg)](https://godoc.org/github.com/derekparker/delve) +[![Build Status](https://travis-ci.org/derekparker/delve.svg?branch=travis-ci)](https://travis-ci.org/derekparker/delve) [![Join the chat at https://gitter.im/derekparker/delve](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/derekparker/delve?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) **This project is currently pre 1.0.**