travis: Build only changed things
Build library only if the library changed
This commit is contained in:
parent
7a08c9b773
commit
37e5307e08
1 changed files with 30 additions and 5 deletions
35
.travis.yml
35
.travis.yml
|
@ -16,14 +16,39 @@ before_script:
|
|||
|
||||
script:
|
||||
- |
|
||||
if [[ "doc" == $(git diff --name-only $TRAVIS_BRANCH..$TRAVIS_COMMIT | cut -d "/" -f 1 | uniq) ]]; then
|
||||
echo "There are only changes in the ./doc directory... not doing anything"
|
||||
else
|
||||
changes_in() {
|
||||
[[ $(git diff --name-only $TRAVIS_BRANCH..$TRAVIS_COMMIT | \
|
||||
cut -d "/" -f 1 | \
|
||||
grep "$n") ]] > /dev/null
|
||||
}
|
||||
|
||||
travis_cargo_run_in() {
|
||||
[[ -d "$1" ]] &&
|
||||
cd "$1" &&
|
||||
travis-cargo build &&
|
||||
travis-cargo test &&
|
||||
travis-cargo bench &&
|
||||
travis-cargo --only stable doc
|
||||
fi
|
||||
travis-cargo --only stable doc &&
|
||||
cd -
|
||||
}
|
||||
|
||||
if_changed_then_build_or_exit() {
|
||||
if [[ $(changes_in "$1") ]]; then
|
||||
echo "Changes in $1, building..."
|
||||
travis_cargo_run_in "$1" || exit 1
|
||||
else
|
||||
echo "No changes in $1"
|
||||
fi
|
||||
}
|
||||
|
||||
[[ $(changes_in "doc") ]] && echo "Changes in ./doc are not build by CI"
|
||||
|
||||
if_changed_then_build_or_exit "libimagmodule"
|
||||
if_changed_then_build_or_exit "libimagrt"
|
||||
if_changed_then_build_or_exit "libimagstore"
|
||||
if_changed_then_build_or_exit "libimagutil"
|
||||
|
||||
(changes_in "src" && travis_cargo_run_in ".") || true
|
||||
|
||||
addons:
|
||||
apt:
|
||||
|
|
Loading…
Reference in a new issue