forked from oliver006/redis_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
60 lines (56 loc) · 2.42 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
machine:
services:
- redis
- docker
post:
- /usr/bin/redis-server --port 6380:
background: true
environment:
SRC_LOCATION: "/home/ubuntu/.go_workspace/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
COVERAGE_PROFILE: "/home/ubuntu/coverage.out"
GO_LDFLAGS: '-extldflags "-static" -X main.VERSION=$CIRCLE_TAG -X main.COMMIT_SHA1=$CIRCLE_SHA1 -X main.BUILD_DATE=$(date +%F-%T)'
MY_GO_VERSION: "1.9.4"
REDIS_TEST_VERSION: "3.2.11"
dependencies:
pre:
- rm -rf /home/ubuntu/.go_workspace
- rm -rf /home/ubuntu/.go_project
- sudo service redis-server stop
- >
cd ~ && if [ ! -d "redis-$REDIS_TEST_VERSION" ]; then
wget http://download.redis.io/releases/redis-$REDIS_TEST_VERSION.tar.gz
tar xzf redis-$REDIS_TEST_VERSION.tar.gz
cd redis-$REDIS_TEST_VERSION && make;
fi
- cd ~/redis-$REDIS_TEST_VERSION && sudo make install
- sudo sed -i 's/bin/local\/bin/g' /etc/init/redis-server.conf
- sudo service redis-server start
#
# the next line will bring up a cluster of redis instances with slaves
# for addtl tests
- docker run -p 7000-7006:7000-7006 --name redis_cluster_test -d grokzen/redis-cluster
cache_directories:
- ~/redis-$REDIS_TEST_VERSION
override:
- mkdir -p "/home/ubuntu/.go_workspace/src/github.com/$CIRCLE_PROJECT_USERNAME"
- ln -s $HOME/$CIRCLE_PROJECT_REPONAME $SRC_LOCATION
test:
pre:
- wget https://storage.googleapis.com/golang/go$MY_GO_VERSION.linux-amd64.tar.gz && sudo rm -rf /usr/local/go/ && sudo tar -C /usr/local -xzf go$MY_GO_VERSION.linux-amd64.tar.gz
- go version
- echo " ! gofmt -d main.go 2>&1 | read " | bash
- echo " ! gofmt -d exporter/*.go 2>&1 | read " | bash
- go vet ./exporter/...
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
override:
- cd $SRC_LOCATION && TEST_REDIS_CLUSTER_MASTER_URI=localhost:7000 TEST_REDIS_CLUSTER_SLAVE_URI=localhost:7005 go test -v -covermode=atomic -cover -race -coverprofile=$COVERAGE_PROFILE ./exporter/...
post:
- if [ -n "$COVERALLS_TOKEN" ]; then /home/ubuntu/.go_workspace/bin/goveralls -coverprofile=$COVERAGE_PROFILE -service=circle-ci -repotoken=$COVERALLS_TOKEN ; fi
deployment:
publish:
tag: /v.*/
commands:
- go get github.com/mitchellh/gox
- go get github.com/tcnksm/ghr
- cd $SRC_LOCATION && ./build.sh