PageRenderTime 42ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/scripts/test_drone.io.sh

https://bitbucket.org/breisfeld/rpy2_w32_fix
Shell | 129 lines | 83 code | 20 blank | 26 comment | 11 complexity | 0afbb7985142d9927d19d1b4c656234d MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
  1. #!/bin/bash
  2. #
  3. # Test script for the Continuous Integration server drone.io
  4. LOGFILE=`pwd`/'ci.log'
  5. # Define the versions of Python that should be tested
  6. #PYTHON_VERSIONS="2.7 3.3 3.4"
  7. #PYTHON_VERSIONS="3.4"
  8. PYTHON_VERSIONS="2.7 3.4"
  9. # Define the target Numpy versions
  10. NUMPY_VERSIONS="1.9.2"
  11. # Settings to install python packages as wheels
  12. DEPS_DIR="deps/"
  13. WHEEL_DIR=${DEPS_DIR}"wheelhouse/"
  14. mkdir -p ${WHEEL_DIR}
  15. PIPWITHWHEEL_ARGS=" -w $WHEEL_DIR --use-wheel --find-links=file://$WHEEL_DIR"
  16. # Color escape codes
  17. GREEN='\e[0;32m'
  18. RED='\e[0;31m'
  19. NC='\e[0m'
  20. echo "CI on drone.io" > ${LOGFILE}
  21. # make debconf silent
  22. export DEBIAN_FRONTEND=noninteractive
  23. # Install R, ipython, and pandas
  24. # Ensure that we get recent versions
  25. echo -n "Installing packages with APT..."
  26. sudo add-apt-repository ppa:marutter/rrutter >> ${LOGFILE}
  27. sudo add-apt-repository ppa:marutter/c2d4u >> ${LOGFILE}
  28. #sudo add-apt-repository ppa:jtaylor/ipython >> ${LOGFILE}
  29. #sudo add-apt-repository ppa:pythonxy/pythonxy-devel > ${LOGFILE}
  30. sudo apt-get -y update &>> ${LOGFILE}
  31. sudo apt-get -qq -y install r-base \
  32. r-cran-ggplot2 \
  33. libatlas-dev \
  34. libatlas3gf-base \
  35. liblapack-dev \
  36. gfortran &>> ${LOGFILE};
  37. #sudo apt-get -qq -y install pandas >> ${LOGFILE}
  38. echo "[done]"
  39. # Install r-cran packages ggplot2 and Cairo
  40. echo -n "Installing R packages..."
  41. export R_LIBS_USER="$HOME/rlibs/"
  42. mkdir -p $R_LIBS_USER
  43. R --slave -e 'install.packages(c("Cairo"), repos="http://cran.us.r-project.org")' &>> ${LOGFILE}
  44. echo "[done]"
  45. STATUS=0
  46. summary=()
  47. # Launch tests for each Python version
  48. for PYVERSION in $PYTHON_VERSIONS; do
  49. echo -e "${GREEN}Test with Python $PYVERSION ${NC}"
  50. sudo apt-get -qq -y install python$PYVERSION python${PYVERSION}-dev
  51. # Create a new virtualenv
  52. virtualenv --python=python$PYVERSION env-$PYVERSION/ >> ${LOGFILE}
  53. source env-$PYVERSION/bin/activate
  54. # Upgrade pip and install wheel
  55. pip install setuptools --upgrade >> ${LOGFILE}
  56. pip install -I pip >> ${LOGFILE}
  57. pip install -I wheel >> ${LOGFILE}
  58. for NPVERSION in $NUMPY_VERSIONS; do
  59. echo -e "${GREEN} Numpy version $NPVERSION ${NC}"
  60. echo "Installing packages:"
  61. for package in numpy==$NPVERSION pandas ipython; do
  62. echo " $package";
  63. pip install --use-wheel \
  64. --find-links https://cache27diy-cpycloud.rhcloud.com/$PYVERSION \
  65. $package >> ${LOGFILE};
  66. done
  67. if [ '2.7' = $PYVERSION ]; then
  68. echo " singledispatch"
  69. pip install singledispatch >> ${LOGFILE}
  70. fi;
  71. if [ '3.3' = $PYVERSION ]; then
  72. echo " singledispatch"
  73. pip install singledispatch >> ${LOGFILE}
  74. fi;
  75. echo '.'
  76. #pip install --use-wheel --find-links https://cache27diy-cpycloud.rhcloud.com/$PYVERSION cython
  77. echo "Building rpy2"
  78. # Build rpy2
  79. rpy2build=`python setup.py sdist | tail -n 1 | grep -Po "removing \\'\K[^\\']*"`
  80. # Install it (so we also test that the source package is correctly built)
  81. pip install dist/${rpy2build}.tar.gz
  82. #DEBUG
  83. #python -c 'import rpy2.ipython'
  84. # Launch tests
  85. python -m rpy2.tests
  86. # Success if passing the tests in at least one configuration
  87. if [ $? -eq 0 ]; then
  88. msg="${GREEN}Tests PASSED for Python ${PYVERSION} / Numpy ${NPVERSION} ${NC}"
  89. echo -e $msg
  90. summary+=("$msg")
  91. STATUS=1
  92. else
  93. msg="${RED}Tests FAILED for Python ${PYVERSION} / Numpy ${NPVERSION} ${NC}"
  94. echo -e $msg
  95. summary+=("$msg")
  96. ((STATUS = 0 || $STATUS))
  97. fi
  98. done
  99. done
  100. echo '=========='
  101. for ((i = 0; i < ${#summary[@]}; i++))
  102. do
  103. echo -e ${summary[$i]}
  104. done
  105. if [ $STATUS -eq 1 ]; then
  106. exit 0;
  107. else
  108. exit 1;
  109. fi