Commit 72c18e73 authored by 0dminnimda's avatar 0dminnimda Committed by GitHub

Improve ci-run.sh (GH-4398)

parent 454a4985
......@@ -3,28 +3,36 @@
GCC_VERSION=${GCC_VERSION:=8}
# Set up compilers
if [ "${OS_NAME##ubuntu*}" == "" -a "$TEST_CODE_STYLE" != "1" ]; then
if [ "$TEST_CODE_STYLE" == "1" ]; then
echo "Skipping compiler setup"
elif [ "${OSTYPE##linux-gnu*}" == "" ]; then
echo "Setting up linux compiler"
echo "Installing requirements [apt]"
sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
sudo apt update -y -q
sudo apt install -y -q ccache gdb python-dbg python3-dbg gcc-$GCC_VERSION || exit 1
ALTERNATIVE_ARGS=""
if [ -z "${BACKEND##*cpp*}" ]; then
sudo apt install -y -q g++-$GCC_VERSION || exit 1
ALTERNATIVE_ARGS="--slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION"
fi
sudo /usr/sbin/update-ccache-symlinks
echo "/usr/lib/ccache" >> $GITHUB_PATH # export ccache to path
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 60 $(if [ -z "${BACKEND##*cpp*}" ]; then echo " --slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION"; fi)
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 60 $ALTERNATIVE_ARGS
export CC="gcc"
if [ -z "${BACKEND##*cpp*}" ]; then
sudo update-alternatives --set g++ /usr/bin/g++-$GCC_VERSION
export CXX="g++"
fi
fi
if [ "${OS_NAME##macos*}" == "" ]; then
elif [ "${OSTYPE##darwin*}" == "" ]; then
echo "Setting up macos compiler"
export CC="clang -Wno-deprecated-declarations"
export CXX="clang++ -stdlib=libc++ -Wno-deprecated-declarations"
else
echo "No setup specified for $OSTYPE"
fi
# Set up miniconda
......@@ -35,11 +43,13 @@ if [ "$STACKLESS" == "true" ]; then
conda install --quiet --yes stackless || exit 1
fi
PYTHON_SYS_VERSION=$(python -c 'import sys; print(sys.version)')
# Log versions in use
echo "===================="
echo "|VERSIONS INSTALLED|"
echo "===================="
python -c 'import sys; print("Python %s" % (sys.version,))'
echo "Python $PYTHON_SYS_VERSION"
if [ "$CC" ]; then
which ${CC%% *}
${CC%% *} --version
......@@ -61,7 +71,7 @@ elif [ -z "${PYTHON_VERSION##3.[45]*}" ]; then
else
python -m pip install -U pip setuptools wheel || exit 1
if [ -n "${PYTHON_VERSION##*-dev}" ]; then
if [ -n "${PYTHON_VERSION##*-dev}" -o "$COVERAGE" == "1" ]; then
python -m pip install -r test-requirements.txt || exit 1
if [ "${PYTHON_VERSION##pypy*}" -a "${PYTHON_VERSION##3.[4789]*}" ]; then
......@@ -74,7 +84,7 @@ if [ "$TEST_CODE_STYLE" == "1" ]; then
STYLE_ARGS="--no-unit --no-doctest --no-file --no-pyregr --no-examples";
python -m pip install -r doc-requirements.txt || exit 1
else
STYLE_ARGS="--no-code-style";
STYLE_ARGS="--no-code-style"
# Install more requirements
if [ -n "${PYTHON_VERSION##*-dev}" ]; then
......@@ -83,24 +93,45 @@ else
# python -m pip install pythran==0.9.5 || exit 1
fi
if [ "$BACKEND" != "cpp" -a -n "${PYTHON_VERSION##pypy*}" -a -n "${PYTHON_VERSION##2*}" -a -n "${PYTHON_VERSION##*3.4}" ]; then
if [ "$BACKEND" != "cpp" -a -n "${PYTHON_VERSION##pypy*}" -a
-n "${PYTHON_VERSION##2*}" -a -n "${PYTHON_VERSION##3.4*}" ]; then
python -m pip install mypy || exit 1
fi
fi
fi
# Run tests
echo "==== Running tests ===="
ccache -s 2>/dev/null || true
export PATH="/usr/lib/ccache:$PATH"
# Most modern compilers allow the last conflicting option
# to override the previous ones, so '-O0 -O3' == '-O3'
# This is true for the latest msvc, gcc and clang
CFLAGS="-O0 -ggdb -Wall -Wextra"
if [ "$NO_CYTHON_COMPILE" != "1" -a -n "${PYTHON_VERSION##pypy*}" ]; then
CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" \
python setup.py build_ext -i \
$(if [ "$COVERAGE" == "1" ]; then echo " --cython-coverage"; fi) \
$(if [ "$CYTHON_COMPILE_ALL" == "1" ]; then echo " --cython-compile-all"; fi) \
$(python -c 'import sys; print("-j5" if sys.version_info >= (3,5) else "")') \
|| exit 1
if [ -z "$COVERAGE" -a -z "$STACKLESS" -a -z "$LIMITED_API" -a -z "$CYTHON_COMPILE_ALL" -a -z "$EXTRA_CFLAGS" -a -n "${BACKEND//*cpp*}" ]; then
BUILD_CFLAGS="$CFLAGS -O2"
if [[ $PYTHON_SYS_VERSION == "2"* ]]; then
BUILD_CFLAGS="$BUILD_CFLAGS -fno-strict-aliasing"
fi
SETUP_ARGS=""
if [ "$COVERAGE" == "1" ]; then
SETUP_ARGS="$SETUP_ARGS --cython-coverage"
fi
if [ "$CYTHON_COMPILE_ALL" == "1" ]; then
SETUP_ARGS="$SETUP_ARGS --cython-compile-all"
fi
SETUP_ARGS="$SETUP_ARGS
$(python -c 'import sys; print("-j5" if sys.version_info >= (3,5) else "")')"
CFLAGS=$BUILD_CFLAGS \
python setup.py build_ext -i $SETUP_ARGS || exit 1
if [ -z "$COVERAGE" -a -z "$STACKLESS" -a -n "${BACKEND//*cpp*}" -a
-z "$LIMITED_API" -a -z "$CYTHON_COMPILE_ALL" -a -z "$EXTRA_CFLAGS" ]; then
python setup.py bdist_wheel || exit 1
fi
fi
......@@ -108,20 +139,32 @@ fi
if [ "$TEST_CODE_STYLE" == "1" ]; then
make -C docs html || exit 1
elif [ -n "${PYTHON_VERSION##pypy*}" ]; then
# Run the debugger tests in python-dbg if available (but don't fail, because they currently do fail)
PYTHON_DBG="python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg"
if $PYTHON_DBG -V >&2; then CFLAGS="-O0 -ggdb" $PYTHON_DBG runtests.py -vv --no-code-style Debugger --backends=$BACKEND; fi;
# Run the debugger tests in python-dbg if available
# (but don't fail, because they currently do fail)
PYTHON_DBG=$(python -c 'import sys; print("%d.%d" % sys.version_info[:2])')
PYTHON_DBG="python$PYTHON_DBG-dbg"
if $PYTHON_DBG -V >&2; then
CFLAGS=$CFLAGS $PYTHON_DBG \
runtests.py -vv --no-code-style Debugger --backends=$BACKEND
fi
fi
RUNTESTS_ARGS=""
if [ "$COVERAGE" == "1" ]; then
RUNTESTS_ARGS="$RUNTESTS_ARGS --coverage --coverage-html --cython-only"
fi
if [ -z "$TEST_CODE_STYLE" ]; then
RUNTESTS_ARGS="$RUNTESTS_ARGS -j7"
fi
export CFLAGS="-O0 -ggdb -Wall -Wextra $EXTRA_CFLAGS"
export CFLAGS="$CFLAGS $EXTRA_CFLAGS"
python runtests.py \
-vv $STYLE_ARGS \
-x Debugger \
--backends=$BACKEND \
$LIMITED_API \
$EXCLUDE \
$(if [ "$COVERAGE" == "1" ]; then echo " --coverage --coverage-html --cython-only"; fi) \
$(if [ -z "$TEST_CODE_STYLE" ]; then echo " -j7 "; fi)
$LIMITED_API \
$EXCLUDE \
$RUNTESTS_ARGS
EXIT_CODE=$?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment