Tests parallelized (#10452)
* tests splitted, phase 1 * typo * fix wrong launch commands * typos * rearrangements * use `nproc` function for threads * use nproc for threads * let theads be auto, build-andriod no more in regular run * split val chain and cargo check * renamed some files * wrong phase * check rust files before test jobs * lint error * rust files modivied var * test except changes * add rust_changes except * lint error * fixes * .gitlab-ci.yml can't be excluded * pipeline shouldn't start * pipeline must go * pipeline must go 2 * pipeline must go 3 * pipeline must go 4 * pipeline must go 5 * pipeline must go 6 * pipeline must go 7 * pipeline must not go 1 * pipeline must go 8 * avoid skippng tests yet, reintroducing them after the caching * test theory * parallelized cargo check with combusting helicopters * less uploads * alias for cargo checks * nice template
This commit is contained in:
parent
4320c9bc4f
commit
82a148a99b
@ -24,7 +24,6 @@ variables:
|
|||||||
- tags
|
- tags
|
||||||
- schedules
|
- schedules
|
||||||
|
|
||||||
|
|
||||||
.collect_artifacts: &collect_artifacts
|
.collect_artifacts: &collect_artifacts
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "${CI_JOB_NAME}_${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
|
name: "${CI_JOB_NAME}_${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
|
||||||
@ -33,34 +32,66 @@ variables:
|
|||||||
paths:
|
paths:
|
||||||
- artifacts/
|
- artifacts/
|
||||||
|
|
||||||
test-linux:
|
.docker-cache-status: &docker-cache-status
|
||||||
stage: test
|
dependencies: []
|
||||||
variables:
|
before_script:
|
||||||
RUN_TESTS: all
|
- sccache -s
|
||||||
script:
|
after_script:
|
||||||
- scripts/gitlab/test-all.sh
|
|
||||||
- sccache -s
|
- sccache -s
|
||||||
tags:
|
tags:
|
||||||
- linux-docker
|
- linux-docker
|
||||||
|
|
||||||
test-audit:
|
|
||||||
|
cargo-check 0 3:
|
||||||
|
stage: test
|
||||||
|
<<: *docker-cache-status
|
||||||
|
script:
|
||||||
|
- time cargo check --target $CARGO_TARGET --locked --no-default-features
|
||||||
|
|
||||||
|
cargo-check 1 3:
|
||||||
|
stage: test
|
||||||
|
<<: *docker-cache-status
|
||||||
|
script:
|
||||||
|
- time cargo check --target $CARGO_TARGET --locked --manifest-path util/io/Cargo.toml --no-default-features
|
||||||
|
|
||||||
|
cargo-check 2 3:
|
||||||
|
stage: test
|
||||||
|
<<: *docker-cache-status
|
||||||
|
script:
|
||||||
|
- time cargo check --target $CARGO_TARGET --locked --manifest-path util/io/Cargo.toml --features "mio"
|
||||||
|
|
||||||
|
cargo-audit:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- set -e
|
|
||||||
- set -u
|
|
||||||
- cargo audit
|
- cargo audit
|
||||||
tags:
|
tags:
|
||||||
- linux-docker
|
- linux-docker
|
||||||
|
|
||||||
|
validate-chainspecs:
|
||||||
|
stage: test
|
||||||
|
<<: *docker-cache-status
|
||||||
|
script:
|
||||||
|
- ./scripts/gitlab/validate-chainspecs.sh
|
||||||
|
|
||||||
|
test-cpp:
|
||||||
|
stage: build
|
||||||
|
<<: *docker-cache-status
|
||||||
|
script:
|
||||||
|
- ./scripts/gitlab/test-cpp.sh
|
||||||
|
|
||||||
|
test-linux:
|
||||||
|
stage: build
|
||||||
|
<<: *docker-cache-status
|
||||||
|
script:
|
||||||
|
- ./scripts/gitlab/test-linux.sh
|
||||||
|
|
||||||
build-linux: &build-linux
|
build-linux: &build-linux
|
||||||
stage: build
|
stage: build
|
||||||
only: *releaseable_branches
|
only: *releaseable_branches
|
||||||
|
<<: *docker-cache-status
|
||||||
script:
|
script:
|
||||||
- scripts/gitlab/build-unix.sh
|
- scripts/gitlab/build-linux.sh
|
||||||
- sccache -s
|
|
||||||
<<: *collect_artifacts
|
<<: *collect_artifacts
|
||||||
tags:
|
|
||||||
- linux-docker
|
|
||||||
|
|
||||||
build-linux-i386:
|
build-linux-i386:
|
||||||
<<: *build-linux
|
<<: *build-linux
|
||||||
@ -88,7 +119,7 @@ build-darwin:
|
|||||||
CC: gcc
|
CC: gcc
|
||||||
CXX: g++
|
CXX: g++
|
||||||
script:
|
script:
|
||||||
- scripts/gitlab/build-unix.sh
|
- scripts/gitlab/build-linux.sh
|
||||||
tags:
|
tags:
|
||||||
- rust-osx
|
- rust-osx
|
||||||
<<: *collect_artifacts
|
<<: *collect_artifacts
|
||||||
@ -203,14 +234,12 @@ publish-docs:
|
|||||||
- linux-docker
|
- linux-docker
|
||||||
|
|
||||||
build-android:
|
build-android:
|
||||||
stage: optional
|
stage: build
|
||||||
image: parity/rust-android:gitlab-ci
|
image: parity/rust-android:gitlab-ci
|
||||||
variables:
|
variables:
|
||||||
CARGO_TARGET: armv7-linux-androideabi
|
CARGO_TARGET: armv7-linux-androideabi
|
||||||
dependencies: []
|
|
||||||
script:
|
script:
|
||||||
- scripts/gitlab/build-unix.sh
|
- scripts/gitlab/build-linux.sh
|
||||||
tags:
|
tags:
|
||||||
- linux-docker
|
- linux-docker
|
||||||
allow_failure: true
|
|
||||||
<<: *collect_artifacts
|
<<: *collect_artifacts
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
echo "________Running rust_changes.sh________"
|
||||||
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
|
||||||
|
|
||||||
|
echo "__________Checking if Rust files were changed__________"
|
||||||
git log --graph --oneline --decorate=short -n 10
|
git log --graph --oneline --decorate=short -n 10
|
||||||
|
|
||||||
case ${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}} in
|
case ${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}} in
|
||||||
@ -26,5 +28,3 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
rustup show
|
rustup show
|
||||||
|
|
||||||
exec ./test.sh
|
|
17
scripts/gitlab/test-cpp.sh
Executable file
17
scripts/gitlab/test-cpp.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "________Running test-cpp.sh________"
|
||||||
|
set -e # fail on any error
|
||||||
|
set -u # treat unset variables as error
|
||||||
|
#use nproc `linux only
|
||||||
|
THREADS=$(nproc)
|
||||||
|
|
||||||
|
echo "________Running the C++ example________"
|
||||||
|
DIR=parity-clib/examples/cpp/build
|
||||||
|
mkdir -p $DIR
|
||||||
|
cd $DIR
|
||||||
|
cmake ..
|
||||||
|
make -j $THREADS
|
||||||
|
# Note: we don't try to run the example because it tries to sync Kovan, and we don't want
|
||||||
|
# that to happen on CI
|
||||||
|
cd -
|
||||||
|
rm -rf $DIR
|
12
scripts/gitlab/test-linux.sh
Executable file
12
scripts/gitlab/test-linux.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "________Running test-linux.sh________"
|
||||||
|
set -e # fail on any error
|
||||||
|
set -u # treat unset variables as error
|
||||||
|
|
||||||
|
FEATURES="json-tests,ci-skip-tests"
|
||||||
|
OPTIONS="--release"
|
||||||
|
#use nproc `linux only
|
||||||
|
THREADS=$(nproc)
|
||||||
|
|
||||||
|
echo "________Running Parity Full Test Suite________"
|
||||||
|
time cargo test $OPTIONS --features "$FEATURES" --locked --all --target $CARGO_TARGET -- --test-threads $THREADS
|
@ -1,7 +1,12 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/bash
|
||||||
|
set -e # fail on any error
|
||||||
|
set -u # treat unset variables as error
|
||||||
|
echo "________Running validate_chainspecs.sh________"
|
||||||
|
|
||||||
ERR=0
|
ERR=0
|
||||||
cargo build --release -p chainspec
|
|
||||||
|
echo "________Validate chainspecs________"
|
||||||
|
time cargo build --release -p chainspec
|
||||||
|
|
||||||
for spec in ethcore/res/*.json; do
|
for spec in ethcore/res/*.json; do
|
||||||
if ! ./target/release/chainspec "$spec"; then ERR=1; fi
|
if ! ./target/release/chainspec "$spec"; then ERR=1; fi
|
79
test.sh
79
test.sh
@ -1,79 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Running Parity Full Test Suite
|
|
||||||
echo "________Running test.sh________"
|
|
||||||
|
|
||||||
FEATURES="json-tests,ci-skip-tests"
|
|
||||||
OPTIONS="--release"
|
|
||||||
VALIDATE=1
|
|
||||||
THREADS=8
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
|
|
||||||
validate () {
|
|
||||||
if [ "$VALIDATE" -eq "1" ]
|
|
||||||
then
|
|
||||||
echo "________Validate build________"
|
|
||||||
time cargo check $@ --locked --no-default-features
|
|
||||||
time cargo check $@ --locked --manifest-path util/io/Cargo.toml --no-default-features
|
|
||||||
time cargo check $@ --locked --manifest-path util/io/Cargo.toml --features "mio"
|
|
||||||
|
|
||||||
# Validate chainspecs
|
|
||||||
echo "________Validate chainspecs________"
|
|
||||||
time ./scripts/validate_chainspecs.sh
|
|
||||||
else
|
|
||||||
echo "# not validating due to \$VALIDATE!=1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
cpp_test () {
|
|
||||||
case $CARGO_TARGET in
|
|
||||||
(x86_64-unknown-linux-gnu)
|
|
||||||
# Running the C++ example
|
|
||||||
echo "________Running the C++ example________"
|
|
||||||
DIR=parity-clib/examples/cpp/build
|
|
||||||
mkdir -p $DIR
|
|
||||||
cd $DIR
|
|
||||||
cmake ..
|
|
||||||
make -j $THREADS
|
|
||||||
# Note: we don't try to run the example because it tries to sync Kovan, and we don't want
|
|
||||||
# that to happen on CI
|
|
||||||
cd -
|
|
||||||
rm -rf $DIR
|
|
||||||
;;
|
|
||||||
(*)
|
|
||||||
echo "________Skipping the C++ example________"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
cargo_test () {
|
|
||||||
echo "________Running Parity Full Test Suite________"
|
|
||||||
git submodule update --init --recursive
|
|
||||||
time cargo test $OPTIONS --features "$FEATURES" --locked --all $@ -- --test-threads $THREADS
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$CARGO_TARGET" ]
|
|
||||||
then
|
|
||||||
validate --target $CARGO_TARGET
|
|
||||||
else
|
|
||||||
validate
|
|
||||||
fi
|
|
||||||
|
|
||||||
test "${RUN_TESTS}" = "all" && cpp_test
|
|
||||||
|
|
||||||
if [ "$CARGO_TARGET" ]
|
|
||||||
then
|
|
||||||
|
|
||||||
case "${RUN_TESTS}" in
|
|
||||||
(cargo|all)
|
|
||||||
cargo_test --target $CARGO_TARGET $@
|
|
||||||
;;
|
|
||||||
('')
|
|
||||||
cargo_test --no-run --target $CARGO_TARGET $@
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
cargo_test $@
|
|
||||||
fi
|
|
Loading…
Reference in New Issue
Block a user