various cleanups, better parallelism and build-dir structure

This commit is contained in:
holger krekel
2019-11-21 13:56:15 +01:00
parent 590fd53dd4
commit 932c86bb3b
9 changed files with 118 additions and 64 deletions

View File

@@ -1,42 +0,0 @@
#!/bin/bash
export BRANCH=${CIRCLE_BRANCH:?branch to build}
GITURL=https://github.com/deltachat/deltachat-core-rust
ssh -oStrictHostKeyChecking=no ci@b1.delta.chat <<_HERE
set -xe
mkdir -p $BRANCH
cd $BRANCH/
echo "--------------------------------------------------"
echo " Checkout"
echo "--------------------------------------------------"
if [ -d "deltachat-core-rust" ] ; then
cd deltachat-core-rust
git fetch origin
git clean -q -fd
git checkout $BRANCH
git reset --hard origin/$BRANCH
else
git clone $GITURL
cd deltachat-core-rust
git checkout $BRANCH
fi
export TARGET=x86_64-unknown-linux-gnu
echo "--------------------------------------------------"
echo " running rust tests"
echo "--------------------------------------------------"
bash ci_scripts/run-rust-test.sh
echo "--------------------------------------------------"
echo " running python tests"
echo "--------------------------------------------------"
virtualenv -p python3.7 venv
source venv/bin/activate
export DCC_PY_LIVECONFIG=$DCC_PY_LIVECONFIG
export CARGO_TARGET_DIR=\`pwd\`/target-py
pip install -q tox virtualenv
bash ci_scripts/run-python-test.sh
_HERE

View File

@@ -0,0 +1,41 @@
#!/bin/bash
export BRANCH=${CIRCLE_BRANCH:?branch to build}
export GITURL=${CIRCLE_REPOSITORY_URL:?git url of core-rust repo}
export SSHTARGET=ci@b1.delta.chat
# we construct the BUILDDIR such that we can easily share the
# CARGO_TARGET_DIR between runs ("..")
export BUILDDIR=ci_builds/$BRANCH/${CIRCLE_JOB:?jobname}/${CIRCLE_BUILD_NUM:?circle-build-number}
set -e
echo "--- Copying files to $SSHTARGET:$BUILDDIR"
ssh -oStrictHostKeyChecking=no $SSHTARGET mkdir -p "$BUILDDIR"
git ls-tree -r $BRANCH -r --name-only >.rsynclist
rsync --files-from=.rsynclist -az ./ "$SSHTARGET:$BUILDDIR"
# we seem to need .git for setuptools_scm versioning
rsync -az .git "$SSHTARGET:$BUILDDIR"
echo "--- Running $CIRCLE_JOB remotely"
ssh $SSHTARGET <<_HERE
set +x -e
cd $BUILDDIR
# let's share the target dir with our last run on this branch/job-type
# cargo will make sure to block/unblock us properly
export CARGO_TARGET_DIR=\`pwd\`/../target
export TARGET=x86_64-unknown-linux-gnu
export RUSTC_WRAPPER=sccache
export DCC_PY_LIVECONFIG=$DCC_PY_LIVECONFIG
rm -rf virtualenv venv
virtualenv -q -p python3.7 venv
source venv/bin/activate
set -x
pip install -q tox virtualenv
bash ci_scripts/run-python-test.sh
_HERE

33
ci_scripts/remote_tests_rust.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
export BRANCH=${CIRCLE_BRANCH:?branch to build}
export GITURL=${CIRCLE_REPOSITORY_URL:?git url of core-rust repo}
export SSHTARGET=ci@b1.delta.chat
# we construct the BUILDDIR such that we can easily share the
# CARGO_TARGET_DIR between runs ("..")
export BUILDDIR=ci_builds/$BRANCH/${CIRCLE_JOB:?jobname}/${CIRCLE_BUILD_NUM:?circle-build-number}
set -e
echo "--- Copying files to $SSHTARGET:$BUILDDIR"
ssh -oStrictHostKeyChecking=no $SSHTARGET mkdir -p "$BUILDDIR"
git ls-tree -r $BRANCH -r --name-only >.rsynclist
rsync --files-from=.rsynclist -az ./ "$SSHTARGET:$BUILDDIR"
echo "--- Running $CIRCLE_JOB remotely"
ssh $SSHTARGET <<_HERE
set +x -e
cd $BUILDDIR
# let's share the target dir with our last run on this branch/job-type
# cargo will make sure to block/unblock us properly
export CARGO_TARGET_DIR=\`pwd\`/../target
export TARGET=x86_64-unknown-linux-gnu
export RUSTC_WRAPPER=sccache
bash ci_scripts/run-rust-test.sh
_HERE

View File

@@ -1,32 +1,32 @@
#!/bin/bash
#
# Run Python functional test for Delta Chat core.
#
# Run functional tests for Delta Chat core using the python bindings
# and tox/pytest.
set -e -x
set -e +x
# build the core library
cargo build --release -p deltachat_ffi --target=$TARGET
# make sure we have proper settings to run Online tests
X=${DCC_PY_LIVECONFIG:?need env var to run Online tests}
set -x
# Statically link against libdeltachat.a.
export DCC_RS_DEV=$(pwd)
# for core-building and python install step
export DCC_RS_TARGET=release
export DCC_RS_DEV=`pwd`
cd python
python install_python_bindings.py
# remove and inhibit writing PYC files
rm -rf tests/__pycache__
rm -rf src/deltachat/__pycache__
export PYTHONDONTWRITEBYTECODE=1
# make sure we have proper settings to run Online tests
X=${DCC_PY_LIVECONFIG:?need env var to run Online tests}
# run python tests (tox invokes pytest to run tests in python/tests)
# we split out qr-tests run to minimize likelyness of flaky tests
# (some qr tests are pretty heavy in terms of send/received
# messages and async-imap's likely has concurrency problems,
# eg https://github.com/async-email/async-imap/issues/4 )
tox -e lint,py37 -- --reruns 3 -k "not qr" tests/
tox -e py37 -- --reruns 5 -k "qr" tests/
tox -e lint,py37
unset DCC_PY_LIVECONFIG

View File

@@ -2,7 +2,7 @@
set -ex
export RUST_TEST_THREADS=1
#export RUST_TEST_THREADS=1
export RUST_BACKTRACE=1
export RUSTFLAGS='--deny warnings'
export OPT="--target=$TARGET"
@@ -38,7 +38,9 @@ else
export OPT_RELEASE_IGNORED="${OPT_RELEASE} -- --ignored"
fi
# Run all the test configurations:
# Run all the test configurations
# RUSTC_WRAPPER=SCCACHE seems to destroy parallelism / prolong the test
unset RUSTC_WRAPPER
$CARGO_CMD $CARGO_SUBCMD $OPT
$CARGO_CMD $CARGO_SUBCMD $OPT_RELEASE
$CARGO_CMD $CARGO_SUBCMD $OPT_RELEASE_IGNORED