Skip to content

Commit

Permalink
Manage travis-ci build in an external script
Browse files Browse the repository at this point in the history
This allows to:
 * override configuration
 * deal with travis-ci timing restrictions

Signed-off-by: Jean-Marie Lemetayer <[email protected]>
  • Loading branch information
jmlemetayer committed Oct 3, 2015
1 parent b565e94 commit 6fac453
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Add current directory to PATH
export PATH="$(pwd):$PATH"

# Manage the travis build
ct-ng_travis_build()
{
# Override the log behaviour
sed -i -e 's/^.*\(CT_LOG_ERROR\).*$/# \1 is not set/' \
-e 's/^.*\(CT_LOG_WARN\).*$/# \1 is not set/' \
-e 's/^.*\(CT_LOG_INFO\).*$/# \1 is not set/' \
-e 's/^.*\(CT_LOG_EXTRA\).*$/\1=y/' \
-e 's/^.*\(CT_LOG_ALL\).*$/# \1 is not set/' \
-e 's/^.*\(CT_LOG_DEBUG\).*$/# \1 is not set/' \
-e 's/^.*\(CT_LOG_LEVEL_MAX\).*$/\1="EXTRA"/' \
-e 's/^.*\(CT_LOG_PROGRESS_BAR\).*$/# \1 is not set/' \
-e 's/^.*\(CT_LOCAL_TARBALLS_DIR\).*$/\1="${HOME}\/src"/' \
-e 's/^.*\(CT_SAVE_TARBALLS\).*$/\1=y/' \
.config

# Build the sample
ct-ng build.2 &
local build_pid=$!

# Start a runner task to print a "still running" line every 5 minutes
# to avoid travis to think that the build is stuck
{
while true
do
sleep 300
printf "Crosstool-NG is still running ...\r"
done
} &
local runner_pid=$!

# Wait for the build to finish and get the result
wait $build_pid 2>/dev/null
local result=$?

# Stop the runner task
kill $runner_pid
wait $runner_pid 2>/dev/null

# Return the result
return $result
}
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ env:

# Building the standard samples
script:
- ./ct-ng $CT_SAMPLE
- CT_LOG_DEBUG=y CT_LOG_LEVEL_MAX="DEBUG" ./ct-ng build.2
- . ./.travis.sh # Load the travis environment
- ct-ng $CT_SAMPLE # Configure the build
- ct-ng_travis_build # Build the sample

# On failure displaying the last lines of the log file
after_failure:
Expand Down

0 comments on commit 6fac453

Please sign in to comment.