fix conditions

This commit is contained in:
Denis S. Soldatov aka General-Beck
2018-01-10 07:33:46 +03:00
parent cb8c4b4e96
commit 0b91bd4b11
3 changed files with 39 additions and 39 deletions

2
scripts/gitlab-build.sh Normal file → Executable file
View File

@@ -9,7 +9,7 @@ ARC=$3
CC=$4
CXX=$5
EXT=deb
VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
VER="$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")"
echo "--------------------"
echo "Build for platform: " $BUILD_PLATFORM
echo "Cargo target: " $PLATFORM

38
scripts/gitlab-test.sh Normal file → Executable file
View File

@@ -2,17 +2,17 @@
#ARGUMENT test for RUST, JS, COVERAGE or JS_RELEASE
set -e # fail on any error
set -u # treat unset variables as error
export JS_FILES_MODIFIED=$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep ^js/ | wc -l)
export JS_OLD_FILES_MODIFIED=$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep ^js-old/ | wc -l)
export RUST_FILES_MODIFIED=$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep -v -e ^js -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e^mac/ -e ^nsis/ | wc -l)
export JS_FILES_MODIFIED="$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep ^js/ | wc -l)"
export JS_OLD_FILES_MODIFIED="$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep ^js-old/ | wc -l)"
export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep -v -e ^js -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e^mac/ -e ^nsis/ | wc -l)"
export RUST_BACKTRACE=1
TEST=$1
TEST_SWITCH=$1
rust_test () {
git submodule update --init --recursive
rustup show
if [ $RUST_FILES_MODIFIED -eq 0 ];
if [ "${RUST_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping Rust tests since no Rust files modified.";
else ./test.sh $CARGOFLAGS;
else ./test.sh;
fi
if [ "$CI_BUILD_REF_NAME" == "nightly" ];
then sh scripts/aura-test.sh;
@@ -20,44 +20,44 @@ rust_test () {
}
js_test () {
git submodule update --init --recursive
if [ $JS_FILES_MODIFIED -eq 0 ];
if [ "${JS_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping JS deps install since no JS files modified.";
else ./js/scripts/install-deps.sh;
fi
if [ $JS_OLD_FILES_MODIFIED -eq 0 ];
if [ "${JS_OLD_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping JS (old) deps install since no JS files modified.";
else ./js-old/scripts/install-deps.sh;
fi
if [ $JS_FILES_MODIFIED -eq 0 ];
if [ "${JS_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping JS lint since no JS files modified.";
else ./js/scripts/lint.sh && ./js/scripts/test.sh && ./js/scripts/build.sh;
fi
if [ $JS_OLD_FILES_MODIFIED -eq 0 ];
if [ "${JS_OLD_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping JS (old) lint since no JS files modified.";
else ./js-old/scripts/lint.sh && ./js-old/scripts/test.sh && ./js-old/scripts/build.sh;
fi
}
js_release () {
rustup default stable
echo $JS_FILES_MODIFIED
if [ $JS_FILES_MODIFIED -eq 0 ];
echo "${JS_FILES_MODIFIED}"
if [ "${JS_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping JS deps install since no JS files modified.";
else ./js/scripts/install-deps.sh;
fi
if [ $JS_FILES_MODIFIED -eq 0 ];
if [ "${JS_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping JS rebuild since no JS files modified.";
else ./js/scripts/build.sh && ./js/scripts/push-precompiled.sh;
fi
echo $JS_OLD_FILES_MODIFIED
if [ $JS_OLD_FILES_MODIFIED -eq 0 ];
echo "${JS_OLD_FILES_MODIFIED}"
if [ "${JS_OLD_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping JS (old) deps install since no JS files modified.";
else ./js-old/scripts/install-deps.sh;
fi
if [ $JS_OLD_FILES_MODIFIED -eq 0 ];
if [ "${JS_OLD_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping JS (old) rebuild since no JS files modified.";
else ./js-old/scripts/build.sh && ./js-old/scripts/push-precompiled.sh;
fi
if [ $JS_FILES_MODIFIED -eq 0 ] && [ $JS_OLD_FILES_MODIFIED -eq 0 ];
if [ "${JS_FILES_MODIFIED}" -eq 0 ] && [ "${JS_OLD_FILES_MODIFIED}" -eq 0 ];
then echo "Skipping Cargo update since no JS files modified.";
else ./js/scripts/push-cargo.sh;
fi
@@ -68,8 +68,8 @@ coverage_test () {
rm -rf js/.coverage
scripts/cov.sh
}
case TEST in
stable)
case $TEST_SWITCH in
stable )
rustup default stable
rust_test
;;