reconfigure running of rust and python tests

This commit is contained in:
holger krekel
2019-11-21 01:21:23 +01:00
parent e13ce3140b
commit 8e7dc5e86f
6 changed files with 107 additions and 23 deletions

42
ci_scripts/remote_tests.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/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

33
ci_scripts/run-python-test.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
#
# Run Python functional test for Delta Chat core.
#
set -e -x
# build the core library
cargo build --release -p deltachat_ffi --target=$TARGET
# Statically link against libdeltachat.a.
export DCC_RS_DEV=$(pwd)
cd python
# remove and inhibit writing PYC files
rm -rf tests/__pycache__
rm -rf src/deltachat/__pycache__
export PYTHONDONTWRITEBYTECODE=1
# run tox. The circle-ci project env-var-setting DCC_PY_LIVECONFIG
# allows running of "liveconfig" tests but for speed reasons
# we run them only for the highest python version we support
# 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"
tox -e py37 -- --reruns 5 -k "qr"
unset DCC_PY_LIVECONFIG
tox -p4 -e lint,py35,py36,doc

View File

@@ -10,7 +10,8 @@ export OPT_RELEASE="--release ${OPT}"
export OPT_FFI_RELEASE="--manifest-path=deltachat-ffi/Cargo.toml --release"
# Select cargo command: use cross by default
export CARGO_CMD=cross
# export CARGO_CMD=cross
export CARGO_CMD=cargo
# On Appveyor (windows) and Travis (x86_64-unknown-linux-gnu and apple) native targets we use cargo (no need to cross-compile):
if [[ $TARGET = *"windows"* ]] || [[ $TARGET == "x86_64-unknown-linux-gnu" ]] || [[ $TARGET = *"apple"* ]]; then
@@ -18,9 +19,9 @@ if [[ $TARGET = *"windows"* ]] || [[ $TARGET == "x86_64-unknown-linux-gnu" ]] ||
fi
# Install cross if necessary:
if [[ $CARGO_CMD == "cross" ]]; then
cargo install --git https://github.com/dignifiedquire/cross --rev fix-tty --force
fi
#if [[ $CARGO_CMD == "cross" ]]; then
# cargo install --git https://github.com/dignifiedquire/cross --rev fix-tty --force
##fi
# Make sure TARGET is installed when using cargo:
if [[ $CARGO_CMD == "cargo" ]]; then
@@ -32,8 +33,8 @@ if [[ $NORUN == "1" ]]; then
export CARGO_SUBCMD="build"
else
export CARGO_SUBCMD="test --all"
export OPT="-j1 ${OPT} "
export OPT_RELEASE="-j2 ${OPT_RELEASE} "
export OPT="${OPT} "
export OPT_RELEASE="${OPT_RELEASE} "
export OPT_RELEASE_IGNORED="${OPT_RELEASE} -- --ignored"
fi