Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Simultaneous platform tests WIP #9557

Merged
merged 9 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
stages:
- check
- test
- build
- package
Expand Down Expand Up @@ -51,6 +52,17 @@ cache:



#### stage: check-changes
check-changes-in-rust:
stage: check
script:
- scripts/gitlab/check-changes.sh
tags:
- shell
allow_failure: true



#### stage: test

test-rust-stable: &test
Expand All @@ -60,6 +72,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
Expand Down Expand Up @@ -139,6 +191,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
Expand All @@ -149,6 +202,7 @@ build-linux-android-armhf:

build-darwin-macos-x86_64:
stage: build
only: *releaseable_branches
variables:
CARGO_TARGET: x86_64-apple-darwin
CC: gcc
Expand All @@ -161,6 +215,7 @@ build-darwin-macos-x86_64:

build-windows-msvc-x86_64:
stage: build
only: *releaseable_branches
cache:
key: "%CI_JOB_NAME%"
paths:
Expand Down
34 changes: 34 additions & 0 deletions scripts/gitlab/check-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh
#
# script returns 0 if there are no changes to the rust codebase
# 1 otherwise

set -e # fail on any error
set -u # treat unset variables as error

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 ^windows/ -e ^scripts/ -e ^mac/ -e ^nsis/ | wc -l)"
echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED"


if [ "${RUST_FILES_MODIFIED}" = "0" ]
then
echo "__________Skipping Rust tests since no Rust files modified__________";
exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a nicer way to do this? "no files modified" is a valid result and should not result in a failing job

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately not. will only become very unbeautiful. so i removed the check stage again. but builds take way to long IMHO before switching to it. Also there are errors in the stage within the CI as well as Rust code that does not seem to compile properly on all platforms.

else
echo "__________Rust files modified__________";
fi

16 changes: 3 additions & 13 deletions scripts/gitlab/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,13 @@
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;
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

./test.sh || exit $?

# if [[ "$CI_COMMIT_REF_NAME" == "nightly" ]];
# ### @TODO re-enable fail after https://github.com/paritytech/parity-import-tests/issues/3
Expand Down