Skip to content

Commit

Permalink
Merge pull request #445 from restic/switch-to-gb
Browse files Browse the repository at this point in the history
Switch to gb
  • Loading branch information
fd0 committed Feb 20, 2016
2 parents 273d028 + 4dffd3d commit 134d129
Show file tree
Hide file tree
Showing 497 changed files with 366 additions and 412 deletions.
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/.gopath
/pkg
/bin
/restic
/restic.debug
/dirdiff
cmd/dirdiff/dirdiff
cmd/gentestdata/gentestdata
cmd/restic/restic
/.vagrant
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go:
- 1.3.3
- 1.4.3
- 1.5.3
- 1.6rc2
- 1.6

os:
- linux
Expand All @@ -18,7 +18,7 @@ matrix:
- os: osx
go: 1.4.3
- os: osx
go: 1.6rc2
go: 1.5.3

notifications:
irc:
Expand All @@ -32,7 +32,6 @@ install:
- go version
- export GOBIN="$GOPATH/bin"
- export PATH="$PATH:$GOBIN"
- export GOPATH="$GOPATH:${TRAVIS_BUILD_DIR}/Godeps/_workspace"
- go env

script:
Expand Down
56 changes: 29 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,32 @@ uploading it somewhere or post only the parts that are really relevant.
Development Environment
=======================

For development, it is recommended to check out the restic repository within a
`GOPATH`, an introductory text is
["How to Write Go Code"](https://golang.org/doc/code.html). It is recommended
to have a working directory, we're using `~/work/restic` in the following. This
directory mainly contains the directory `src`, where the source code is stored.
For development you need the build tool [`gb`](https://getgb.io), it can be
installed by running the following command:

First, create the necessary directory structure and clone the restic repository
to the correct location:
$ go get github.com/constabulary/...

$ mkdir --parents ~/work/restic/src/github.com/restic
$ cd ~/work/restic/src/github.com/restic
$ git clone https://github.com/restic/restic
$ cd restic
The repository contains two directories with code: `src/` contains the code
written for restic, whereas `vendor/` contains copies of libraries restic
depends on. The libraries are managed with the `gb vendor` command.

Now we're in the main directory of the restic repository. The last step is to
set the environment variable `$GOPATH` to the correct value:
Just clone the repository, `cd` to it and run `gb build` to build the binary:

$ export GOPATH=~/work/restic:~/work/restic/src/github.com/restic/restic/Godeps/_workspace
$ git clone https://github.com/restic/restic
$ cd restic
$ gb build
[...]
$ bin/restic version
restic compiled manually
compiled at unknown time with go1.6

The following commands can be used to run all the tests:

$ go test ./...
$ gb test
ok github.com/restic/restic 8.174s
[...]

The restic binary can be built from the directory `cmd/restic` this way:

$ cd cmd/restic
$ go build
$ ./restic version
restic compiled manually on go1.4.2

if you want to run your tests on Linux, OpenBSD or FreeBSD, you can use
If you want to run your tests on Linux, OpenBSD or FreeBSD, you can use
[vagrant](https://www.vagrantup.com/) with the proveded `Vagrantfile` to
quickly set up VMs and run the tests, e.g.:

Expand All @@ -107,23 +100,32 @@ get it into the project! The workflow we're using is also described on the
[GitHub Flow](https://guides.github.com/introduction/flow/) website, it boils
down to the following steps:

0. If you want to work on something, please add a comment to the issue on
GitHub. For a new feature, please add an issue before starting to work on
it, so that duplicate work is prevented.

1. First we would kindly ask you to fork our project on GitHub if you haven't
done so already.

2. Clone the repository locally and create a new branch. If you are working on
the code itself, please set up the development environment as described in
the previous section and instead of cloning add your fork on GitHub as a
remote to the clone of the restic repository.
the previous section.

3. Then commit your changes as fine grained as possible, as smaller patches,
that handle one and only one issue are easier to discuss and merge.

4. Push the new branch with your changes to your fork of the repository.

5. Create a pull request by visiting the GitHub website, it will guide you
through the process.

6. You will receive comments on your code and the feature or bug that they
address. Maybe you need to rework some minor things, in this case push new
commits to the branch you created for the pull request, they will be
automatically added to the pull request.
7. Once your code looks good, we'll merge it. Thanks a low for your
contribution!

7. Once your code looks good and passes all the tests, we'll merge it. Thanks
a low for your contribution!

Please provide the patches for each bug or feature in a separate branch and
open up a pull request for each.
Expand Down
30 changes: 15 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@
# build the image:
# docker build -t restic/test .
#
# run tests:
# docker run --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test go run run_integration_tests.go
# run all tests and cross-compile restic:
# docker run --rm -v $PWD:/home/travis/restic restic/test go run run_integration_tests.go -minio minio
#
# run interactively with:
# docker run --interactive --tty --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test /bin/bash
# run interactively:
# docker run --interactive --tty --rm -v $PWD:/home/travis/restic restic/test /bin/bash
#
# run a tests:
# docker run --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test go test -v ./backend
# run a subset of tests:
# docker run --rm -v $PWD:/home/travis/restic restic/test gb test -v ./backend
#
# build the image for an older version of Go:
# docker build --build-arg GOVERSION=1.3.3 -t restic/test:go1.3.3 .

FROM ubuntu:14.04

ARG GOVERSION=1.5.3
ARG GOVERSION=1.6
ARG GOARCH=amd64

# install dependencies
Expand All @@ -34,15 +37,13 @@ WORKDIR $HOME
RUN wget -q -O /tmp/go.tar.gz https://storage.googleapis.com/golang/go${GOVERSION}.linux-${GOARCH}.tar.gz
RUN tar xf /tmp/go.tar.gz && rm -f /tmp/go.tar.gz
ENV GOROOT $HOME/go
ENV PATH $PATH:$GOROOT/bin

ENV GOPATH $HOME/gopath
ENV PATH $PATH:$GOPATH/bin
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin:$HOME/bin

RUN mkdir -p $GOPATH/src/github.com/restic/restic
RUN mkdir -p $HOME/restic

# pre-install tools, this speeds up running the tests itself
RUN go get github.com/tools/godep
RUN go get github.com/constabulary/gb/...
RUN go get golang.org/x/tools/cmd/cover
RUN go get github.com/mattn/goveralls
RUN go get github.com/mitchellh/gox
Expand All @@ -52,7 +53,6 @@ RUN mkdir $HOME/bin \
&& chmod +x $HOME/bin/minio

# set TRAVIS_BUILD_DIR for integration script
ENV TRAVIS_BUILD_DIR $GOPATH/src/github.com/restic/restic
ENV GOPATH $GOPATH:${TRAVIS_BUILD_DIR}/Godeps/_workspace
ENV TRAVIS_BUILD_DIR $HOME/restic

WORKDIR $TRAVIS_BUILD_DIR
WORKDIR $HOME/restic
59 changes: 0 additions & 59 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

2 changes: 0 additions & 2 deletions Godeps/_workspace/.gitignore

This file was deleted.

17 changes: 10 additions & 7 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

GO_VERSION = '1.4.2'
GO_VERSION = '1.6'

def packages_freebsd
return <<-EOF
Expand Down Expand Up @@ -57,24 +57,23 @@ def prepare_user(boxname)
gimme #{GO_VERSION} >> ~/.profile
echo export 'GOPATH=/vagrant/go' >> ~/.profile
echo export 'CDPATH=.:$GOPATH/src/github.com' >> ~/.profile
echo export 'PATH=$GOPATH/bin:/usr/local/bin:$PATH' >> ~/.profile
. ~/.profile
go get golang.org/x/tools/cmd/cover
go get github.com/tools/godep
go get github.com/constabulary/gb/...
echo
echo "Run:"
echo " vagrant rsync #{boxname}"
echo " vagrant ssh #{boxname} -c 'cd project/path; godep go test ./...'"
echo " vagrant ssh #{boxname} -c 'cd /vagrant; gb build && gb test'"
EOF
end

def fix_perms
return <<-EOF
chown -R vagrant /vagrant/go
chown -R vagrant /vagrant
EOF
end

Expand All @@ -84,12 +83,16 @@ end
# you're doing.
Vagrant.configure(2) do |config|
# use rsync to copy content to the folder
config.vm.synced_folder ".", "/vagrant/go/src/github.com/restic/restic", :type => "rsync"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/vagrant", :type => "rsync"

# fix permissions on synced folder
config.vm.provision "fix perms", :type => :shell, :inline => fix_perms

# fix network card
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--nictype1", "virtio"]
end

config.vm.define "linux" do |b|
b.vm.box = "ubuntu/trusty64"
b.vm.provision "packages linux", :type => :shell, :inline => packages_linux
Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
clone_folder: c:\gopath\src\github.com\restic\restic
clone_folder: c:\restic

environment:
GOPATH: c:\gopath;c:\gopath\src\github.com\restic\restic\Godeps\_workspace
GOPATH: c:\gopath

init:
- ps: >-
Expand All @@ -13,8 +13,8 @@ init:
install:
- rmdir c:\go /s /q
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.5.3.windows-amd64.msi
- msiexec /i go1.5.3.windows-amd64.msi /q
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.6.windows-amd64.msi
- msiexec /i go1.6.windows-amd64.msi /q
- go version
- go env
- appveyor DownloadFile http://sourceforge.netcologne.de/project/gnuwin32/tar/1.13-1/tar-1.13-1-bin.zip -FileName tar.zip
Expand Down

0 comments on commit 134d129

Please sign in to comment.