forked from saeedhdd/nori-base-2019
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
80 lines (75 loc) · 2.46 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
language: cpp
dist: trusty
sudo: false
os: linux
compiler: gcc-7
notifications:
email: false
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- kubuntu-backports
packages:
- g++-7
- libglu1-mesa-dev
- libxxf86vm-dev
- libxrandr-dev
- libxinerama-dev
- libxcursor-dev
- libxi-dev
- libx11-dev
- cmake
cache:
directories:
- build
install:
- echo ${PATH}
- echo ${CXX}
- ${CXX} --version
- ${CXX} -v
- mkdir -p "${TRAVIS_BUILD_DIR}/build"
# Incremental builds script from:
# https://blog.esciencecenter.nl/travis-caching-and-incremental-builds-6518b89ee889
# https://github.com/roofit-dev/root/blob/2cc63b8b3d0a7c3acca4381e1bc5a7ef3e01a94c/.travis.yml
script:
# ----- Build phase
# Two cases:
# 1. There was a previous build, which was restored from the cache.
# Use `touch_order.txt` to update the 'last modified' timestamp
# of each file. Finally, update 'last modified' of files that have
# changed since the last build.
# 2. No previous build available, run `cmake`.
- cd "${TRAVIS_BUILD_DIR}/build"
- |
if [[ -f touch_order.txt ]]; then
while read fn; do
touch $fn || true
done < touch_order.txt
# Now, touch changed git files to trigger their rebuild
read PREVIOUS_GIT_COMMIT < previous_git_commit.txt
changed_files=`git diff --name-only $PREVIOUS_GIT_COMMIT HEAD`
echo "Previously cached Travis build based on git commit ${PREVIOUS_GIT_COMMIT}."
echo "Files changed since then:"
echo $changed_files
cd ..
touch `echo $changed_files` || true
else
cmake ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7 ..
fi
# Either way, run `make` to build newest changes.
- cd "${TRAVIS_BUILD_DIR}/build"
- make -j2
# ----- Test phase
- cd .. && python run_tests.py
before_cache:
# Save the order of timestamps of the files so we can recreate it with touch in
# the next build. N.B.: just tarring the build files doesn't work, since the
# git clone will still be newer.
# The build tools (`make` at least) only care about order, not about
# absolute timestamps.
- cd "${TRAVIS_BUILD_DIR}/build"
- find . -type f -printf "%T+\t%p\n" | sort | cut -f 2 > ./touch_order.txt
# Also store the SHA of the commit that was just built, so that we can figure
# out which files have changed since.
- cd "${TRAVIS_BUILD_DIR}" && git rev-parse HEAD > ./build/previous_git_commit.txt