Skip to content

Instantly share code, notes, and snippets.

@shinofara
Last active May 1, 2016 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinofara/ba26178a04405066be1379266aa3899e to your computer and use it in GitHub Desktop.
Save shinofara/ba26178a04405066be1379266aa3899e to your computer and use it in GitHub Desktop.
CircleCIの並列実行をGo言語を使って試してみた
machine:
environment:
GO15VENDOREXPERIMENT: 1
GOROOT: "/home/ubuntu/go"
PATH: "/home/ubuntu/go/bin:$PATH"
dependencies:
cache_directories:
- "/home/ubuntu/go"
pre:
- if [[ ! -e /home/ubuntu/go/bin/go ]]; then cd /home/ubuntu; curl https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz | tar -xz; fi
- go get -u github.com/jstemmer/go-junit-report
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
@shinofara
Copy link
Author

キーワードは

- mkdir -p $CIRCLE_TEST_REPORTS/golang:
    parallel: true

: が大事! :の次の行で、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

あとは、$CIRCLE_NODE_INDEX を使う事で、0スタートのコンテナ番号を取得できる。
この例では 00.xml11.xmlを出力することになる

@shinofara
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment