forked from OpenVisualCloud/Immersive-Video-Sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
36 lines (31 loc) · 1.29 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
language: generic
os: linux
dist: bionic
env:
global:
- DOCKER_CACHE_FILE=/home/travis/docker/cache.tar.gz
- DOCKER_REPOSITORY=immersive
- DOCKER_TAG=ci
cache:
directories:
- /home/travis/docker/
before_install:
- | # Load docker image.
if [ -f ${DOCKER_CACHE_FILE} ]; then
gunzip -c ${DOCKER_CACHE_FILE} | sudo docker load || true
fi
install:
- | # Build docker image from cache or from scratch.
if [ -f ${DOCKER_CACHE_FILE} ]; then
sudo docker build --cache-from ${DOCKER_REPOSITORY}:${DOCKER_TAG} -t ${DOCKER_REPOSITORY}:${DOCKER_TAG} -f src/external/dockerfile src/external
else
sudo docker build -t ${DOCKER_REPOSITORY}:${DOCKER_TAG} -f src/external/dockerfile src/external
fi
script:
- sudo docker run -it -v `pwd`:`pwd` -w `pwd` ${DOCKER_REPOSITORY}:${DOCKER_TAG} bash -c 'cd src/external && ./build.sh ci && ./build.sh test && ./run_test.sh'
- | # Save built image to Travis cache directory only if not a pull request.
if [ ${TRAVIS_PULL_REQUEST} == "false" ]; then
mkdir -p $(dirname ${DOCKER_CACHE_FILE})
sudo docker save $(docker history -q ${DOCKER_REPOSITORY}:${DOCKER_TAG} | grep -v '<missing>') ${DOCKER_REPOSITORY}:${DOCKER_TAG} | gzip > ${DOCKER_CACHE_FILE}
echo "Saved cache successfuly"
fi