add gitlab-test.sh
move functions from .yml to add gitlab-test.sh
This commit is contained in:
parent
f400a7e171
commit
cb8c4b4e96
@ -236,23 +236,15 @@ test-coverage:
|
|||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
script:
|
script:
|
||||||
- git submodule update --init --recursive
|
- sh scripts/gitlab-test.sh test-coverage
|
||||||
- rm -rf target/*
|
|
||||||
- rm -rf js/.coverage
|
|
||||||
- scripts/cov.sh
|
|
||||||
tags:
|
tags:
|
||||||
- kcov
|
- kcov
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
test-rust-stable:
|
test-rust-stable:
|
||||||
stage: test
|
stage: test
|
||||||
image: parity/rust:gitlab-ci
|
image: parity/rust:gitlab-ci
|
||||||
variables:
|
|
||||||
RUST_BACKTRACE: 1
|
|
||||||
script:
|
script:
|
||||||
- git submodule update --init --recursive
|
- sh scripts/gitlab-test.sh stable
|
||||||
- rustup show
|
|
||||||
- if [ $RUST_FILES_MODIFIED -eq 0 ]; then echo "Skipping Rust tests since no Rust files modified."; else ./test.sh $CARGOFLAGS; fi
|
|
||||||
- if [ "$CI_BUILD_REF_NAME" == "nightly" ]; then sh scripts/aura-test.sh; fi
|
|
||||||
tags:
|
tags:
|
||||||
- rust-stable
|
- rust-stable
|
||||||
test-rust-beta:
|
test-rust-beta:
|
||||||
@ -261,12 +253,8 @@ test-rust-beta:
|
|||||||
- triggers
|
- triggers
|
||||||
- master
|
- master
|
||||||
image: parity/rust:gitlab-ci
|
image: parity/rust:gitlab-ci
|
||||||
variables:
|
|
||||||
RUST_BACKTRACE: 1
|
|
||||||
script:
|
script:
|
||||||
- git submodule update --init --recursive
|
- sh scripts/gitlab-test.sh beta
|
||||||
- rustup default beta
|
|
||||||
- if [ $RUST_FILES_MODIFIED -eq 0 ]; then echo "Skipping Rust tests since no Rust files modified."; else ./test.sh $CARGOFLAGS; fi
|
|
||||||
tags:
|
tags:
|
||||||
- rust-beta
|
- rust-beta
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
@ -276,12 +264,8 @@ test-rust-nightly:
|
|||||||
- triggers
|
- triggers
|
||||||
- master
|
- master
|
||||||
image: parity/rust:gitlab-ci
|
image: parity/rust:gitlab-ci
|
||||||
variables:
|
|
||||||
RUST_BACKTRACE: 1
|
|
||||||
script:
|
script:
|
||||||
- git submodule update --init --recursive
|
- sh scripts/gitlab-test.sh nightly
|
||||||
- rustup default nightly
|
|
||||||
- if [ $RUST_FILES_MODIFIED -eq 0 ]; then echo "Skipping Rust tests since no Rust files modified."; else ./test.sh $CARGOFLAGS; fi
|
|
||||||
tags:
|
tags:
|
||||||
- rust
|
- rust
|
||||||
- rust-nightly
|
- rust-nightly
|
||||||
@ -290,11 +274,7 @@ js-test:
|
|||||||
stage: test
|
stage: test
|
||||||
image: parity/rust:gitlab-ci
|
image: parity/rust:gitlab-ci
|
||||||
script:
|
script:
|
||||||
- git submodule update --init --recursive
|
- sh scripts/gitlab-test.sh js-test
|
||||||
- if [ $JS_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS deps install since no JS files modified."; else ./js/scripts/install-deps.sh;fi
|
|
||||||
- if [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS (old) deps install since no JS files modified."; else ./js-old/scripts/install-deps.sh;fi
|
|
||||||
- if [ $JS_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS lint since no JS files modified."; else ./js/scripts/lint.sh && ./js/scripts/test.sh && ./js/scripts/build.sh; fi
|
|
||||||
- if [ $JS_OLD_FILES_MODIFIED -eq 0 ]; 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; fi
|
|
||||||
tags:
|
tags:
|
||||||
- rust-stable
|
- rust-stable
|
||||||
js-release:
|
js-release:
|
||||||
@ -307,14 +287,7 @@ js-release:
|
|||||||
- triggers
|
- triggers
|
||||||
image: parity/rust:gitlab-ci
|
image: parity/rust:gitlab-ci
|
||||||
script:
|
script:
|
||||||
- rustup default stable
|
- sh scripts/gitlab-test.sh js-release
|
||||||
- echo $JS_FILES_MODIFIED
|
|
||||||
- if [ $JS_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS deps install since no JS files modified."; else ./js/scripts/install-deps.sh;fi
|
|
||||||
- if [ $JS_FILES_MODIFIED -eq 0 ]; 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
|
|
||||||
- if [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS (old) deps install since no JS files modified."; else ./js-old/scripts/install-deps.sh;fi
|
|
||||||
- if [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS (old) rebuild since no JS files modified."; else ./js-old/scripts/build.sh && ./js-old/scripts/push-precompiled.sh; fi
|
|
||||||
- if [ $JS_FILES_MODIFIED -eq 0 ] && [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping Cargo update since no JS files modified."; else ./js/scripts/push-cargo.sh; fi
|
|
||||||
tags:
|
tags:
|
||||||
- javascript
|
- javascript
|
||||||
push-release:
|
push-release:
|
||||||
@ -329,12 +302,3 @@ push-release:
|
|||||||
- curl --data "secret=$RELEASES_SECRET" http://update.parity.io:1338/push-release/$CI_BUILD_REF_NAME/$CI_BUILD_REF
|
- curl --data "secret=$RELEASES_SECRET" http://update.parity.io:1338/push-release/$CI_BUILD_REF_NAME/$CI_BUILD_REF
|
||||||
tags:
|
tags:
|
||||||
- curl
|
- curl
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
.functions: &functions |
|
|
||||||
JS_FILES_MODIFIED=$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep ^js/ | wc -l)
|
|
||||||
JS_OLD_FILES_MODIFIED=$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep ^js-old/ | wc -l)
|
|
||||||
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)
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- *functions
|
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
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
|
||||||
# ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. & 4. CC & CXX flags
|
#ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags
|
||||||
# 5. ARC (architecture) 6.EXT (package extention)
|
|
||||||
BUILD_PLATFORM=$1
|
BUILD_PLATFORM=$1
|
||||||
PLATFORM=$2
|
PLATFORM=$2
|
||||||
ARC=$3
|
ARC=$3
|
||||||
|
93
scripts/gitlab-test.sh
Normal file
93
scripts/gitlab-test.sh
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#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 master...$CI_BUILD_REF | grep ^js/ | wc -l)
|
||||||
|
export JS_OLD_FILES_MODIFIED=$(git --no-pager diff --name-only master...$CI_BUILD_REF | grep ^js-old/ | wc -l)
|
||||||
|
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)
|
||||||
|
export RUST_BACKTRACE=1
|
||||||
|
TEST=$1
|
||||||
|
rust_test () {
|
||||||
|
git submodule update --init --recursive
|
||||||
|
rustup show
|
||||||
|
if [ $RUST_FILES_MODIFIED -eq 0 ];
|
||||||
|
then echo "Skipping Rust tests since no Rust files modified.";
|
||||||
|
else ./test.sh $CARGOFLAGS;
|
||||||
|
fi
|
||||||
|
if [ "$CI_BUILD_REF_NAME" == "nightly" ];
|
||||||
|
then sh scripts/aura-test.sh;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
js_test () {
|
||||||
|
git submodule update --init --recursive
|
||||||
|
if [ $JS_FILES_MODIFIED -eq 0 ];
|
||||||
|
then echo "Skipping JS deps install since no JS files modified.";
|
||||||
|
else ./js/scripts/install-deps.sh;
|
||||||
|
fi
|
||||||
|
if [ $JS_OLD_FILES_MODIFIED -eq 0 ];
|
||||||
|
then echo "Skipping JS (old) deps install since no JS files modified.";
|
||||||
|
else ./js-old/scripts/install-deps.sh;
|
||||||
|
fi
|
||||||
|
if [ $JS_FILES_MODIFIED -eq 0 ];
|
||||||
|
then echo "Skipping JS lint since no JS files modified.";
|
||||||
|
else ./js/scripts/lint.sh && ./js/scripts/test.sh && ./js/scripts/build.sh;
|
||||||
|
fi
|
||||||
|
if [ $JS_OLD_FILES_MODIFIED -eq 0 ];
|
||||||
|
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;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
js_release () {
|
||||||
|
rustup default stable
|
||||||
|
echo $JS_FILES_MODIFIED
|
||||||
|
if [ $JS_FILES_MODIFIED -eq 0 ];
|
||||||
|
then echo "Skipping JS deps install since no JS files modified.";
|
||||||
|
else ./js/scripts/install-deps.sh;
|
||||||
|
fi
|
||||||
|
if [ $JS_FILES_MODIFIED -eq 0 ];
|
||||||
|
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
|
||||||
|
if [ $JS_OLD_FILES_MODIFIED -eq 0 ];
|
||||||
|
then echo "Skipping JS (old) deps install since no JS files modified.";
|
||||||
|
else ./js-old/scripts/install-deps.sh;
|
||||||
|
fi
|
||||||
|
if [ $JS_OLD_FILES_MODIFIED -eq 0 ];
|
||||||
|
then echo "Skipping JS (old) rebuild since no JS files modified.";
|
||||||
|
else ./js-old/scripts/build.sh && ./js-old/scripts/push-precompiled.sh;
|
||||||
|
fi
|
||||||
|
if [ $JS_FILES_MODIFIED -eq 0 ] && [ $JS_OLD_FILES_MODIFIED -eq 0 ];
|
||||||
|
then echo "Skipping Cargo update since no JS files modified.";
|
||||||
|
else ./js/scripts/push-cargo.sh;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
coverage_test () {
|
||||||
|
git submodule update --init --recursive
|
||||||
|
rm -rf target/*
|
||||||
|
rm -rf js/.coverage
|
||||||
|
scripts/cov.sh
|
||||||
|
}
|
||||||
|
case TEST in
|
||||||
|
stable)
|
||||||
|
rustup default stable
|
||||||
|
rust_test
|
||||||
|
;;
|
||||||
|
beta)
|
||||||
|
rustup default beta
|
||||||
|
rust_test
|
||||||
|
;;
|
||||||
|
nightly)
|
||||||
|
rustup default nightly
|
||||||
|
rust_test
|
||||||
|
;;
|
||||||
|
js-test)
|
||||||
|
js_test
|
||||||
|
;;
|
||||||
|
js-release)
|
||||||
|
js_release
|
||||||
|
;;
|
||||||
|
test-coverage)
|
||||||
|
coverage_test
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in New Issue
Block a user