Skip to content

Commit

Permalink
Update circle.yml to use CircleCI 2.0 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmiyake authored Jun 26, 2017
1 parent df873ad commit 4b21f86
Showing 1 changed file with 40 additions and 52 deletions.
92 changes: 40 additions & 52 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,40 @@
machine:
environment:
GODIST: "go1.7.1.linux-amd64.tar.gz"
GOPATH: "$HOME/.go_workspace"
IMPORT_PATH: "github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
GO_PROJECT_SRC_PATH: "$GOPATH/src/$IMPORT_PATH"
services:
- docker
post:
- mkdir -p download
- test -e "download/$GODIST" || wget -O "download/$GODIST" "https://storage.googleapis.com/golang/$GODIST"
- sudo rm -rf /usr/local/go
- sudo tar -C /usr/local -xzf "download/$GODIST"

checkout:
post:
# ensure all tags are fetched and up-to-date
- git tag -l | xargs git tag -d && git fetch -t

dependencies:
override:
- mkdir -p "$GOPATH/src/$IMPORT_PATH"
- rsync -az --delete ./ "$GOPATH/src/$IMPORT_PATH/"
- mkdir -p "$HOME/docker"
- |
cd "$GO_PROJECT_SRC_PATH" && ./docker/docker_cache.sh "$HOME/docker" \
"$GO_PROJECT_SRC_PATH/docker/go-1.6" "go-1.6:latest"
cache_directories:
- ~/download
- ~/docker

test:
pre:
- go version
- docker version
override:
- ? |
case $CIRCLE_NODE_INDEX in
0)
cd "$GO_PROJECT_SRC_PATH" && go test -v ./...
;;
1)
time docker load -i "$HOME/docker/cached_image.tar.gz" && \
docker run -v "$GOPATH":/go go-1.6:latest \
/bin/sh -c 'cd ./src/github.com/nmiyake/pkg; go version; go env; go test -v ./...'
;;
*)
echo "Unexpected node $CIRCLE_NODE_INDEX"
;;
esac
:
parallel: true
version: 2
executorType: docker
containerInfo:
- image: nmiyake/go:go-1.7.6-1.8.3-t39
cmd: ["/bin/bash"]
stages:
build:
parallel: 2
workDir: /go/src/github.com/nmiyake/pkg
environment:
- PROJECT: pkg
- GET_GO_VERSION: |
case $CIRCLE_NODE_INDEX in
0)
echo "1.8"
;;
1)
echo "1.7"
;;
*)
echo "Unexpected node $CIRCLE_NODE_INDEX"
;;
esac
steps:
- type: checkout
- type: shell
name: "Set up /usr/local/go"
command: |
set -eu
rm /usr/local/go
ln -s "/usr/local/go-$(eval "$GET_GO_VERSION")" /usr/local/go
- type: shell
name: "Verify Go version"
command: go version
- type: shell
name: "Install packages"
command: go install ./...
- type: shell
name: "Run tests"
command: go test ./...

0 comments on commit 4b21f86

Please sign in to comment.