Update .travis.osx.yml and add scripts to run doxygen and testcov on travis-ci(OSX)

This commit is contained in:
Soonho Kong 2013-08-18 11:22:36 -07:00
parent ae523e33b4
commit dc551c80dc
5 changed files with 111 additions and 67 deletions

View file

@ -1,48 +1,59 @@
language: objective-c
env:
global:
- secure: "W8vou0KRJOOboZXP9q+D/9Wl6LlBeVS2T85MHWPz7EwCMQbJq5xWnGzYLE6FmC0iILcZkXyP63vqoYMFo5MJaEQeALGx2RuIiW7XgrD+7Bn4Vfsp6BLT7K9/AJETGGTQnLs8oZJJCXHGtzbc8EPFIZd/ZPPrve4jhEE5ZNhXnRc="
matrix:
- CMAKE_CXX_COMPILER=g++
CMAKE_BUILD_TYPE=DEBUG
USE_TCMALLOC=TRUE
- CMAKE_CXX_COMPILER=g++
CMAKE_BUILD_TYPE=DEBUG
USE_TCMALLOC=FALSE
- CMAKE_CXX_COMPILER=g++
CMAKE_BUILD_TYPE=RELEASE
USE_TCMALLOC=TRUE
- CMAKE_CXX_COMPILER=g++
CMAKE_BUILD_TYPE=RELEASE
USE_TCMALLOC=FALSE
- CMAKE_CXX_COMPILER=g++ CMAKE_BUILD_TYPE=DEBUG USE_TCMALLOC=FALSE LCOV=TRUE
- CMAKE_CXX_COMPILER=g++ CMAKE_BUILD_TYPE=DEBUG USE_TCMALLOC=FALSE DOXYGEN=TRUE
- CMAKE_CXX_COMPILER=g++ CMAKE_BUILD_TYPE=DEBUG USE_TCMALLOC=TRUE NORMAL=TRUE
- CMAKE_CXX_COMPILER=g++ CMAKE_BUILD_TYPE=DEBUG USE_TCMALLOC=FALSE NORMAL=TRUE
- CMAKE_CXX_COMPILER=g++ CMAKE_BUILD_TYPE=RELEASE USE_TCMALLOC=TRUE NORMAL=TRUE
- CMAKE_CXX_COMPILER=g++ CMAKE_BUILD_TYPE=RELEASE USE_TCMALLOC=FALSE NORMAL=TRUE
before_script:
- mkdir -p build
- cd build
- CPLUS_INCLUDE_PATH=/usr/local/include/c++/4.8.1/:/usr/local/include/c++/4.8.1/x86_64-apple-darwin12.4.0:/usr/local/include/c++/4.8.1/bits/
- export CPLUS_INCLUDE_PATH
- LIBRARY_PATH=/usr/local/lib
- export LIBRARY_PATH
- cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=/usr/local/bin/${CMAKE_CXX_COMPILER} ../src -G Ninja
- mkdir -p build
- cd build
- CPLUS_INCLUDE_PATH=/usr/local/include/c++/4.8.1/:/usr/local/include/c++/4.8.1/x86_64-apple-darwin12.4.0:/usr/local/include/c++/4.8.1/bits/
- export CPLUS_INCLUDE_PATH
- LIBRARY_PATH=/usr/local/lib
- export LIBRARY_PATH
- cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=/usr/local/bin/${CMAKE_CXX_COMPILER} ../src -G Ninja
- cd ..
script:
- ninja && yes "C" | ctest -T test -VV
- if [[ $NORMAL == TRUE ]]; then
cd build;
ninja && yes "C" | ctest -T test -VV;
cd ..;
fi
- if [[ $DOXYGEN == TRUE ]]; then
brew install doxygen;
script/doxygen.sh;
brew install python;
pip install dropbox;
script/dropbox_upload.py doc /Public/doc ${DROPBOX_KEY};
fi
- if [[ $LCOV == TRUE ]]; then
brew install lcov;
script/lcov.sh;
brew install python;
pip install dropbox;
script/dropbox_upload.py build/testcov/lcov /Public/lcov ${DROPBOX_KEY};
fi
install:
- if [[ $CMAKE_CXX_COMPILER == g++ ]]; then
- if [[ $CMAKE_CXX_COMPILER == g++ ]]; then
cd /;
wget http://prdownloads.sourceforge.net/hpc/gcc-mlion.tar.gz?download -O /tmp/gcc-mlion.tar.gz;
sudo tar xvfz /tmp/gcc-mlion.tar.gz;
cd -;
fi
- sudo chown -R `whoami` /usr/local
- brew install cmake ninja
- brew install gmp
- brew link --overwrite gmp
- brew install mpfr
- brew link --overwrite mpfr
- if [[ $USE_TCMALLOC == TRUE ]]; then
brew install google-perftools;
fi
sudo tar xvfz /tmp/gcc-mlion.tar.gz; cd -;
fi
- sudo chown -R `whoami` /usr/local
- brew install cmake ninja
- brew install gmp
- brew link --overwrite gmp
- brew install mpfr
- brew link --overwrite mpfr
- if [[ $USE_TCMALLOC == TRUE ]]; then brew install google-perftools; fi
notifications:
email:

1
script/doxygen.sh Executable file
View file

@ -0,0 +1 @@
doxygen src/Doxyfile

51
script/dropbox_upload.py Executable file
View file

@ -0,0 +1,51 @@
#!/usr/bin/env python
import dropbox
import os
import sys
# Paths
local_path = sys.argv[1]
server_path = sys.argv[2]
# AUTH INFO
access_token = sys.argv[3]
# Connect DROPBOX
client = dropbox.client.DropboxClient(access_token)
print(client.account_info())
count = 0
def copy_file_with_retry(fullpath, targetpath, max_try):
global count
print("==> " + targetpath)
try:
handle = open(fullpath)
response = client.put_file(targetpath, handle)
except:
handle.close()
print("FAILED: " + targetpath)
if count < max_try:
count = count + 1
copy_file_with_retry(fullpath, targetpath, max_try)
else:
raise
count = 0
handle.close()
def upload_dir_to_dropbox(localDir, serverDir):
localDir = os.path.expanduser(localDir)
for dirName, subdirList, fileList in os.walk(localDir):
for fname in fileList:
fullpath = os.path.normpath(dirName + "/" + fname)
targetpath = os.path.normpath(serverDir + "/" + fullpath[len(localDir):])
copy_file_with_retry(fullpath, targetpath, 5)
def remove_dir_from_dropbox(serverDir):
try:
client.file_delete(serverDir)
except dropbox.rest.ErrorResponse:
print (serverDir + " not exists")
print ("Copy: " + local_path + " ==> " + server_path)
remove_dir_from_dropbox(server_path)
upload_dir_to_dropbox(local_path, server_path)

14
script/lcov.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
CXX=g++
GCOV_TOOL=gcov
rm -rf build
mkdir -p build/testcov
cd build/testcov
cmake -DCMAKE_BUILD_TYPE=TESTCOV -DCMAKE_CXX_COMPILER=$CXX -G Ninja ../../src
ninja
ctest
lcov -c -b ../../src -d . -o cov.info --no-external --gcov-tool $GCOV_TOOL
lcov --remove cov.info "tests/*" -o cov.info
genhtml cov.info --output-directory lcov
cd ../../

View file

@ -1,33 +0,0 @@
#!/usr/bin/env bash
#
# update_doxygen.sh:
# 1) Install and run doxygen
# 2) Push the result to gh-pages branch
#
# author: Soonho Kong
#
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo -e "Starting to generate doxygen pages"
sudo apt-get -qq install doxygen graphviz;
doxygen src/Doxyfile;
COMMIT_LOG=`git log --oneline -n 1`;
mv doc $HOME
echo -e "Done.\n"
echo -e "Starting to update gh-pages\n"
#go to home and setup git
cd $HOME
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis"
#using token clone gh-pages branch
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/leodemoura/lean.git gh-pages > /dev/null
#go into diractory and copy data we're interested in to that directory
cd gh-pages
mv -Rf $HOME/doc .
#add, commit and push files
git add -A doc
git commit -m "Push doxygen for the commit -- $COMMIT_LOG -- to gh-pages"
git push -fq origin gh-pages > /dev/null
echo -e "Done.\n"
fi