-
Notifications
You must be signed in to change notification settings - Fork 6
/
circle.yml
34 lines (34 loc) · 1.48 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
machine:
services:
- docker
environment:
IMPORT_PATH: "github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" # E.g. 'github.com/ibrt/go-compose'.
PRIVATE_GOPATH: "$(echo $GOPATH | sed 's/:.*$//g')" # Needed because CircleCI has two paths in the GOPATH.
PACKAGE_NAME: "$(echo $CIRCLE_PROJECT_REPONAME | sed 's/go-//g')" # E.g. for repo 'go-compose', this is 'compose'.
dependencies:
cache_directories:
- ~/cache
pre:
# Prepare directories.
- mkdir -p ~/cache "$PRIVATE_GOPATH/src/$IMPORT_PATH"
# Install go 1.6 (the default in CircleCI is 1.5).
- sudo rm -rf /usr/local/go
- cd ~/cache && if [ ! -e go1.6.linux-amd64.tar.gz ]; then wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz; fi
- cd ~/cache && sudo tar -C /usr/local -xzf go1.6.linux-amd64.tar.gz
- go version
# Save and restore required Docker images.
- if [[ -e ~/cache/docker-mockserver.tar ]]; then docker load -i ~/cache/docker-mockserver.tar; fi
- docker pull jamesdbloom/mockserver
- docker save jamesdbloom/mockserver > ~/cache/docker-mockserver.tar
- if [[ -e ~/cache/docker-postgres.tar ]]; then docker load -i ~/cache/docker-postgres.tar; fi
- docker pull postgres
- docker save postgres > ~/cache/docker-postgres.tar
override:
# Copy repository to GOPATH.
- rsync -azC --delete ./ "$PRIVATE_GOPATH/src/$IMPORT_PATH/"
test:
override:
- go test -v "$IMPORT_PATH/$PACKAGE_NAME"
post:
- docker logs ms
- docker logs pg