Skip to content

Commit

Permalink
add Dockerfile, normalize build/test process
Browse files Browse the repository at this point in the history
  • Loading branch information
sqs committed Dec 30, 2014
1 parent 9f2c686 commit 4d36eba
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git/
Makefile
*.md
LICENSE
*.test
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: go
go:
- 1.2
- 1.3
- 1.4
- tip

matrix:
Expand All @@ -13,13 +14,17 @@ before_install:
- mkdir -p $HOME/gopath/src/sourcegraph.com/sourcegraph
- mv $TRAVIS_BUILD_DIR $HOME/gopath/src/sourcegraph.com/sourcegraph/go-vcs
- export TRAVIS_BUILD_DIR=$HOME/gopath/src/sourcegraph.com/sourcegraph/go-vcs

install:
# hg >~ 2.5 is needed, but Travis CI's Ubuntu 12.04 ships with hg ~2.0
# hg >~ 2.5 is needed, but Travis CI's Ubuntu 12.04 ships with hg ~2.0
- sudo add-apt-repository -y ppa:mercurial-ppa/releases
- sudo apt-get update
- sudo apt-get install mercurial
- sudo apt-get update -q
- sudo apt-get install -qq mercurial cmake libssh2-1-dev libssl-dev
- sudo easy_install python-hglib
- sudo apt-get install libssh2-1-dev

- ./build
install:
- cd $TRAVIS_BUILD_DIR
- go get -t -v -d ./...
- cd $HOME/gopath/src/github.com/libgit2/git2go && git submodule update --init && cd $TRAVIS_BUILD_DIR
- make install

script:
- make test
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# A Dockerfile that tries to simulate running in Travis CI, to make
# debugging test failures easier.

FROM ubuntu:12.04

RUN apt-get update -q
RUN apt-get install -qq software-properties-common python-software-properties
RUN add-apt-repository -y ppa:mercurial-ppa/releases
RUN apt-get update -q
RUN apt-get install -qq build-essential curl git mercurial cmake libssh2-1-dev libssl-dev pkg-config libgcrypt11-dev
RUN apt-get install -qq python-setuptools
RUN easy_install python-hglib

# Install Go
RUN curl -Ls https://golang.org/dl/go1.4.linux-amd64.tar.gz | tar -C /usr/local -xz
ENV PATH /usr/local/go/bin:$PATH
ENV GOBIN /usr/local/bin

ENV GOPATH /opt
ADD . /opt/src/sourcegraph.com/sourcegraph/go-vcs
WORKDIR /opt/src/sourcegraph.com/sourcegraph/go-vcs
RUN go get -v -t -d ./...
RUN cd $GOPATH/src/github.com/libgit2/git2go && git submodule update --init
RUN make -C $GOPATH/src/github.com/libgit2/git2go install

CMD ["test", "-ldflags", "-extldflags=-L/opt/src/github.com/libgit2/git2go/vendor/libgit2/build", "./..."]
ENTRYPOINT ["/usr/local/go/bin/go"]
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: install test docker-test

install:
cd `go list -f '{{.Dir}}' github.com/libgit2/git2go` && make install

test:
go test -ldflags "-extldflags=-L"`go list -f '{{.Dir}}' github.com/libgit2/git2go`/vendor/libgit2/build ./...

docker-test:
docker build -t go-vcs . && docker run go-vcs
42 changes: 0 additions & 42 deletions build

This file was deleted.

0 comments on commit 4d36eba

Please sign in to comment.