From a39437ac5a0986afd791724f43f7b98219ccb776 Mon Sep 17 00:00:00 2001 From: "Denis S. Soldatov aka General-Beck" Date: Sun, 21 Jan 2018 13:53:40 +0300 Subject: [PATCH] Update gitlab-test.sh remove Always test on master, because js-release is always carried out and we receive [ci-skip] --- scripts/gitlab-test.sh | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/scripts/gitlab-test.sh b/scripts/gitlab-test.sh index 76aff18a2..1d7e18806 100755 --- a/scripts/gitlab-test.sh +++ b/scripts/gitlab-test.sh @@ -2,27 +2,26 @@ #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 $GIT_COMPARE...$CI_COMMIT_SHA | grep ^js/ | wc -l)" +export JS_OLD_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep ^js-old/ | wc -l)" +export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep -v -e ^js -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e ^mac/ -e ^nsis/ | wc -l)" +echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED" +echo "JS_FILES_MODIFIED: $JS_FILES_MODIFIED" +echo "JS_OLD_FILES_MODIFIED: $JS_OLD_FILES_MODIFIED" if [[ "$CI_COMMIT_REF_NAME" = "beta" || "$CI_COMMIT_REF_NAME" = "stable" ]]; then export GIT_COMPARE=$CI_COMMIT_REF_NAME; else export GIT_COMPARE=master; fi -if [[ "$(git rev-parse $GIT_COMPARE)" == "$CI_COMMIT_SHA" ]]; then - # Always build everything if we're on master, beta, stable - export JS_FILES_MODIFIED=1 - export JS_OLD_FILES_MODIFIED=1 - export RUST_FILES_MODIFIED=1 -else - export JS_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep ^js/ | wc -l)" - export JS_OLD_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep ^js-old/ | wc -l)" - export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep -v -e ^js -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e ^mac/ -e ^nsis/ | wc -l)" -fi +echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED" +echo "JS_FILES_MODIFIED: $JS_FILES_MODIFIED" +echo "JS_OLD_FILES_MODIFIED: $JS_OLD_FILES_MODIFIED" TEST_SWITCH=$1 rust_test () { git submodule update --init --recursive rustup show - echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED" - if [[ "${RUST_FILES_MODIFIED}" == "0" ]]; + if [[ "${RUST_FILES_MODIFIED}" == "0" ]]; then echo "Skipping Rust tests since no Rust files modified."; else ./test.sh; fi @@ -32,13 +31,11 @@ rust_test () { } js_test () { git submodule update --init --recursive - echo "JS_FILES_MODIFIED: $JS_FILES_MODIFIED" if [[ "${JS_FILES_MODIFIED}" == "0" ]]; then echo "Skipping JS deps install since no JS files modified."; else ./js/scripts/install-deps.sh; fi - echo "JS_OLD_FILES_MODIFIED: $JS_OLD_FILES_MODIFIED" - if [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]]; + if [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]]; then echo "Skipping JS (old) deps install since no JS files modified."; else ./js-old/scripts/install-deps.sh; fi @@ -53,7 +50,6 @@ js_test () { } js_release () { rustup default stable - echo "JS_FILES_MODIFIED: $JS_FILES_MODIFIED" if [[ "${JS_FILES_MODIFIED}" == "0" ]]; then echo "Skipping JS deps install since no JS files modified."; else ./js/scripts/install-deps.sh; @@ -62,7 +58,6 @@ js_release () { 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: $JS_OLD_FILES_MODIFIED" if [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]]; then echo "Skipping JS (old) deps install since no JS files modified."; else ./js-old/scripts/install-deps.sh;