Last active
July 2, 2018 05:27
-
-
Save shinofara/0a2868572f227cdf2faca73ac4b44000 to your computer and use it in GitHub Desktop.
CircleCIで複数のバージョンのGo言語をテストしてみた。
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
machine: | |
environment: | |
GO15VENDOREXPERIMENT: 1 | |
GOROOT: "/home/ubuntu/go" | |
PATH: "/home/ubuntu/go/bin:$PATH" | |
dependencies: | |
cache_directories: | |
- "/home/ubuntu/.go" | |
pre: | |
- > | |
case $CIRCLE_NODE_INDEX in 0) export GOVERSION=1.5.1 ;; 1) export GOVERSION=1.6.1 ;; esac; | |
cd /home/ubuntu; | |
if [[ ! -e /home/ubuntu/.go/$GOERSION/bin/go ]]; then | |
curl https://storage.googleapis.com/golang/go$GOVERSION.linux-amd64.tar.gz | tar -xz; | |
go get -u github.com/jstemmer/go-junit-report; | |
mkdir -p ~/.go; | |
cp -rp ~/go ~/.go/$GOVERSION; | |
else | |
cp -rp ~/.go/$GOVERSION ~/go; | |
fi | |
- go version | |
test: | |
override: | |
- mkdir -p $CIRCLE_TEST_REPORTS/golang: | |
parallel: true | |
- go test -v $(go list ./...|grep -v vendor) | go-junit-report set-exit-code=true > $CIRCLE_TEST_REPORTS/golang/$CIRCLE_NODE_INDEX.xml: | |
parallel: true |
使うタイミングとしては、現在1.5で開発しているけど、そろそろバージョンを上げたいとか
まだ考えていないけどテストは常に行っていたいとかそういうアレかな
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
実行結果
https://circleci.com/gh/shinofara/circle-go/43#artifacts
各 artifacts以下のjunit reportを見ればバージョンが変わっていることを確認できる