-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy path.travis.yml
64 lines (58 loc) · 2.51 KB
/
.travis.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
61
62
63
64
sudo: true
go_import_path: github.com/intuit/katlas
dist: xenial
language: go
go:
- 1.11.x
services:
- docker
install:
- cd $TRAVIS_BUILD_DIR/service && make all
- cd $TRAVIS_BUILD_DIR/controller && make all
- cd $TRAVIS_BUILD_DIR/app && yarn install
before_script:
- docker pull dgraph/dgraph
- mkdir -p /tmp/data
- docker run -d -it -p 5080:5080 -p 6080:6080 -p 8080:8080 -p 9080:9080 -p 8000:8000 -v /tmp/data:/dgraph --name diggy dgraph/dgraph dgraph zero
- docker exec -d -it diggy dgraph alpha --lru_mb 2048 --zero localhost:5080
- TRAVIS_COMMIT_SHORTID="${TRAVIS_COMMIT:0:7}"
- echo "${TRAVIS_COMMIT_SHORTID}"
- go get -u github.com/jstemmer/go-junit-report
script:
- cd $TRAVIS_BUILD_DIR/service
- go test -v ./... -coverprofile=coverage.txt -covermode=atomic
- go test -v ./... 2>&1 | go-junit-report > unit-test-result-report.xml
- cat ./unit-test-result-report.xml
- docker build --no-cache -f Dockerfile -t katlas/katlas-service:${TRAVIS_COMMIT_SHORTID} .
- docker images katlas/katlas-service:${TRAVIS_COMMIT_SHORTID}
- cd $TRAVIS_BUILD_DIR/app
- yarn test --coverage
- docker build --no-cache -f Dockerfile -t katlas/katlas-browser:${TRAVIS_COMMIT_SHORTID} .
- docker images katlas/katlas-browser:${TRAVIS_COMMIT_SHORTID}
- cd $TRAVIS_BUILD_DIR/controller
- docker build --no-cache -f Dockerfile -t katlas/katlas-collector:${TRAVIS_COMMIT_SHORTID} .
- docker images katlas/katlas-collector:${TRAVIS_COMMIT_SHORTID}
- cd $TRAVIS_BUILD_DIR/service
- HOST=$(ifconfig docker0 | grep 'inet addr' |cut -d':' -f2 | awk '{print $1}')
- echo $HOST
- docker run -d -it -p 8011:8011 -e SERVER_TYPE=http -e DGRAPH_HOST=$HOST:9080 --name katlas-service katlas/katlas-service:${TRAVIS_COMMIT_SHORTID}
- sleep 5s
- docker ps -a
- cd $TRAVIS_BUILD_DIR/e2etests
- go test -v ./...
- go test -v ./... 2>&1 | go-junit-report > e2e-test-result-report.xml
- cat ./e2e-test-result-report.xml
after_success:
- cd $TRAVIS_BUILD_DIR/service
- bash <(curl -s https://codecov.io/bash)
- cd $TRAVIS_BUILD_DIR/app
- bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
- |
if [ "$TRAVIS_BRANCH" == "master" ]; then
# Login to docker hub
echo "$DOCKER_PASSWORD" |docker login -u $DOCKER_USERNAME --password-stdin
# Push image to docker hub
docker push katlas/katlas-service:${TRAVIS_COMMIT_SHORTID}
docker push katlas/katlas-browser:${TRAVIS_COMMIT_SHORTID}
docker push katlas/katlas-collector:${TRAVIS_COMMIT_SHORTID}
fi