1
1
#! /bin/bash
2
2
venv () {
3
- if ! test -d " $1 " ; then
4
- virtualenv -p python3 " $1 "
5
- fi
6
- # shellcheck source=/dev/null
7
- source " $1 " /bin/activate
3
+ if ! test -d " $1 " ; then
4
+ if command -v virtualenv > /dev/null; then
5
+ virtualenv -p python3 " $1 "
6
+ else
7
+ python3 -m venv " $1 "
8
+ fi
9
+ fi
10
+ # shellcheck source=/dev/null
11
+ source " $1 " /bin/activate
8
12
}
13
+
14
+ # Set these environment variables when running the script, e.g.:
15
+ # version=v1.1 spec_branch=new_test container=docker ./conformance_test.sh
16
+
17
+ # Version of the standard to test against
18
+ # Current options: v1.0, v1.1, v1.2
9
19
version=${version:- v1.0}
20
+
21
+ # Which branch of the standard's repo to use.
22
+ # This can be useful when adding new features
23
+ spec_branch=${spec_branch:- main}
24
+
25
+ # Which container runtime to use
26
+ # Valid options: docker, singularity
27
+ container=${container:- docker}
28
+
29
+ set -e
30
+ set -x
31
+
10
32
if [[ " $version " = " v1.0" ]] ; then
11
- wget https://github.com/common-workflow-language/common-workflow-language/archive/main.tar.gz
12
- tar xzf main.tar.gz && rm main.tar.gz
33
+ repo=common-workflow-language
13
34
else
14
35
# shellcheck disable=SC2001
15
- repo=$( echo " $version " | sed ' s/\(v[0-9]*\.\)\([0-9]*\).*/\1\2/' )
16
- wget https://github.com/common-workflow-language/cwl-" ${repo} " /archive/main.tar.gz
17
- tar xzf main.tar.gz && rm main.tar.gz
36
+ repo=cwl-$( echo " $version " | sed ' s/\(v[0-9]*\.\)\([0-9]*\).*/\1\2/' )
37
+ fi
38
+
39
+ if [ ! -d " ${repo} -${spec_branch} " ]; then
40
+ if [ ! -f " ${repo} -${spec_branch} .tar.gz" ]; then
41
+ wget " https://github.com/common-workflow-language/${repo} /archive/${spec_branch} .tar.gz"
42
+ fi
43
+ tar xzf " ${spec_branch} .tar.gz"
44
+ fi
45
+
46
+ if [ " ${container} " == " docker" ]; then
47
+ docker pull node:slim
18
48
fi
19
49
20
- docker pull node:slim
50
+ venv cwltool-venv3
51
+ pip3 install -U setuptools wheel pip
52
+ pip3 uninstall -y cwltool
53
+ pip3 install -e .
54
+ pip3 install codecov cwltest> =2.1
55
+ pushd " ${repo} -${spec_branch} " || exit 1
21
56
22
57
# shellcheck disable=SC2043
23
- for CONTAINER in docker
24
- # for CONTAINER in docker singularity
25
- # singularity having issues on ci.commonwl.org; tests pass with https://gist.github.com/mr-c/0ec90d717617d074017c0cb38b72d1a4
26
- do
27
- venv cwltool-venv3
28
- pip3 install -U setuptools wheel pip
29
- pip3 uninstall -y cwltool
30
- pip3 install -e .
31
- pip3 install " cwltest>=1.0.20180518074130" codecov
32
- if [[ " $version " = " v1.0" ]]
33
- then
34
- DRAFT=" DRAFT=v1.0"
35
- pushd common-workflow-language-main || exit 1
36
- else
37
- pushd cwl-" ${repo} " -main || exit 1
38
- fi
39
- rm -f .coverage* coverage.xml
40
- source=$( realpath ../cwltool)
41
- COVERAGE_RC=${PWD} /.coveragerc
42
- cat > " ${COVERAGE_RC} " << EOF
58
+ if [[ " $version " = " v1.0" ]]; then
59
+ DRAFT=" DRAFT=v1.0"
60
+ fi
61
+ # Clean up all cov data
62
+ find . -name ' .coverage*' -print0 | xargs -0 rm -f
63
+ rm -f coverage.xml
64
+
65
+ source=$( realpath ../cwltool)
66
+ COVERAGE_RC=${PWD} /.coveragerc
67
+ cat > " ${COVERAGE_RC} " << EOF
43
68
[run]
44
69
branch = True
45
70
source = ${source}
@@ -54,72 +79,101 @@ ignore_errors = True
54
79
omit =
55
80
tests/*
56
81
EOF
57
- CWLTOOL_WITH_COV=${PWD} /cwltool_with_cov3
58
- cat > " ${CWLTOOL_WITH_COV} " << EOF
82
+ CWLTOOL_WITH_COV=${PWD} /cwltool_with_cov3
83
+ cat > " ${CWLTOOL_WITH_COV} " << EOF
59
84
#!/bin/bash
60
85
coverage run --parallel-mode --rcfile=${COVERAGE_RC} \
61
86
"$( command -v cwltool) " "\$ @"
62
87
EOF
63
- chmod a+x " ${CWLTOOL_WITH_COV} "
64
- EXTRA=" --parallel"
65
- # shellcheck disable=SC2154
66
- if [[ " $version " = * dev* ]]
67
- then
68
- EXTRA+=" --enable-dev"
69
- fi
70
- if [[ " $CONTAINER " = " singularity" ]]
71
- then
72
- EXTRA+=" --singularity"
73
- fi
74
- if [ -n " $EXTRA " ]
75
- then
76
- EXTRA=" EXTRA=${EXTRA} "
77
- fi
78
- if [ " $GIT_BRANCH " = " origin/main" ] && [[ " $version " = " v1.0" ]] && [[ " $CONTAINER " = " docker" ]]
79
- then
80
- rm -Rf conformance
81
- # shellcheck disable=SC2154
82
- git clone http://" ${jenkins_cwl_conformance} " @github.com/common-workflow-language/conformance.git
83
-
84
- git -C conformance config user.email
" [email protected] "
85
- git -C conformance config user.name " CWL Jenkins build bot"
86
- CONFORMANCE_MSG=$( cat << EOM
88
+ chmod a+x " ${CWLTOOL_WITH_COV} "
89
+ unset exclusions
90
+ declare -a exclusions
91
+
92
+ EXTRA=" --parallel"
93
+ # shellcheck disable=SC2154
94
+ if [[ " $version " = * dev* ]]
95
+ then
96
+ EXTRA+=" --enable-dev"
97
+ fi
98
+
99
+ if [[ " $container " = " singularity" ]]; then
100
+ EXTRA+=" --singularity"
101
+ # This test fails because Singularity and Docker have
102
+ # different views on how to deal with this.
103
+ exclusions+=(docker_entrypoint)
104
+
105
+ if [[ " ${version} " = " v1.1" ]]; then
106
+ # This fails because of a difference (in Singularity vs Docker) in
107
+ # the way filehandles are passed to processes in the container and
108
+ # wc can tell somehow.
109
+ # See issue #1440
110
+ exclusions+=(stdin_shorcut)
111
+ fi
112
+
113
+ if [[ " ${version} " = " v1.2" ]]; then
114
+ # See issue #1441
115
+ exclusions+=(iwdr_dir_literal_real_file)
116
+ fi
117
+ fi
118
+
119
+ if [ -n " $EXTRA " ]
120
+ then
121
+ EXTRA=" EXTRA=${EXTRA} "
122
+ fi
123
+ if [ " $GIT_BRANCH " = " origin/main" ] && [[ " $version " = " v1.0" ]] && [[ " $container " = " docker" ]]
124
+ then
125
+ rm -Rf conformance
126
+ # shellcheck disable=SC2154
127
+ git clone http://" ${jenkins_cwl_conformance} " @github.com/common-workflow-language/conformance.git
128
+
129
+ git -C conformance config user.email
" [email protected] "
130
+ git -C conformance config user.name " CWL Jenkins build bot"
131
+ CONFORMANCE_MSG=$( cat << EOM
87
132
Conformance test of cwltool ${tool_ver} for CWL ${version}
88
133
Commit: ${GIT_COMMIT}
89
134
Python version: 3
90
- Container: ${CONTAINER }
135
+ Container: ${container }
91
136
EOM
92
137
)
93
138
94
- tool_ver=$( cwltool --version | awk ' { print $2 }' )
95
- badgedir=${PWD} /conformance/cwltool/cwl_${version} /cwltool_${tool_ver}
96
- mkdir -p " ${PWD} " /conformance/cwltool/cwl_" ${version} " /
97
- rm -fr " ${badgedir} "
98
- BADGE=" --badgedir=${badgedir} "
99
- fi
100
- # shellcheck disable=SC2086
101
- LC_ALL=C.UTF-8 ./run_test.sh --junit-xml=result3.xml \
102
- RUNNER=${CWLTOOL_WITH_COV} " -j$( nproc) " ${BADGE} \
103
- ${DRAFT} " ${EXTRA} " \
104
- " --classname=py3_${CONTAINER} "
105
- # LC_ALL=C is to work around junit-xml ASCII only bug
106
- CODE=$(( CODE+ $? )) # capture return code of ./run_test.sh
107
- coverage combine " --rcfile=${COVERAGE_RC} " " $( find . -name ' .coverage.*' ) "
108
- coverage xml " --rcfile=${COVERAGE_RC} "
109
- codecov --file coverage.xml
110
-
111
- if [ -d conformance ]
112
- then
113
- rm -rf conformance/cwltool/cwl_" ${version} " /cwltool_latest
114
- cp -r conformance/cwltool/cwl_" ${version} " /cwltool_" ${tool_ver} " conformance/cwltool/cwl_" ${version} " /cwltool_latest
115
- git -C conformance add --all
116
- git -C conformance diff-index --quiet HEAD || git -C conformance commit -m " ${CONFORMANCE_MSG} "
117
- git -C conformance push http://
" ${jenkins_cwl_conformance} " :
[email protected] /common-workflow-language/conformance.git
118
- fi
139
+ tool_ver=$( cwltool --version | awk ' { print $2 }' )
140
+ badgedir=${PWD} /conformance/cwltool/cwl_${version} /cwltool_${tool_ver}
141
+ mkdir -p " ${PWD} " /conformance/cwltool/cwl_" ${version} " /
142
+ rm -fr " ${badgedir} "
143
+ BADGE=" --badgedir=${badgedir} "
144
+ fi
145
+
146
+ if (( "${# exclusions[*]} " > 0 )) ; then
147
+ EXCLUDE=-S$( IFS=,; echo " ${exclusions[*]} " )
148
+ else
149
+ EXCLUDE=" "
150
+ fi
151
+ # shellcheck disable=SC2086
152
+ LC_ALL=C.UTF-8 ./run_test.sh --junit-xml=result3.xml ${EXCLUDE} \
153
+ RUNNER=${CWLTOOL_WITH_COV} " -j$( nproc) " ${BADGE} \
154
+ ${DRAFT} " ${EXTRA} " \
155
+ " --classname=py3_${container} "
156
+ # LC_ALL=C is to work around junit-xml ASCII only bug
157
+
158
+ # capture return code of ./run_test.sh
159
+ CODE=$?
160
+
161
+ find . -name ' .coverage.*' -print0 | xargs -0 coverage combine --rcfile=" ${COVERAGE_RC} " --append
162
+ coverage xml --rcfile=" ${COVERAGE_RC} "
163
+ codecov --file coverage.xml
164
+
165
+ if [ -d conformance ]
166
+ then
167
+ rm -rf conformance/cwltool/cwl_" ${version} " /cwltool_latest
168
+ cp -r conformance/cwltool/cwl_" ${version} " /cwltool_" ${tool_ver} " conformance/cwltool/cwl_" ${version} " /cwltool_latest
169
+ git -C conformance add --all
170
+ git -C conformance diff-index --quiet HEAD || git -C conformance commit -m " ${CONFORMANCE_MSG} "
171
+ git -C conformance push http://
" ${jenkins_cwl_conformance} " :
[email protected] /common-workflow-language/conformance.git
172
+ fi
173
+
174
+ popd || exit
175
+ deactivate
119
176
120
- deactivate
121
- popd || exit
122
- done
123
177
# build new docker container
124
178
if [ " $GIT_BRANCH " = " origin/main" ] && [[ " $version " = " v1.0" ]]
125
179
then
0 commit comments