2018-08-26 00:44:08 +02:00
|
|
|
#!/bin/bash
|
2019-03-19 09:10:36 +01:00
|
|
|
echo "________Running rust_changes.sh________"
|
2018-08-26 00:44:08 +02:00
|
|
|
set -e # fail on any error
|
|
|
|
set -u # treat unset variables as error
|
|
|
|
|
2019-03-19 09:10:36 +01:00
|
|
|
echo "__________Checking if Rust files were changed__________"
|
2018-10-12 13:45:28 +02:00
|
|
|
git log --graph --oneline --decorate=short -n 10
|
2018-09-14 15:55:14 +02:00
|
|
|
|
2018-10-09 15:32:07 +02:00
|
|
|
case ${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}} in
|
2018-10-02 01:03:58 +02:00
|
|
|
(beta|stable)
|
2018-10-12 13:45:28 +02:00
|
|
|
export GIT_COMPARE=origin/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}~
|
2018-09-14 15:55:14 +02:00
|
|
|
;;
|
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
|
|
|
|
|
2018-08-26 00:44:08 +02:00
|
|
|
rustup show
|