aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/travis_build
blob: c249bb3672daceb46109b107c73309238dc5e71d (plain)
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
#!/usr/bin/env bash

set -eu

# check compiler versions
$CC --version
$CXX --version

if [[ -z $TRAVIS_BUILD_DIR ]]; then
  # go to correct directory
  cd $TRAVIS_BUILD_DIR
fi  

# start building
mkdir -p build
cd build
cmake -DYAGE_BUILD_TESTS=ON -DYAGE_BUILD_DOCS=ON -DYAGE_BUILD_EXAMPLES=ON ..
make
cd tests
ctest -j 2 --schedule-random --repeat-until-fail 3
cd ../..

# update docs if we are on the master branch
if [[ -z $TRAVIS_BUILD_DIR ]]; then
  echo "TRAVIS_BRANCH = " $TRAVIS_BRANCH
  echo "BUILD_DOCS    = " $BUILD_DOCS
fi
echo "CC            = " $CC
echo "CXX           = " $CXX

if [[ -z $TRAVIS_BUILD_DIR ]]; then
  if [[ $TRAVIS_BRANCH = "master" && $BUILD_DOCS -eq 1 ]]; then
    if [[ -d "build/doc_doxygen/html" ]]; then
      git clone -b gh-pages "https://$GH_TOKEN@github.com/ymherklotz/YAGE.git" YAGE_gh-pages
      cd YAGE_gh-pages
      git config user.name "TravisBot"
      git config user.email ""
      rm -rf *
      cp -r ../build/doc_doxygen/html/* .
      git add -A .
      git commit -m "[Travis] Rebuilding documentation"
      git push -q origin gh-pages
    fi
  fi
fi