Skip to content

Instantly share code, notes, and snippets.

@nilium
Created May 27, 2017 22:56
Show Gist options
  • Save nilium/792103114eef68de3263a0304455f95e to your computer and use it in GitHub Desktop.
Save nilium/792103114eef68de3263a0304455f95e to your computer and use it in GitHub Desktop.
PKG="go.spiff.io/skim"
cd "$WORKSPACE/src/$PKG"
# Run tests unmerged
if ! GOPATH="$WORKSPACE" go test -cover "$PKG/..."; then
exit 1
fi
# Re-run tests after merging the branch into master (unless we're already on master)
if [ "$(git rev-parse origin/master)" != "$GIT_COMMIT" ]; then
echo '# Merging build commits into master for tests' 1>&2
git checkout --detach origin/master
if ! git merge --commit --no-edit -m "Merge for ${BUILD_TAG}" "$GIT_COMMIT"; then
echo "! Cannot merge branch into master" 1>&2
exit 1
fi
GOPATH="$WORKSPACE" go test -cover "$PKG/..."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment