Last active
January 16, 2017 02:37
-
-
Save colebrumley/a1542e792389c9a56aa0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xe | |
cd $HOME | |
# Remove the build cache and get Glide | |
rm -Rf $GOPATH/src/* | |
go get github.com/Masterminds/glide | |
mkdir -p $HOME/.go_workspace/src/github.com/$CIRCLE_PROJECT_USERNAME/ | |
cd $HOME/.go_workspace/src/github.com/$CIRCLE_PROJECT_USERNAME | |
mv $HOME/$CIRCLE_PROJECT_REPONAME . | |
cd $CIRCLE_PROJECT_REPONAME/ | |
# Switch glide to the appropriate branch | |
if [[ "$CIRCLE_BRANCH" != "master" ]]; then | |
sed -i "s/version: master/version: ${CIRCLE_BRANCH}/g" glide.yaml | |
fi | |
# Get the deps | |
glide up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quick setup script for Go 1.5+ Vendoring and Glide on CircleCI
Things can get confusing with CircleCI and go vendor packages. This script aims to set up your repo to build with vendoring enabled. You will need to add
cd $HOME/.go_workspace/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
before your build steps (so that you're in the working project working dir). Then you should be able togo build
as normal.Lines 14-16 are a workaround I use to make sure that my private dependency repos build with the same branch name as the build repo. Feel free to comment out if you don'e need this. In most cases it'll be ignored anyway.