Always run on master (#7557)

* Always build everything if we're on master

* Skip if zero foles have changed, not other way around

* Update test.js

* Update test.js

* Update gitlab-test.sh

* Update gitlab-test.sh

* Update gitlab-test.sh

* Update gitlab-test.sh

* Update gitlab-test.sh
This commit is contained in:
Denis S. Soldatov aka General-Beck 2018-01-15 07:31:06 +03:00 committed by GitHub
parent da62cfd111
commit 6dcf3618d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 19 deletions

View File

@ -1 +1 @@
// test script 27 // test script 28

View File

@ -1 +1 @@
// test script 33 // test script 34

View File

@ -2,62 +2,76 @@
#ARGUMENT test for RUST, JS, COVERAGE or JS_RELEASE #ARGUMENT test for RUST, JS, COVERAGE or JS_RELEASE
set -e # fail on any error set -e # fail on any error
set -u # treat unset variables as 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)" if [[ "$CI_BUILD_REF_NAME" = "beta" || "$CI_BUILD_REF_NAME" = "stable" ]]; then
export JS_OLD_FILES_MODIFIED="$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep ^js-old/ | wc -l)" export GIT_COMPARE=$CI_BUILD_REF_NAME;
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)" else
export RUST_BACKTRACE=1 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 -e ^js -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e ^mac/ -e ^nsis/ | wc -l)"
fi
TEST_SWITCH=$1 TEST_SWITCH=$1
rust_test () { rust_test () {
git submodule update --init --recursive git submodule update --init --recursive
rustup show rustup show
if [[ "${RUST_FILES_MODIFIED}" != "0" ]]; echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED"
if [[ "${RUST_FILES_MODIFIED}" == "0" ]];
then echo "Skipping Rust tests since no Rust files modified."; then echo "Skipping Rust tests since no Rust files modified.";
else ./test.sh; else ./test.sh;
fi fi
if [ "$CI_BUILD_REF_NAME" == "nightly" ]; if [[ "$CI_COMMIT_REF_NAME" == "nightly" ]];
then sh scripts/aura-test.sh; then sh scripts/aura-test.sh;
fi fi
} }
js_test () { js_test () {
git submodule update --init --recursive git submodule update --init --recursive
if [[ "${JS_FILES_MODIFIED}" != "0" ]]; echo "JS_FILES_MODIFIED: $JS_FILES_MODIFIED"
if [[ "${JS_FILES_MODIFIED}" == "0" ]];
then echo "Skipping JS deps install since no JS files modified."; then echo "Skipping JS deps install since no JS files modified.";
else ./js/scripts/install-deps.sh; else ./js/scripts/install-deps.sh;
fi fi
if [[ "${JS_OLD_FILES_MODIFIED}" != "0" ]]; 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."; then echo "Skipping JS (old) deps install since no JS files modified.";
else ./js-old/scripts/install-deps.sh; else ./js-old/scripts/install-deps.sh;
fi fi
if [[ "${JS_FILES_MODIFIED}" != "0" ]]; if [[ "${JS_FILES_MODIFIED}" == "0" ]];
then echo "Skipping JS lint since no JS files modified."; then echo "Skipping JS lint since no JS files modified.";
else ./js/scripts/lint.sh && ./js/scripts/test.sh && ./js/scripts/build.sh; else ./js/scripts/lint.sh && ./js/scripts/test.sh && ./js/scripts/build.sh;
fi fi
if [[ "${JS_OLD_FILES_MODIFIED}" != "0" ]]; if [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]];
then echo "Skipping JS (old) lint since no JS files modified."; 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; else ./js-old/scripts/lint.sh && ./js-old/scripts/test.sh && ./js-old/scripts/build.sh;
fi fi
} }
js_release () { js_release () {
rustup default stable rustup default stable
echo "${JS_FILES_MODIFIED}" echo "JS_FILES_MODIFIED: $JS_FILES_MODIFIED"
if [[ "${JS_FILES_MODIFIED}" != "0" ]]; if [[ "${JS_FILES_MODIFIED}" == "0" ]];
then echo "Skipping JS deps install since no JS files modified."; then echo "Skipping JS deps install since no JS files modified.";
else ./js/scripts/install-deps.sh; else ./js/scripts/install-deps.sh;
fi fi
if [[ "${JS_FILES_MODIFIED}" -eq 0 ]]; if [[ "${JS_FILES_MODIFIED}" == "0" ]];
then echo "Skipping JS rebuild since no JS files modified."; then echo "Skipping JS rebuild since no JS files modified.";
else ./js/scripts/build.sh && ./js/scripts/push-precompiled.sh; else ./js/scripts/build.sh && ./js/scripts/push-precompiled.sh;
fi fi
echo "${JS_OLD_FILES_MODIFIED}" 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."; then echo "Skipping JS (old) deps install since no JS files modified.";
else ./js-old/scripts/install-deps.sh; else ./js-old/scripts/install-deps.sh;
fi fi
if [[ "${JS_OLD_FILES_MODIFIED}" != "0" ]]; if [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]];
then echo "Skipping JS (old) rebuild since no JS files modified."; then echo "Skipping JS (old) rebuild since no JS files modified.";
else ./js-old/scripts/build.sh && ./js-old/scripts/push-precompiled.sh; else ./js-old/scripts/build.sh && ./js-old/scripts/push-precompiled.sh;
fi fi
if [[ "${JS_FILES_MODIFIED}" != "0" ]] && [[ "${JS_OLD_FILES_MODIFIED}" != "0" ]]; if [[ "${JS_FILES_MODIFIED}" == "0" ]] && [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]];
then echo "Skipping Cargo update since no JS files modified."; then echo "Skipping Cargo update since no JS files modified.";
else ./js/scripts/push-cargo.sh; else ./js/scripts/push-cargo.sh;
fi fi