Skip to content

Commit 4b02ff9

Browse files
authored
fix testing of PRs from forks; shellcheck clean (#75)
1 parent 37f1275 commit 4b02ff9

File tree

1 file changed

+36
-23
lines changed

1 file changed

+36
-23
lines changed

release-test.sh

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,72 @@ set -x
55

66
package=cwltest
77
module=cwltest
8-
repo=https://github.com/common-workflow-language/cwltest.git
8+
slug=${TRAVIS_PULL_REQUEST_SLUG:=common-workflow-language/cwltool}
9+
repo=https://github.com/${slug}.git
910
run_tests="py.test --pyarg ${module}"
1011
pipver=8.0.1 # minimum required version of pip
11-
setupver=20.10.1 # minimum required version of setuptools
12+
setuptoolsver=20.10.1 # minimum required version of setuptools
1213
PYVER=${PYVER:=2.7}
1314

14-
rm -Rf testenv${PYVER}_? || /bin/true
15+
rm -Rf "testenv${PYVER}_"? || /bin/true
1516

1617
export HEAD=${TRAVIS_PULL_REQUEST_SHA:-$(git rev-parse HEAD)}
1718
if [ "${RELEASE_SKIP}" != "head" ]
1819
then
19-
virtualenv testenv${PYVER}_1 -p python${PYVER}
20+
virtualenv "testenv${PYVER}_1" -p "python${PYVER}"
2021
# First we test the head
22+
# shellcheck source=/dev/null
2123
source testenv${PYVER}_1/bin/activate
22-
rm testenv${PYVER}_1/lib/python-wheels/setuptools* \
24+
rm "testenv${PYVER}_1/lib/python-wheels/setuptools"* \
2325
&& pip install --force-reinstall -U pip==${pipver} \
24-
&& pip install setuptools==${setupver} wheel
26+
&& pip install setuptools==${setuptoolsver} wheel
2527
make install-dependencies
2628
make test
2729
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
28-
mkdir testenv${PYVER}_1/not-${module}
30+
mkdir "testenv${PYVER}_1/not-${module}"
2931
# if there is a subdir named '${module}' py.test will execute tests
3032
# there instead of the installed module's tests
31-
pushd testenv${PYVER}_1/not-${module}; ../bin/${run_tests}; popd
33+
pushd "testenv${PYVER}_1/not-${module}"
34+
# shellcheck disable=SC2086
35+
../bin/${run_tests}; popd
3236
fi
3337

34-
virtualenv testenv${PYVER}_2 -p python${PYVER}
35-
virtualenv testenv${PYVER}_3 -p python${PYVER}
36-
virtualenv testenv${PYVER}_4 -p python${PYVER}
37-
virtualenv testenv${PYVER}_5 -p python${PYVER}
38+
virtualenv "testenv${PYVER}_2" -p "python${PYVER}"
39+
virtualenv "testenv${PYVER}_3" -p "python${PYVER}"
40+
virtualenv "testenv${PYVER}_4" -p "python${PYVER}"
41+
virtualenv "testenv${PYVER}_5" -p "python${PYVER}"
3842

3943

4044
# Secondly we test via pip
4145

42-
pushd testenv${PYVER}_2
46+
pushd "testenv${PYVER}_2"
47+
# shellcheck source=/dev/null
4348
source bin/activate
4449
rm lib/python-wheels/setuptools* \
4550
&& pip install --force-reinstall -U pip==${pipver} \
46-
&& pip install setuptools==${setupver} wheel
47-
pip install -e git+${repo}@${HEAD}#egg=${package}
51+
&& pip install setuptools==${setuptoolsver} wheel
52+
pip install -e "git+${repo}@${HEAD}#egg=${package}"
4853
pushd src/${package}
4954
make install-dependencies
5055
make dist
5156
make test
52-
cp dist/${package}*tar.gz ../../../testenv${PYVER}_3/
53-
cp dist/${package}*whl ../../../testenv${PYVER}_4/
57+
cp dist/${package}*tar.gz "../../../testenv${PYVER}_3/"
58+
cp dist/${package}*whl "../../../testenv${PYVER}_4/"
5459
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
5560
popd # ../.. no subdir named ${proj} here, safe for py.testing the installed module
61+
# shellcheck disable=SC2086
5662
bin/${run_tests}
5763
popd
5864

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

62-
pushd testenv${PYVER}_3/
68+
pushd "testenv${PYVER}_3/"
69+
# shellcheck source=/dev/null
6370
source bin/activate
6471
rm lib/python-wheels/setuptools* \
6572
&& pip install --force-reinstall -U pip==${pipver} \
66-
&& pip install setuptools==${setupver} wheel
73+
&& pip install setuptools==${setuptoolsver} wheel
6774
pip install ${package}*tar.gz
6875
pip install pytest
6976
mkdir out
@@ -73,19 +80,25 @@ make dist
7380
make test
7481
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
7582
mkdir ../not-${module}
76-
pushd ../not-${module} ; ../../bin/${run_tests}; popd
83+
pushd ../not-${module}
84+
# shellcheck disable=SC2086
85+
../../bin/${run_tests}
86+
popd
7787
popd
7888
popd
7989

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

82-
pushd testenv${PYVER}_4/
92+
pushd "testenv${PYVER}_4/"
93+
# shellcheck source=/dev/null
8394
source bin/activate
8495
rm lib/python-wheels/setuptools* \
8596
&& pip install --force-reinstall -U pip==${pipver} \
86-
&& pip install setuptools==${setupver} wheel
97+
&& pip install setuptools==${setuptoolsver} wheel
8798
pip install ${package}*.whl
8899
pip install pytest
89100
mkdir not-${module}
90-
pushd not-${module} ; ../bin/${run_tests}; popd
101+
pushd not-${module}
102+
# shellcheck disable=SC2086
103+
../bin/${run_tests}; popd
91104
popd

0 commit comments

Comments
 (0)