forked from common-workflow-language/cwltool
-
Notifications
You must be signed in to change notification settings - Fork 4
/
release-test.sh
executable file
·105 lines (93 loc) · 3 KB
/
release-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
set -e
set -x
export LC_ALL=C
package=cwltool
module=cwltool
if [ "$GITHUB_ACTIONS" = "true" ]; then
# We are running as a GH Action
repo=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git
HEAD=${GITHUB_REF}
else
repo=https://github.com/common-workflow-language/cwltool.git
HEAD=$(git rev-parse HEAD)
fi
test_prefix=""
run_tests() {
local mod_loc
mod_loc=$(pip show ${package} |
grep ^Location | awk '{print $2}')/${module}
"${test_prefix}"bin/py.test "--ignore=${mod_loc}/schemas/" \
--pyargs -x ${module} -n auto --dist=loadfile
}
pipver=20.3b1 # minimum required version of pip for Python 3.9
setuptoolsver=41.1.0 # required for Python 3.9
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
rm -Rf testenv? || /bin/true
if [ "${RELEASE_SKIP}" != "head" ]
then
python3 -m venv testenv1
# First we test the head
# shellcheck source=/dev/null
source testenv1/bin/activate
rm -Rf testenv1/local
rm -f testenv1/lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setuptoolsver} wheel
pip install -rtest-requirements.txt
pip install -e .
make test
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
mkdir testenv1/not-${module}
# if there is a subdir named '${module}' py.test will execute tests
# there instead of the installed module's tests
pushd testenv1/not-${module}
# shellcheck disable=SC2086
test_prefix=../ run_tests; popd
fi
python3 -m venv testenv2
python3 -m venv testenv3
python3 -m venv testenv4
rm -Rf testenv[234]/local
# Secondly we test via pip
pushd testenv2
# shellcheck source=/dev/null
source bin/activate
rm -f lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setuptoolsver} wheel
# The following can fail if you haven't pushed your commits to ${repo}
pip install -e "git+${repo}@${HEAD}#egg=${package}"
pushd src/${package}
pip install -rtest-requirements.txt
make dist
make test
cp dist/${package}*tar.gz ../../../testenv3/
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
run_tests
popd
# Is the source distribution in testenv2 complete enough to build another
# functional distribution?
pushd testenv3/
# shellcheck source=/dev/null
source bin/activate
rm -f lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setuptoolsver} wheel
package_tar=$(find . -name "${package}*tar.gz")
pip install "-r${DIR}/test-requirements.txt"
pip install "${package_tar}"
mkdir out
tar --extract --directory=out -z -f ${package}*.tar.gz
pushd out/${package}*
make dist
make test
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
mkdir ../not-${module}
pushd ../not-${module}
# shellcheck disable=SC2086
test_prefix=../../ run_tests; popd
popd
popd