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 +