3 read -rd "\000" helpmessage <<EOF
4 $(basename $0): Test cwl tool and (optionally) upload to PyPi and Docker Hub.
7 WORKSPACE=/path/to/common-workflow-language $(basename $0) [options]
11 --upload-pypi Upload package to pypi (default: false)
12 --upload-docker Upload packages to docker hub (default: false)
13 --debug Output debug information (default: false)
15 WORKSPACE=path Path to the common-workflow-language source tree
38 if [[ -z "${leave_temp[$var]}" ]]
45 leaving+=" $var=\"${!var}\""
48 if [[ -n "$leaving" ]]; then
49 echo "Leaving behind temp dirs: $leaving"
55 echo >&2 "Fatal: $* (encountered in ${FUNCNAME[1]} at ${BASH_SOURCE[1]} line ${BASH_LINENO[0]})"
59 trap clear_temp INT EXIT
61 # Set up temporary install dirs (unless existing dirs were supplied)
64 if [[ -n "${!tmpdir}" ]]; then
67 eval $tmpdir=$(mktemp -d)
77 echo >&2 "$helpmessage"
94 eval export $(echo $arg | cut -d= -f1)=\"$(echo $arg | cut -d= -f2-)\"
97 echo >&2 "$0: Unrecognized option: '$arg'. Try: $0 --help"
104 if ! [[ -n "$WORKSPACE" ]]; then
105 echo >&2 "$helpmessage"
107 echo >&2 "Error: WORKSPACE environment variable not set"
112 if [[ "$DEBUG" != 0 ]]; then
113 echo "Workspace is $WORKSPACE"
116 virtualenv --setuptools "$VENVDIR" || fatal "virtualenv $VENVDIR failed"
117 . "$VENVDIR/bin/activate"
119 handle_python_package () {
120 # This function assumes the current working directory is the python package directory
121 if [[ "$UPLOAD_PYPI" != 0 ]]; then
122 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
123 if [[ "$DEBUG" != 0 ]]; then
124 python setup.py sdist upload
126 python setup.py -q sdist upload
129 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
130 if [[ "$DEBUG" != 0 ]]; then
131 python setup.py sdist
133 python setup.py -q sdist
138 # Make all files world-readable -- jenkins runs with umask 027, and has checked
139 # out our git tree here
140 chmod o+r "$WORKSPACE" -R
142 # Now fix our umask to something better suited to building and publishing
146 if [[ "$DEBUG" != 0 ]]; then
147 echo "umask is" `umask`
151 if [[ "$DEBUG" != 0 ]]; then
153 echo "Python packages"
159 if test -d cwltool ; then
162 git reset --hard origin/master
165 git clone git@github.com:common-workflow-language/cwltool.git
167 git config user.email "sysadmin@curoverse.com"
168 git config user.name "Curoverse build bot"
173 python setup.py install
175 ./build-node-docker.sh
178 ./run_test.sh RUNNER=cwltool/cwltool/main.py DRAFT=draft-2
179 ./run_test.sh RUNNER=cwltool/cwltool/main.py DRAFT=draft-3
182 handle_python_package
185 (cd cwltool/cwl-runner
186 handle_python_package
190 ./build-cwl-docker.sh
193 if [[ "$UPLOAD_DOCKER" != 0 ]]; then
194 docker push commonworkflowlanguage/cwltool_module
195 docker push commonworkflowlanguage/cwltool
196 docker push commonworkflowlanguage/nodejs-engine
199 if test -d common-workflow-language.github.io ; then
200 (cd common-workflow-language.github.io
202 git reset --hard origin/master
205 git clone git@github.com:common-workflow-language/common-workflow-language.github.io.git
206 (cd common-workflow-language.github.io
207 git config user.email "sysadmin@curoverse.com"
208 git config user.name "Curoverse build bot"
212 python -mcwltool --outdir=$PWD/common-workflow-language.github.io site/cwlsite.cwl site/cwlsite-job.json
214 (cd common-workflow-language.github.io
216 git diff-index --quiet HEAD || git commit -m"Build bot"