Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Pull Go test & xtest dependencies as well as include contained modules #79

Closed
daaku opened this Issue Jul 15, 2012 · 6 comments

Comments

Projects
None yet
2 participants

daaku commented Jul 15, 2012

First, thanks for being awesome and adding Go support! Great to have it as a supported language.

The current configuration works well for simple projects that:

  1. Define only a single top level package.
  2. Don't have dependencies to other local code (that is, depends on other modules in the same github repo). Obviously these also fit into 1.
  3. Don't define test/xtest only dependencies.

Here's a annotated script that fixes these issues:

#!/bin/bash

set -e

if [ -z "$GOPATH" ]; then
  echo Expecting GOPATH to be set.
  exit 1
fi

REPO_DIR=$PWD
GITHUB_REPO=$(basename $PWD)
GITHUB_USER=$(basename $(cd .. && pwd))

# this ensures inter-package dependencies use the same version and don't fetch
# the "current" version. symlinks may have issues with ... hence a copy instead.
mkdir -p $GOPATH/src/github.com/$GITHUB_USER
cp -r $REPO_DIR $GOPATH/src/github.com/$GITHUB_USER/$GITHUB_REPO

# fetch dependencies for all contained packages using the ... syntax
echo Fetching package dependencies
go get -v github.com/$GITHUB_USER/$GITHUB_REPO/...

# explicitly fetch the test/xtest only dependencies
echo Fetching test dependencies
TEST_DEPS=$(go list -f '{{.TestImports}} {{.XTestImports}}' github.com/$GITHUB_USER/$GITHUB_REPO/... | sed -e 's/\[//g' | sed -e 's/\]//g')
if [ "$TEST_DEPS" ]; then
  go get -v $TEST_DEPS
fi

# run tests in all contained package using the ... syntax
go test -v github.com/$GITHUB_USER/$GITHUB_REPO/...

Also available here: https://github.com/daaku/go.travis-test-case/blob/master/install
A sample test run which doesn't work with the current stock config: http://travis-ci.org/#!/daaku/go.travis-test-case/builds/1869799
The same test run with the custom script described above: http://travis-ci.org/#!/daaku/go.travis-test-case/builds/1869860

daaku commented Jul 15, 2012

I should have mentioned that these changes are mostly backward compatible. The only thing that I think could potentially be incompatible is that this script assumes the package is go get compatible since it uses the github.com/$user/$repo syntax in order to utilize the ... feature. IMO this is a good thing since that should be part of the test case for public repos anyways.

Contributor

michaelklishin commented Jul 15, 2012

@daaku I would really appreciate if you could explain what exactly you are changing and why, instead of submitting scripts. I am not sure why you have to change $GOPATH/src/ to $GOPATH/src/github.com. Travis may rely heavily on
github today but hardcoding it in travis-build sounds like a bad idea to me.

Finally, why is this an issue for travis-cookbooks? Sounds like something for travis-build?

@peterbourgon please take a look.

daaku commented Jul 15, 2012

I though I was succinct but clear enough, but I'll try to provide more context when I refile it on the travis-build repo. I just commented on the github.com tie and I'll try to find a work around to that -- but I'm not sure one exists for cases where there multiple packages in the same repo that reference each other using the absolute import syntax as is usually necessary in go.

Contributor

michaelklishin commented Jul 15, 2012

I suggest that this is taken to the [travis-ci] mailing list and mentioned in this go mailing list thread first.

Contributor

michaelklishin commented Jul 15, 2012

@daaku I am sorry but Travis maintainers are not Go experts and there doesn't seem to be strong existing conventions about what CI process for "standard" Go projects should be. We already had to change what Go builder does several times. I am very concerned about changing it more, even after the Go mailing list discussion I've linked to above.

If we cannot come up with reasonable defaults, Go support should be removed from Travis CI until Go community comes up with some meaningful conventions for CI.

michaelklishin added a commit to travis-ci/travis-ci.github.com that referenced this issue Jul 15, 2012

Remove all links to [a cool language] support until travis-ci/travis-…
…cookbooks#79 is resolved

If we cannot have good defaults for it, it should not be considered supported and
mentioned in the docs.

daaku commented Jul 15, 2012

@michaelklishin thanks for the response. I understand if you decide not to support Go at this time, and I'm happy for the work you guys have done. In fact it has been possible to handle this with the tools you guys have already provided, and I was happily using your service for my Go projects with a custom script for the last couple of months:

https://github.com/daaku/go.travis/commits/master/install

I don't know enough about how to move this work into something you guys can use yet, but hopefully we can do that instead of dropping support.

michaelklishin added a commit to travis-ci/travis-ci.github.com that referenced this issue Jul 22, 2012

Revert "Remove all links to [a cool language] support until travis-ci…
…/travis-cookbooks#79 is resolved"

This reverts commit 52f519e.

The [cool language] community needs time to figure out some things. Lets finally ship what we have
and wait and see.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment