-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- more modularization - travis_run_simple: no folding - travis_run_true: folding, timing, accept failures - travis_run: folding, timing, not accepting failures - travis_run_wait: +timeout - support hierarchical folds (with custom fold names and titles) - travis_wait() to wait for a background process to finish - limit travis_run_wait's timeout to estimated remaining Travis' build time - filter() and filter-out() utility functions - further extended unittests for all these utility functions
- Loading branch information
Showing
7 changed files
with
549 additions
and
225 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
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,25 +1,33 @@ | ||
# Software License Agreement - BSD License | ||
# | ||
# Author: Dave Coleman | ||
|
||
travis_fold start clang.format "Running clang-format check" | ||
travis_run_simple --display "cd to repository source: $CI_SOURCE_PATH" cd $CI_SOURCE_PATH | ||
|
||
# Install Dependencies | ||
travis_run apt-get -qq install -y clang-format-3.9 | ||
|
||
# Change to source directory. | ||
cd $CI_SOURCE_PATH | ||
|
||
# This directory can have its own .clang-format config file but if not, MoveIt's will be provided | ||
# Ensure that a .clang-format config file is present, if not download from MoveIt | ||
if [ ! -f .clang-format ]; then | ||
travis_run wget -nv "https://raw.githubusercontent.com/ros-planning/moveit/$ROS_DISTRO-devel/.clang-format" | ||
fi | ||
|
||
# Run clang-format | ||
travis_time_start moveit_ci.clang-format "Running clang-format" # start fold | ||
find . -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format-3.9 -i -style=file | ||
travis_time_end # end fold | ||
cmd="find . -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format-3.9 -i -style=file" | ||
travis_run --display "Running clang-format${ANSI_RESET}\\n$cmd" "$cmd" | ||
|
||
# Make sure no changes have occured in repo | ||
if ! git diff-index --quiet HEAD --; then | ||
# changes | ||
echo -e "\033[31;1mclang-format test failed: The following changes are required to comply to rules:\033[0m" | ||
git --no-pager diff | ||
exit 1 # error | ||
fi | ||
# Check for changes in repo | ||
travis_have_fixes | ||
result=$? | ||
|
||
# Finish fold before printing result summary | ||
travis_fold end clang.format | ||
|
||
echo -e "\033[32;1mPassed clang-format check\033[0m" | ||
if [ $result -eq 1 ] ; then | ||
echo -e "${ANSI_GREEN}Passed clang-format check${ANSI_RESET}" | ||
else | ||
echo -e "${ANSI_RED}clang-format check failed. Open fold for details.${ANSI_RESET}" | ||
echo -e "Run the following command to fix these issues:\\n$cmd" | ||
exit 2 | ||
fi |
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
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
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,35 @@ | ||
# from https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_cmd.bash | ||
|
||
export ANSI_RED="\033[31;1m" | ||
export ANSI_GREEN="\033[32;1m" | ||
export ANSI_YELLOW="\033[33;1m" | ||
export ANSI_RESET="\033[0m" | ||
export ANSI_CLEAR="\033[0K" | ||
|
||
travis_nanoseconds() { | ||
local cmd='date' | ||
local format='+%s%N' | ||
|
||
if hash gdate >/dev/null 2>&1; then | ||
cmd='gdate' | ||
elif [[ "${TRAVIS_OS_NAME}" == osx ]]; then | ||
format='+%s000000000' | ||
fi | ||
|
||
"${cmd}" -u "${format}" | ||
} | ||
travis_time_start() { | ||
TRAVIS_TIMER_ID="$(printf %08x $((RANDOM * RANDOM)))" | ||
TRAVIS_TIMER_START_TIME="$(travis_nanoseconds)" | ||
export TRAVIS_TIMER_ID TRAVIS_TIMER_START_TIME | ||
echo -en "travis_time:start:$TRAVIS_TIMER_ID\\r${ANSI_CLEAR}" | ||
} | ||
travis_time_finish() { | ||
local result="${?}" | ||
local travis_timer_end_time | ||
travis_timer_end_time="$(travis_nanoseconds)" | ||
local duration | ||
duration="$((travis_timer_end_time - TRAVIS_TIMER_START_TIME))" | ||
echo -en "travis_time:end:${TRAVIS_TIMER_ID}:start=${TRAVIS_TIMER_START_TIME},finish=${travis_timer_end_time},duration=${duration}\\r${ANSI_CLEAR}" | ||
return "${result}" | ||
} |
Oops, something went wrong.