Use mislav's 'travis-ci' gist to show build status for current branch
This commit is contained in:
@@ -121,23 +121,27 @@ fi
|
|||||||
#
|
#
|
||||||
# Creates and excludes .travis_status~
|
# Creates and excludes .travis_status~
|
||||||
# Use with SCM breeze repo index.
|
# Use with SCM breeze repo index.
|
||||||
|
# Requires 'travis-ci' script from https://gist.github.com/1708408
|
||||||
# Add the following line to your crontab: (updates every 2 minutes)
|
# Add the following line to your crontab: (updates every 2 minutes)
|
||||||
# */2 * * * * /bin/bash -c '. $HOME/.bashrc && git_index --rebuild && git_index --batch-cmd update_travis_ci_status'
|
# */2 * * * * /bin/bash -c '. $HOME/.bashrc && git_index --rebuild && git_index --batch-cmd update_travis_ci_status'
|
||||||
#
|
#
|
||||||
update_travis_ci_status() {
|
update_travis_ci_status() {
|
||||||
if [ -e ".travis.yml" ]; then
|
if [ -e ".travis.yml" ]; then
|
||||||
if type ruby > /dev/null 2>&1 && type travis > /dev/null 2>&1; then
|
if type ruby > /dev/null 2>&1 && type travis-ci > /dev/null 2>&1; then
|
||||||
# Only use slug from origin
|
# Use repo from origin remote
|
||||||
local repo=$(ruby -e "puts %x[git remote -v].scan(/origin.*(?:\:|\/)([^\:\/]+\/[^\:\/]+)\.git/m).flatten.uniq")
|
local branches=$(git branch -a | sed "s/ *remotes\/origin\///;tm;d;:m;/^HEAD/d;")
|
||||||
local travis_output=$(travis repositories --slugs="$repo")
|
|
||||||
local stat_file=".travis_status~"
|
local stat_file=".travis_status~"
|
||||||
case "$travis_output" in
|
echo -n > "$stat_file"
|
||||||
*Passing*) echo "Passing" > "$stat_file";;
|
for branch in $branches; do
|
||||||
*Failing*) echo "Failing" > "$stat_file";;
|
local travis_output=$(travis-ci "$branch" 2>&1)
|
||||||
*Running*) echo "Running" > "$stat_file";;
|
case "$travis_output" in
|
||||||
esac
|
*built\ OK*) echo "$branch passed" >> "$stat_file";;
|
||||||
|
*failed*) echo "$branch failed" >> "$stat_file";;
|
||||||
git_ignore ".travis_status~" ".git/info/exclude"
|
*in\ progress*) echo "$branch running" >> "$stat_file";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
git_ignore "$stat_file" ".git/info/exclude"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user