2018-06-25 11:21:45 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-02-05 10:40:00 +01:00
|
|
|
#ARGUMENT test for RUST and COVERAGE
|
2018-01-10 04:38:50 +01:00
|
|
|
set -e # fail on any error
|
|
|
|
set -u # treat unset variables as error
|
2018-04-12 15:53:54 +02:00
|
|
|
if [[ "$CI_COMMIT_REF_NAME" = "master" || "$CI_COMMIT_REF_NAME" = "beta" || "$CI_COMMIT_REF_NAME" = "stable" ]]; then
|
2018-03-16 15:19:14 +01:00
|
|
|
export GIT_COMPARE=$CI_COMMIT_REF_NAME~;
|
2018-01-23 03:04:28 +01:00
|
|
|
else
|
|
|
|
export GIT_COMPARE=master;
|
|
|
|
fi
|
2018-05-14 11:28:41 +02:00
|
|
|
git fetch -a
|
|
|
|
export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep -v -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e ^mac/ -e ^nsis/ -e ^docs/ | wc -l)"
|
2018-01-21 11:53:40 +01:00
|
|
|
echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED"
|
2018-01-10 05:33:46 +01:00
|
|
|
TEST_SWITCH=$1
|
2018-01-10 04:38:50 +01:00
|
|
|
rust_test () {
|
|
|
|
git submodule update --init --recursive
|
|
|
|
rustup show
|
2018-01-21 11:53:40 +01:00
|
|
|
if [[ "${RUST_FILES_MODIFIED}" == "0" ]];
|
2018-01-10 04:38:50 +01:00
|
|
|
then echo "Skipping Rust tests since no Rust files modified.";
|
2018-02-13 16:21:24 +01:00
|
|
|
else ./test.sh || exit $?;
|
2018-01-10 04:38:50 +01:00
|
|
|
fi
|
2018-02-14 12:39:08 +01:00
|
|
|
# if [[ "$CI_COMMIT_REF_NAME" == "nightly" ]];
|
|
|
|
# ### @TODO re-enable fail after https://github.com/paritytech/parity-import-tests/issues/3
|
|
|
|
# then sh scripts/aura-test.sh; # || exit $?;
|
|
|
|
# fi
|
2018-01-10 04:38:50 +01:00
|
|
|
}
|
|
|
|
coverage_test () {
|
|
|
|
git submodule update --init --recursive
|
|
|
|
rm -rf target/*
|
|
|
|
scripts/cov.sh
|
|
|
|
}
|
2018-01-10 05:33:46 +01:00
|
|
|
case $TEST_SWITCH in
|
|
|
|
stable )
|
2018-01-10 04:38:50 +01:00
|
|
|
rustup default stable
|
|
|
|
rust_test
|
|
|
|
;;
|
|
|
|
beta)
|
|
|
|
rustup default beta
|
|
|
|
rust_test
|
|
|
|
;;
|
|
|
|
nightly)
|
|
|
|
rustup default nightly
|
|
|
|
rust_test
|
|
|
|
;;
|
|
|
|
test-coverage)
|
|
|
|
coverage_test
|
|
|
|
;;
|
|
|
|
esac
|