Skip to content

Commit

Permalink
fix testing of PRs from forks; shellcheck clean (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c authored Jun 1, 2018
1 parent 37f1275 commit 4b02ff9
Showing 1 changed file with 36 additions and 23 deletions.
59 changes: 36 additions & 23 deletions release-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,72 @@ set -x

package=cwltest
module=cwltest
repo=https://github.com/common-workflow-language/cwltest.git
slug=${TRAVIS_PULL_REQUEST_SLUG:=common-workflow-language/cwltool}
repo=https://github.com/${slug}.git
run_tests="py.test --pyarg ${module}"
pipver=8.0.1 # minimum required version of pip
setupver=20.10.1 # minimum required version of setuptools
setuptoolsver=20.10.1 # minimum required version of setuptools
PYVER=${PYVER:=2.7}

rm -Rf testenv${PYVER}_? || /bin/true
rm -Rf "testenv${PYVER}_"? || /bin/true

export HEAD=${TRAVIS_PULL_REQUEST_SHA:-$(git rev-parse HEAD)}
if [ "${RELEASE_SKIP}" != "head" ]
then
virtualenv testenv${PYVER}_1 -p python${PYVER}
virtualenv "testenv${PYVER}_1" -p "python${PYVER}"
# First we test the head
# shellcheck source=/dev/null
source testenv${PYVER}_1/bin/activate
rm testenv${PYVER}_1/lib/python-wheels/setuptools* \
rm "testenv${PYVER}_1/lib/python-wheels/setuptools"* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setupver} wheel
&& pip install setuptools==${setuptoolsver} wheel
make install-dependencies
make test
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
mkdir testenv${PYVER}_1/not-${module}
mkdir "testenv${PYVER}_1/not-${module}"
# if there is a subdir named '${module}' py.test will execute tests
# there instead of the installed module's tests
pushd testenv${PYVER}_1/not-${module}; ../bin/${run_tests}; popd
pushd "testenv${PYVER}_1/not-${module}"
# shellcheck disable=SC2086
../bin/${run_tests}; popd
fi

virtualenv testenv${PYVER}_2 -p python${PYVER}
virtualenv testenv${PYVER}_3 -p python${PYVER}
virtualenv testenv${PYVER}_4 -p python${PYVER}
virtualenv testenv${PYVER}_5 -p python${PYVER}
virtualenv "testenv${PYVER}_2" -p "python${PYVER}"
virtualenv "testenv${PYVER}_3" -p "python${PYVER}"
virtualenv "testenv${PYVER}_4" -p "python${PYVER}"
virtualenv "testenv${PYVER}_5" -p "python${PYVER}"


# Secondly we test via pip

pushd testenv${PYVER}_2
pushd "testenv${PYVER}_2"
# shellcheck source=/dev/null
source bin/activate
rm lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setupver} wheel
pip install -e git+${repo}@${HEAD}#egg=${package}
&& pip install setuptools==${setuptoolsver} wheel
pip install -e "git+${repo}@${HEAD}#egg=${package}"
pushd src/${package}
make install-dependencies
make dist
make test
cp dist/${package}*tar.gz ../../../testenv${PYVER}_3/
cp dist/${package}*whl ../../../testenv${PYVER}_4/
cp dist/${package}*tar.gz "../../../testenv${PYVER}_3/"
cp dist/${package}*whl "../../../testenv${PYVER}_4/"
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
popd # ../.. no subdir named ${proj} here, safe for py.testing the installed module
# shellcheck disable=SC2086
bin/${run_tests}
popd

# Is the source distribution in testenv${PYVER}_2 complete enough to build
# another functional distribution?

pushd testenv${PYVER}_3/
pushd "testenv${PYVER}_3/"
# shellcheck source=/dev/null
source bin/activate
rm lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setupver} wheel
&& pip install setuptools==${setuptoolsver} wheel
pip install ${package}*tar.gz
pip install pytest
mkdir out
Expand All @@ -73,19 +80,25 @@ make dist
make test
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
mkdir ../not-${module}
pushd ../not-${module} ; ../../bin/${run_tests}; popd
pushd ../not-${module}
# shellcheck disable=SC2086
../../bin/${run_tests}
popd
popd
popd

# Is the wheel in testenv${PYVER}_2 installable and will it pass the tests

pushd testenv${PYVER}_4/
pushd "testenv${PYVER}_4/"
# shellcheck source=/dev/null
source bin/activate
rm lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setupver} wheel
&& pip install setuptools==${setuptoolsver} wheel
pip install ${package}*.whl
pip install pytest
mkdir not-${module}
pushd not-${module} ; ../bin/${run_tests}; popd
pushd not-${module}
# shellcheck disable=SC2086
../bin/${run_tests}; popd
popd

0 comments on commit 4b02ff9

Please sign in to comment.