From 870ec89e9a89dabedde055407df5208691eb2984 Mon Sep 17 00:00:00 2001 From: gabriel klawitter Date: Fri, 14 Sep 2018 15:55:14 +0200 Subject: [PATCH] Simultaneous platform tests WIP (#9557) * look into commit changes * look into commit changes ii * all on test * build only_releaseable_branches for platforms * allow failure for check during development * windows test typo * fix sh for windows * remove check stage again * debug macos platform --- .gitlab-ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++++ scripts/gitlab/test.sh | 38 ++++++++++++++++++++++++++----------- 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a36c39db7..6e1de5f20 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,6 +60,46 @@ test-rust-stable: &test tags: - rust-stable +test-darwin-macos-x86_64: + stage: test + variables: + CARGO_TARGET: x86_64-apple-darwin + CC: gcc + CXX: g++ + script: + - scripts/gitlab/test.sh stable + tags: + - osx + +test-linux-android-armhf: + stage: test + image: parity/rust-android:gitlab-ci + variables: + CARGO_TARGET: armv7-linux-androideabi + script: + - scripts/gitlab/test.sh stable + tags: + - rust-arm + +test-windows-msvc-x86_64: + stage: test + cache: + key: "%CI_JOB_NAME%" + paths: + - "%CI_PROJECT_DIR%/target/" + - "%CI_PROJECT_DIR%/cargo/" + # No cargo caching, since fetch-locking on Windows gets stuck + variables: + CARGO_TARGET: x86_64-pc-windows-msvc + script: + - sh scripts/gitlab/test.sh stable + tags: + - rust-windows + + + + + .optional_test: &optional_test <<: *test allow_failure: true @@ -139,6 +179,7 @@ build-linux-ubuntu-armhf: build-linux-android-armhf: stage: build + only: *releaseable_branches image: parity/rust-android:gitlab-ci variables: CARGO_TARGET: armv7-linux-androideabi @@ -149,6 +190,7 @@ build-linux-android-armhf: build-darwin-macos-x86_64: stage: build + only: *releaseable_branches variables: CARGO_TARGET: x86_64-apple-darwin CC: gcc @@ -161,6 +203,7 @@ build-darwin-macos-x86_64: build-windows-msvc-x86_64: stage: build + only: *releaseable_branches cache: key: "%CI_JOB_NAME%" paths: diff --git a/scripts/gitlab/test.sh b/scripts/gitlab/test.sh index 98d71e9e5..ad9e0b43c 100755 --- a/scripts/gitlab/test.sh +++ b/scripts/gitlab/test.sh @@ -4,25 +4,41 @@ set -e # fail on any error set -u # treat unset variables as error -rustup default $1 -if [[ "$CI_COMMIT_REF_NAME" = "master" || "$CI_COMMIT_REF_NAME" = "beta" || "$CI_COMMIT_REF_NAME" = "stable" ]]; then - export GIT_COMPARE=$CI_COMMIT_REF_NAME~; -else - export GIT_COMPARE=master; +set -x # full command output for development +git log --graph --oneline --all --decorate=short -n 10 + + +case $CI_COMMIT_REF_NAME in + (master|beta|stable) + export GIT_COMPARE=$CI_COMMIT_REF_NAME~ + ;; + (*) + export GIT_COMPARE=master + ;; +esac + + +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 ^scripts/ | wc -l | tr -d ' ')" +echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED" + + +if [ "${RUST_FILES_MODIFIED}" = "0" ] +then + echo "__________Skipping Rust tests since no Rust files modified__________"; + exit 0 fi -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/ | wc -l)" -echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED" + +rustup default $1 git submodule update --init --recursive rustup show -if [[ "${RUST_FILES_MODIFIED}" == "0" ]]; -then echo "__________Skipping Rust tests since no Rust files modified__________"; -else ./test.sh || exit $?; -fi + +exec ./test.sh # 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 +