diff --git a/.travis.osx.yml b/.travis.osx.yml index c3f1a2191c..c2d44afaaa 100644 --- a/.travis.osx.yml +++ b/.travis.osx.yml @@ -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: diff --git a/script/doxygen.sh b/script/doxygen.sh new file mode 100755 index 0000000000..250d6c139f --- /dev/null +++ b/script/doxygen.sh @@ -0,0 +1 @@ + doxygen src/Doxyfile diff --git a/script/dropbox_upload.py b/script/dropbox_upload.py new file mode 100755 index 0000000000..8116fa31a9 --- /dev/null +++ b/script/dropbox_upload.py @@ -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) diff --git a/script/lcov.sh b/script/lcov.sh new file mode 100755 index 0000000000..3100d736ae --- /dev/null +++ b/script/lcov.sh @@ -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 ../../ diff --git a/script/update_doxygen.sh b/script/update_doxygen.sh deleted file mode 100755 index c1aeebc8d5..0000000000 --- a/script/update_doxygen.sh +++ /dev/null @@ -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