Let the travis gem format the .travis.yml file

This commit is contained in:
Matthias Beyer 2016-08-22 12:44:15 +02:00
parent c434e1cd29
commit 35c4ce3348

View file

@ -1,92 +1,83 @@
sudo: false sudo: false
language: rust language: rust
rust: rust:
- beta - beta
- nightly - nightly
- stable - stable
cache: cargo cache: cargo
matrix: matrix:
allow_failures: allow_failures:
- rust: nightly - rust: nightly
- rust: beta - rust: beta
before_install: before_install:
- | - |
c=$(git diff $(git merge-base master $TRAVIS_COMMIT)..$TRAVIS_COMMIT --name-only | cut -d "/" -f 1 | uniq) c=$(git diff $(git merge-base master $TRAVIS_COMMIT)..$TRAVIS_COMMIT --name-only | cut -d "/" -f 1 | uniq)
if [[ "$c" == "doc" ]]; then if [[ "$c" == "doc" ]]; then
echo "Only changes in DOC, exiting 0" echo "Only changes in DOC, exiting 0"
exit 0 exit 0
else else
echo "Changes in other directories than ./doc" echo "Changes in other directories than ./doc"
echo "continue build..." echo "continue build..."
fi fi
before_script: before_script:
- | - |
pip install 'travis-cargo<0.2' --user && pip install 'travis-cargo<0.2' --user &&
export PATH=$HOME/.local/bin:$PATH export PATH=$HOME/.local/bin:$PATH
script: script:
- | - |
travis_cargo_run_in() { travis_cargo_run_in() {
echo ":: Trying to run cargo in $1" echo ":: Trying to run cargo in $1"
[[ -d "$1" ]] && [[ -d "$1" ]] &&
cd "$1" && cd "$1" &&
{ {
{ {
if [[ $(echo "$1" | grep lib) ]]; then if [[ $(echo "$1" | grep lib) ]]; then
travis-cargo -q test travis-cargo -q test
else else
travis-cargo -q build travis-cargo -q build
fi fi
} && } &&
cd - cd -
} || exit 1 } || exit 1
} }
run_sh_test() { run_sh_test() {
echo "--- Running test script: '$1'" echo "--- Running test script: '$1'"
bash $1 || { echo "--- Test failed. Exiting"; exit 1; } bash $1 || { echo "--- Test failed. Exiting"; exit 1; }
echo "--- Test script $1 executed successfully" echo "--- Test script $1 executed successfully"
} }
echo "<< Changes in ./doc are not build by CI >>" echo "<< Changes in ./doc are not build by CI >>"
for d in $(find -name "Cargo.toml" | grep -vE "^./Cargo.toml$"); do
echo ":: Working on $d"
dir=$(dirname $d)
{ \
echo -e "\n--- Running in $d ---\n" && \
travis_cargo_run_in $dir && \
echo "--- Running test scripts ---" && \
for testsh in $(find $dir -iname "*test.sh"); do
run_sh_test $testsh
done && \
echo -e "--- Done with test scripts ---\n\n"
} || true
done
for d in $(find -name "Cargo.toml" | grep -vE "^./Cargo.toml$"); do
echo ":: Working on $d"
dir=$(dirname $d)
{ \
echo -e "\n--- Running in $d ---\n" && \
travis_cargo_run_in $dir && \
echo "--- Running test scripts ---" && \
for testsh in $(find $dir -iname "*test.sh"); do
run_sh_test $testsh
done && \
echo -e "--- Done with test scripts ---\n\n"
} || true
done
addons: addons:
apt: apt:
packages: packages:
- libcurl4-openssl-dev - libcurl4-openssl-dev
- libelf-dev - libelf-dev
- libdw-dev - libdw-dev
after_success: after_success:
- travis-cargo --only stable doc-upload - travis-cargo --only stable doc-upload
notifications: notifications:
email: email:
on_success: never on_success: never
irc: irc:
channels: channels:
- "chat.freenode.net#imag" - chat.freenode.net#imag
template: template:
- "%{repository_name} (%{branch} @ %{commit} by %{author}): %{result}" - "%{repository_name} (%{branch} @ %{commit} by %{author}): %{result}"
env: env:
global: global:
- TRAVIS_CARGO_NIGHTLY_FEATURE=dev - TRAVIS_CARGO_NIGHTLY_FEATURE=dev