|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | +set -x |
| 5 | + |
| 6 | +package=cwltest |
| 7 | +module=cwltest |
| 8 | +repo=https://github.com/common-workflow-language/cwltest.git |
| 9 | +run_tests="cwltest --help" |
| 10 | +pipver=8.0.1 # minimum required version of pip |
| 11 | +setupver=20.10.1 # minimum required version of setuptools |
| 12 | + |
| 13 | +rm -Rf testenv? || /bin/true |
| 14 | + |
| 15 | +export HEAD=`git rev-parse HEAD` |
| 16 | +virtualenv testenv1 |
| 17 | +virtualenv testenv2 |
| 18 | +virtualenv testenv3 |
| 19 | +virtualenv testenv4 |
| 20 | + |
| 21 | +# First we test the head |
| 22 | +source testenv1/bin/activate |
| 23 | +rm testenv1/lib/python-wheels/setuptools* \ |
| 24 | + && pip install --force-reinstall -U pip==${pipver} \ |
| 25 | + && pip install setuptools==${setupver} wheel |
| 26 | +make install-dependencies |
| 27 | +make test |
| 28 | +pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install |
| 29 | +mkdir testenv1/not-${module} |
| 30 | +# if there is a subdir named '${module}' py.test will execute tests |
| 31 | +# there instead of the installed module's tests |
| 32 | +pushd testenv1/not-${module}; ../bin/${run_tests}; popd |
| 33 | + |
| 34 | + |
| 35 | +# Secondly we test via pip |
| 36 | + |
| 37 | +cd testenv2 |
| 38 | +source bin/activate |
| 39 | +rm lib/python-wheels/setuptools* \ |
| 40 | + && pip install --force-reinstall -U pip==${pipver} \ |
| 41 | + && pip install setuptools==${setupver} wheel |
| 42 | +pip install -e git+${repo}@${HEAD}#egg=${package} |
| 43 | +cd src/${package} |
| 44 | +make install-dependencies |
| 45 | +make dist |
| 46 | +make test |
| 47 | +cp dist/${package}*tar.gz ../../../testenv3/ |
| 48 | +pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install |
| 49 | +cd ../.. # no subdir named ${proj} here, safe for py.testing the installed module |
| 50 | +bin/${run_tests} |
| 51 | + |
| 52 | +# Is the distribution in testenv2 complete enough to build another |
| 53 | +# functional distribution? |
| 54 | + |
| 55 | +cd ../testenv3/ |
| 56 | +source bin/activate |
| 57 | +rm lib/python-wheels/setuptools* \ |
| 58 | + && pip install --force-reinstall -U pip==${pipver} \ |
| 59 | + && pip install setuptools==${setupver} wheel |
| 60 | +pip install ${package}*tar.gz |
| 61 | +pip install pytest |
| 62 | +mkdir out |
| 63 | +tar --extract --directory=out -z -f ${package}*.tar.gz |
| 64 | +cd out/${package}* |
| 65 | +make dist |
| 66 | +make test |
| 67 | +pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install |
| 68 | +mkdir ../not-${module} |
| 69 | +pushd ../not-${module} ; ../../bin/${run_tests}; popd |
0 commit comments