-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align Travis script with rl-uc3m org standards
- Loading branch information
1 parent
9eb2ab5
commit e8c9e7f
Showing
2 changed files
with
185 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,58 @@ | ||
# Integración continua Travis CI | ||
|
||
# Lenguaje de programación | ||
|
||
language: cpp | ||
|
||
# Sistema operativo destino a probar | ||
|
||
dist: xenial | ||
os: linux | ||
|
||
# Distribución del sistema operativo | ||
|
||
dist: trusty | ||
|
||
# Requerimiento de permisos en Linux | ||
|
||
sudo: enabled | ||
|
||
# Compiladores a emplear | ||
|
||
compiler: | ||
compiler: | ||
- gcc | ||
- clang | ||
|
||
# compilación en paralelo con diferentes versiones de YARP | ||
|
||
env: | ||
global: | ||
- CACHE_DIR=~/cached-deps | ||
matrix: | ||
- YARP_CHECKOUT=master | ||
- YARP_CHECKOUT=v2.3.72.1 # stable version | ||
|
||
# Tareas a realizar antes de instalacción | ||
|
||
before_install: | ||
|
||
# Actualizar | ||
|
||
- sudo apt-get -qq update | ||
|
||
# Configurar Git si no lo está | ||
|
||
|
||
- if [ ! `git config --get user.email` ]; then `git config --global user.email '[email protected]'`; fi | ||
- if [ ! `git config --get user.name` ]; then `git config --global user.name 'Travis CI'`; fi | ||
|
||
# En caso de requerir instalar algo para la prueba | ||
- YARP_CHECKOUT=v3.1.1 | ||
- YARP_CHECKOUT=30dce54 # hotfix for v3.0.1 | ||
- YARP_CHECKOUT=v2.3.72.1 | ||
- YARP_CHECKOUT=v2.3.70.2 | ||
|
||
matrix: | ||
include: | ||
- if: type = cron | ||
compiler: gcc | ||
env: ROBOTOLOGY_CHECKOUT=devel | ||
- if: type = cron | ||
compiler: clang | ||
env: ROBOTOLOGY_CHECKOUT=devel | ||
|
||
cache: | ||
directories: $CACHE_DIR | ||
|
||
install: | ||
|
||
# Instalar dependencias | ||
|
||
- sudo apt-get install g++ # or clang++ (presumably) | ||
- sudo apt-get install autoconf automake libtool | ||
- sudo apt-get install pkg-config | ||
- sudo apt-get install libpng-dev | ||
- sudo apt-get install libjpeg8-dev | ||
- sudo apt-get install libtiff5-dev | ||
- sudo apt-get install zlib1g-dev | ||
|
||
# Intalar YCM | ||
- cd # go home | ||
- mkdir -p repos && cd repos # create $HOME/repos if it doesn't exist; then, enter it | ||
- git clone https://github.com/robotology/ycm # clone repository | ||
- mkdir -p ycm/build && cd ycm/build && cmake .. # configure | ||
- make -j$(nproc) # download external modules | ||
- sudo make install && cd # install and go home | ||
|
||
# Instalar YARP | ||
- sudo apt install build-essential git | ||
- sudo apt install libeigen3-dev # Needed for creating YARP lib_math used for kinematics, etc. | ||
- sudo apt install qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev qtdeclarative5-qtquick2-plugin qtdeclarative5-window-plugin qtdeclarative5-qtmultimedia-plugin qtdeclarative5-controls-plugin qtdeclarative5-dialogs-plugin libqt5svg5 | ||
- sudo apt install libjpeg8-dev # Needed for mjpeg carrier | ||
- sudo apt install libedit-dev # Enables keyboard arrow keys within an RPC communication channel via terminal | ||
- mkdir -p ~/repos && cd ~/repos # Create $HOME/repos if it doesn't exist; then, enter it | ||
- git clone https://github.com/robotology/yarp | ||
- cd yarp | ||
- git checkout "$YARP_CHECKOUT" | ||
- mkdir build && cd build | ||
- cmake .. -DSKIP_ACE=ON -DCREATE_LIB_MATH=ON -DCREATE_GUIS=ON -DCREATE_OPTIONAL_CARRIERS=ON -DENABLE_yarpcar_mjpeg=ON # configure | ||
- make -j$(nproc) # Compile | ||
- sudo make install && sudo ldconfig && cd # Install and go home | ||
|
||
# Tareas a ejecutar antes de nuestra prueba | ||
#-- Install YCM | ||
- > | ||
source "$TRAVIS_BUILD_DIR/scripts/travis/git-cache-dependency.sh" | ||
--package-name YCM | ||
--repo-url https://github.com/robotology/ycm | ||
--repo-checkout "${ROBOTOLOGY_CHECKOUT:-${YCM_CHECKOUT:-master}}" | ||
#-- Install YARP | ||
- > | ||
source "$TRAVIS_BUILD_DIR/scripts/travis/git-cache-dependency.sh" | ||
--package-name YARP | ||
--repo-url https://github.com/robotology/yarp | ||
--repo-checkout "${ROBOTOLOGY_CHECKOUT:-$YARP_CHECKOUT}" | ||
--additional-cmake-options "-DSKIP_ACE:BOOL=ON" | ||
--prepend-to-linker-path lib | ||
--additional-export-paths "YARP_DATA_DIRS;share/yarp" | ||
before_script: | ||
- mkdir -p "$TRAVIS_BUILD_DIR/build" && cd "$_" | ||
- cmake .. -DCMAKE_INSTALL_PREFIX="$PWD/install" | ||
- make install | ||
|
||
- cd | ||
- mkdir -p repos; cd repos | ||
- git clone https://github.com/roboticslab-uc3m/follow-me.git | ||
- cd follow-me; mkdir build; cd build; cmake .. | ||
|
||
# Compilamos | ||
script: | ||
- make -j$(nproc) # Compile | ||
|
||
# En caso de compilación exitosa | ||
- echo "No unit tests available" | ||
|
||
after_success: | ||
|
||
- sudo make install | ||
- sudo make uninstall | ||
|
||
- make uninstall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
#-- Initialize variables | ||
package_name= | ||
repo_url= | ||
repo_checkout= | ||
clone_only_branches="master devel develop production" | ||
cmake_home_dir= | ||
additional_cmake_options= | ||
prepend_to_linker_path= | ||
prepend_to_standard_path= | ||
additional_export_paths= | ||
cmake_env= | ||
|
||
#-- Available getopt long option names | ||
#-- https://gist.github.com/magnetikonline/22c1eb412daa350eeceee76c97519da8 | ||
ARGUMENT_LIST=( | ||
"package-name" | ||
"repo-url" | ||
"repo-checkout" | ||
"clone-only-branches" | ||
"cmake-home-dir" | ||
"additional-cmake-options" | ||
"prepend-to-linker-path" | ||
"prepend-to-standard-path" | ||
"additional-export-paths" | ||
"cmake-env" | ||
) | ||
|
||
#-- Read arguments | ||
opts=$(getopt \ | ||
--longoptions "$(printf "%s:," "${ARGUMENT_LIST[@]}")" \ | ||
--name "$(basename "${BASH_SOURCE[0]}")" \ | ||
--options "" \ | ||
-- "$@" | ||
) | ||
|
||
eval set -- $opts | ||
|
||
#-- Parse options | ||
while [ "$#" -gt 1 ]; do | ||
in=$(echo "$1" | sed -e 's/^--//') | ||
for v in "${ARGUMENT_LIST[@]}"; do | ||
if [ "$v" = "$in" ]; then | ||
declare "$(echo "$v" | tr '-' '_')"="$2" | ||
break | ||
fi | ||
done | ||
shift 2 | ||
done | ||
|
||
#-- Check required arguments | ||
if [ -z "$package_name" ] || [ -z "$repo_url" ] || [ -z "$repo_checkout" ]; then | ||
echo "Missing required options. Traceback:" | ||
for v in "${ARGUMENT_LIST[@]}"; do | ||
v_param=$(echo $v | tr '-' '_') | ||
echo " --$v=${!v_param}" | ||
done | ||
return 1 | ||
fi | ||
|
||
#-- Configure paths | ||
repo_source_dir=~/"$package_name-$repo_checkout" | ||
repo_build_dir="$repo_source_dir/build" | ||
repo_cache_dir="$CACHE_DIR/$package_name-$repo_checkout" | ||
cmake_home_dir="$repo_source_dir/$cmake_home_dir" | ||
|
||
#-- Configure CMake command line options | ||
repo_cmake_options="$additional_cmake_options -DCMAKE_INSTALL_PREFIX:PATH=$repo_cache_dir" | ||
|
||
is_clone_only_branch=false | ||
|
||
for branch in $clone_only_branches; do | ||
if [ "$repo_checkout" = "$branch" ]; then | ||
is_clone_only_branch=true | ||
break | ||
fi | ||
done | ||
|
||
if $is_clone_only_branch; then | ||
|
||
#-- Clone, build and store in cache | ||
|
||
echo "Cloning $package_name's $repo_checkout branch" | ||
git clone --depth=1 --branch="$repo_checkout" "$repo_url" "$repo_source_dir" | ||
last_commit_sha=$(git -C "$repo_source_dir" rev-parse HEAD) | ||
|
||
if [ ! -d "$repo_cache_dir" ] || \ | ||
[ ! -f "$repo_cache_dir/.last_commit_sha" ] || \ | ||
[ ! "$(cat $repo_cache_dir/.last_commit_sha)" = "$last_commit_sha" ]; | ||
then | ||
echo "$package_name not in cache or not the latest commit of $repo_checkout branch" | ||
rm -rf "$repo_cache_dir"/* | ||
eval $cmake_env cmake -H"$cmake_home_dir" -B"$repo_build_dir" $repo_cmake_options | ||
make -C "$repo_build_dir" -j$(nproc) install | ||
echo "$last_commit_sha" > "$repo_cache_dir/.last_commit_sha" | ||
else | ||
echo "$package_name found in cache ($(cat $repo_cache_dir/.last_commit_sha))" | ||
fi | ||
|
||
else | ||
|
||
#-- Download zipped file from archive, build and store in cache | ||
|
||
if [ ! -d "$repo_cache_dir" ]; then | ||
echo "Downloading $package_name $repo_checkout from archive" | ||
wget -q "$repo_url/archive/$repo_checkout.tar.gz" -P "$repo_source_dir" | ||
tar xzf "$repo_source_dir/$repo_checkout.tar.gz" -C "$repo_source_dir" --strip-components=1 | ||
eval $cmake_env cmake -H"$cmake_home_dir" -B"$repo_build_dir" $repo_cmake_options | ||
make -C "$repo_build_dir" -j$(nproc) install | ||
else | ||
echo "$package_name $repo_checkout already in cache" | ||
fi | ||
|
||
fi | ||
|
||
#-- Remove clone/download tree (QA#70) | ||
rm -rf "$repo_source_dir" | ||
|
||
#-- Make installed package discoverable by CMake's find_package() command | ||
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:$repo_cache_dir" | ||
|
||
#-- Miscellanea, prepends stuff to LD_LIBRARY_PATH and PATH | ||
|
||
if [ ! -z "$prepend_to_linker_path" ]; then | ||
export LD_LIBRARY_PATH="$repo_cache_dir/$prepend_to_linker_path:$LD_LIBRARY_PATH" | ||
fi | ||
|
||
if [ ! -z "$prepend_to_standard_path" ]; then | ||
export PATH="$repo_cache_dir/$prepend_to_standard_path:$PATH" | ||
fi | ||
|
||
#-- Expands lists of values of the form 'VAR1;val1;VAR2;val2;...' to: | ||
#-- export VAR1=val1 | ||
#-- export VAR2=val2 | ||
#-- ... | ||
if [ ! -z "$additional_export_paths" ]; then | ||
IFS=';' read -ra ITEMS <<< "$additional_export_paths" | ||
for (( count=0; count<"${#ITEMS[@]}"; count+=2 )); do | ||
export "${ITEMS[$count]}"="$repo_cache_dir/${ITEMS[$(( $count+1 ))]}:${!ITEMS[$count]}" | ||
done | ||
fi |