Skip to content

Commit

Permalink
Travis-CI: Add folding macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Apr 11, 2019
1 parent 5bf83bb commit d9d16af
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 5 deletions.
30 changes: 30 additions & 0 deletions .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,56 @@ function installdotnetsdk(){
################
if [ "${BUILDER}" == make ]; then
if [ "${TRAVIS_OS_NAME}" == linux ]; then
echo 'travis_fold:start:c++'
sudo apt-get -qq update
sudo apt-get -yqq install autoconf libtool zlib1g-dev gawk curl lsb-release
echo 'travis_fold:end:c++'
if [ "${LANGUAGE}" != cc ]; then
echo 'travis_fold:start:swig'
installswig
echo 'travis_fold:end:swig'
fi
if [ "${LANGUAGE}" == python2 ]; then
echo 'travis_fold:start:python2'
python2.7 -m pip install -q virtualenv wheel six;
echo 'travis_fold:end:python2'
elif [ "${LANGUAGE}" == python3 ]; then
echo 'travis_fold:start:python3'
pyenv global system 3.7
python3.7 -m pip install -q virtualenv wheel six
echo 'travis_fold:end:python3'
elif [ "${LANGUAGE}" == dotnet ]; then
echo 'travis_fold:start:dotnet'
installdotnetsdk
echo 'travis_fold:end:dotnet'
fi
elif [ "${TRAVIS_OS_NAME}" == osx ]; then
echo 'travis_fold:start:c++'
brew update
# see https://github.com/travis-ci/travis-ci/issues/10275
brew install gcc || brew link --overwrite gcc
brew install make ccache
echo 'travis_fold:end:c++'
if [ "${LANGUAGE}" != cc ]; then
echo 'travis_fold:start:swig'
brew install swig
echo 'travis_fold:end:swig'
fi
if [ "${LANGUAGE}" == python2 ]; then
echo 'travis_fold:start:python2'
brew outdated | grep -q python@2 && brew upgrade python@2
python2 -m pip install -q virtualenv wheel six
echo 'travis_fold:end:python2'
elif [ "${LANGUAGE}" == python3 ]; then
echo 'travis_fold:start:python3'
brew upgrade python
python3 -m pip install -q virtualenv wheel six
echo 'travis_fold:end:python3'
elif [ "${LANGUAGE}" == dotnet ]; then
echo 'travis_fold:start:dotnet'
brew tap caskroom/cask
brew cask install dotnet-sdk
echo 'travis_fold:end:dotnet'
fi
fi
fi
Expand All @@ -69,15 +89,25 @@ fi
#############
if [ "${BUILDER}" == cmake ]; then
if [ "${TRAVIS_OS_NAME}" == linux ]; then
echo 'travis_fold:start:swig'
installswig
echo 'travis_fold:end:swig'
echo 'travis_fold:start:python3'
pyenv global system 3.7
python3.7 -m pip install -q virtualenv wheel six
echo 'travis_fold:end:python3'
elif [ "${TRAVIS_OS_NAME}" == osx ]; then
echo 'travis_fold:start:c++'
brew update
# see https://github.com/travis-ci/travis-ci/issues/10275
brew install gcc || brew link --overwrite gcc
brew install make ccache
echo 'travis_fold:end:c++'
echo 'travis_fold:start:swig'
brew install swig
echo 'travis_fold:end:swig'
echo 'travis_fold:start:python3'
brew upgrade python
echo 'travis_fold:end:python3'
fi
fi
60 changes: 55 additions & 5 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function checkenv() {
################
if [ "${BUILDER}" == make ];then
if [ "${TRAVIS_OS_NAME}" == linux ];then
echo 'travis_fold:start:env'
if [ "${LANGUAGE}" != cc ]; then
export PATH="${HOME}"/swig/bin:"${PATH}"
fi
Expand All @@ -44,21 +45,39 @@ if [ "${BUILDER}" == make ];then
make detect
fi
cat Makefile.local
echo 'travis_fold:end:env'
echo 'travis_fold:start:third_party'
make third_party --jobs=4
echo 'travis_fold:end:third_party'
if [ "${LANGUAGE}" == python2 ] || [ "${LANGUAGE}" == python3 ]; then
echo 'travis_fold:start:python'
make python --jobs=4
echo 'travis_fold:end:python'
echo 'travis_fold:start:test_python'
make test_python --jobs=4
echo 'travis_fold:end:test_python'
elif [ "${LANGUAGE}" == java ]; then
echo 'travis_fold:start:java'
make java --jobs=4
echo 'travis_fold:end:java'
echo 'travis_fold:start:test_java'
make test_java --jobs=1
echo 'travis_fold:end:test_java'
else
echo "travis_fold:start:${LANGUAGE}"
make "${LANGUAGE}" --jobs=4
echo "travis_fold:end:${LANGUAGE}"
echo "travis_fold:start:test_${LANGUAGE}"
make test_"${LANGUAGE}" --jobs=4
echo "travis_fold:end:test_${LANGUAGE}"
fi
if [ "${LANGUAGE}" == cc ]; then
echo "travis_fold:start:flatzinc"
make test_fz --jobs=2
echo "travis_fold:end:flatzinc"
fi
elif [ "${TRAVIS_OS_NAME}" == osx ];then
echo 'travis_fold:start:env'
export PATH="/usr/local/opt/ccache/libexec:$PATH"
if [ "${LANGUAGE}" == dotnet ]; then
# Installer changes path but won't be picked up in current terminal session
Expand All @@ -76,19 +95,36 @@ if [ "${BUILDER}" == make ];then
make detect
fi
cat Makefile.local
echo 'travis_fold:end:env'
echo 'travis_fold:start:third_party'
make third_party --jobs=4
echo 'travis_fold:end:third_party'
if [ "${LANGUAGE}" == python2 ] || [ "${LANGUAGE}" == python3 ]; then
echo 'travis_fold:start:python'
make python --jobs=4
echo 'travis_fold:end:python'
echo 'travis_fold:start:test_python'
make test_python --jobs=4
echo 'travis_fold:end:test_python'
elif [ "${LANGUAGE}" == java ]; then
echo 'travis_fold:start:java'
make java --jobs=4
echo 'travis_fold:end:java'
echo 'travis_fold:start:test_java'
make test_java --jobs=1
echo 'travis_fold:end:test_java'
else
echo "travis_fold:start:${LANGUAGE}"
make "${LANGUAGE}" --jobs=4
echo "travis_fold:end:${LANGUAGE}"
echo "travis_fold:start:test_${LANGUAGE}"
make test_"${LANGUAGE}" --jobs=4
echo "travis_fold:end:test_${LANGUAGE}"
fi
if [ "${LANGUAGE}" == cc ]; then
echo "travis_fold:start:flatzinc"
make test_fz --jobs=2
echo "travis_fold:end:flatzinc"
fi
fi
fi
Expand All @@ -98,6 +134,7 @@ fi
#############
if [ "${BUILDER}" == cmake ];then
if [ "${TRAVIS_OS_NAME}" == linux ];then
echo 'travis_fold:start:env'
# Add clang support in ccache
if [[ "${CC}" == "clang" ]]; then
sudo ln -s ../../bin/ccache /usr/lib/ccache/clang
Expand All @@ -107,23 +144,36 @@ if [ "${BUILDER}" == cmake ];then
sudo ln -s ../../bin/ccache /usr/lib/ccache/clang++
export CXXFLAGS="-Qunused-arguments $CXXFLAGS"
fi

export PATH="${HOME}"/swig/bin:"${PATH}"
pyenv global system 3.7
checkenv
cmake -H. -Bbuild || true
cmake --build build --target all -- --jobs=4
cmake --build build --target test -- CTEST_OUTPUT_ON_FAILURE=1
echo 'travis_fold:end:env'
elif [ "${TRAVIS_OS_NAME}" == osx ];then
echo 'travis_fold:start:env'
export PATH="/usr/local/opt/ccache/libexec:$PATH"
checkenv
echo 'travis_fold:end:env'
fi

echo 'travis_fold:start:configure'
cmake -H. -Bbuild || true
echo 'travis_fold:end:configure'

echo 'travis_fold:start:build'
cmake --build build --target all -- --jobs=4
echo 'travis_fold:end:build'

echo 'travis_fold:start:test'
cmake --build build --target test -- CTEST_OUTPUT_ON_FAILURE=1
fi
echo 'travis_fold:end:test'
fi

if [ "${BUILDER}" == bazel ]; then
echo 'travis_fold:start:build'
bazel build --curses=no --copt='-Wno-sign-compare' //...:all
echo 'travis_fold:end:build'

echo 'travis_fold:start:test'
bazel test -c opt --curses=no --copt='-Wno-sign-compare' //...:all
echo 'travis_fold:end:test'
fi

0 comments on commit d9d16af

Please sign in to comment.