2018-08-26 00:44:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# ARGUMENT $1 Rust flavor to test with (stable/beta/nightly)
|
|
|
|
|
|
|
|
set -e # fail on any error
|
|
|
|
set -u # treat unset variables as error
|
|
|
|
|
2018-09-14 15:55:14 +02:00
|
|
|
git log --graph --oneline --all --decorate=short -n 10
|
|
|
|
|
|
|
|
case $CI_COMMIT_REF_NAME in
|
2018-10-02 01:03:58 +02:00
|
|
|
(beta|stable)
|
2018-09-14 15:55:14 +02:00
|
|
|
export GIT_COMPARE=$CI_COMMIT_REF_NAME~
|
|
|
|
;;
|
2018-10-02 01:03:58 +02:00
|
|
|
(master|nightly)
|
|
|
|
export GIT_COMPARE=master~
|
|
|
|
;;
|
2018-09-14 15:55:14 +02:00
|
|
|
(*)
|
|
|
|
export GIT_COMPARE=master
|
2018-10-02 01:03:58 +02:00
|
|
|
;;
|
2018-09-14 15:55:14 +02:00
|
|
|
esac
|
2018-08-26 00:44:08 +02:00
|
|
|
|
2018-10-02 01:03:58 +02:00
|
|
|
export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep -v -e ^\\. -e ^LICENSE -e ^README.md -e ^CHANGELOG.md -e ^test.sh -e ^scripts/ -e ^docs/ -e ^docker/ -e ^snap/ | wc -l | tr -d ' ')"
|
2018-08-26 00:44:08 +02:00
|
|
|
echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED"
|
|
|
|
|
2018-09-14 15:55:14 +02:00
|
|
|
if [ "${RUST_FILES_MODIFIED}" = "0" ]
|
|
|
|
then
|
|
|
|
echo "__________Skipping Rust tests since no Rust files modified__________";
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
rustup default $1
|
|
|
|
|
2018-08-26 00:44:08 +02:00
|
|
|
git submodule update --init --recursive
|
|
|
|
rustup show
|
2018-09-14 15:55:14 +02:00
|
|
|
|
|
|
|
exec ./test.sh
|