forked from HazyResearch/deepdive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
92 lines (80 loc) · 3.37 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Travis CI config to run tests using Docker
# See: https://docs.travis-ci.com/user/docker/
# See: https://docker.io/
sudo: required
dist: trusty
language: c # C seems to have the least amount of setup
services:
- docker
notifications:
email:
# XXX Routing notifications through cs.stanford.edu as Travis cannot directly send to googlegroups.com
# See: https://github.com/travis-ci/travis-ci/issues/2513
webhooks:
urls:
# gitter.im/HazyResearch/deepdive
- https://webhooks.gitter.im/e/ee3a2470727e53cdc3c3
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
before_install:
# Check coding style before performing the build and tests
- make checkstyle;
# Have Docker build scripts use and update the correct images (these can override DockerBuild.conf)
- export DOCKER_IMAGE=hazyresearch/deepdive-build;
- export POSTGRES_DOCKER_IMAGE=hazyresearch/postgres;
# Pull Docker images
- docker pull $DOCKER_IMAGE;
- docker pull $POSTGRES_DOCKER_IMAGE;
install:
# Build using Docker
- ./DockerBuild/build-in-container
# TODO tag the $DOCKER_IMAGE with TRAVIS environment
script:
# Run all tests using Docker
- ./DockerBuild/test-in-container-postgres
# Check broken links in documentation
# TODO check only when doc/ has changed
#- make -C doc/ linkcheck
after_script:
- docker login -e "$encrypted_DOCKER_EMAIL" -u "$encrypted_DOCKER_USERNAME" -p "$encrypted_DOCKER_PASSWORD";
# decide what tag to use
- if [[ $TRAVIS_TEST_RESULT = 0 ]];
then verdict=PASS;
else verdict=FAIL;
fi;
# push the test result
- if [[ $TRAVIS_PULL_REQUEST = false ]];
then docker tag $DOCKER_IMAGE:latest-test $DOCKER_IMAGE:$TRAVIS_BRANCH.latest-test;
docker push $DOCKER_IMAGE:$TRAVIS_BRANCH.latest-test;
docker tag $DOCKER_IMAGE:latest-test $DOCKER_IMAGE:$TRAVIS_BRANCH.latest-test-$verdict;
docker push $DOCKER_IMAGE:$TRAVIS_BRANCH.latest-test-$verdict;
else docker tag $DOCKER_IMAGE:latest-test $DOCKER_IMAGE:pr$TRAVIS_PULL_REQUEST-test;
docker push $DOCKER_IMAGE:pr$TRAVIS_PULL_REQUEST-test;
fi;
# update the master image with the successful build
- case $TRAVIS_EVENT_TYPE-$TRAVIS_BRANCH-$verdict in
push-master-PASS)
docker tag $DOCKER_IMAGE:latest-build $DOCKER_IMAGE:latest;
docker push $DOCKER_IMAGE:latest;;
push-*-PASS)
docker tag $DOCKER_IMAGE:latest-build $DOCKER_IMAGE:$TRAVIS_BRANCH.latest;
docker push $DOCKER_IMAGE:$TRAVIS_BRANCH.latest;
esac;
## update GitHub releases for some select branches (master and v*.*.x)
#deploy:
# - provider: script
# script: util/build/decrypt-travis-then-update-github-releases
# skip_cleanup: true
# on:
# repo: HazyResearch/deepdive
# all_branches: true
# # TODO condition: "$TRAVIS_BRANCH = master || $TRAVIS_BRANCH = v*.*.x"
# - provider: script
# script: util/build/decrypt-travis-then-update-github-releases
# skip_cleanup: true
# on:
# repo: HazyResearch/deepdive
# tag: true