3 # Copyright (C) The Arvados Authors. All rights reserved.
5 # SPDX-License-Identifier: AGPL-3.0
7 read -rd "\000" helpmessage <<EOF
8 $(basename $0): Test cwl tool and (optionally) upload to PyPi and Docker Hub.
11 WORKSPACE=/path/to/common-workflow-language $(basename $0) [options]
15 --upload-pypi Upload package to pypi (default: false)
16 --upload-docker Upload packages to docker hub (default: false)
17 --debug Output debug information (default: false)
19 WORKSPACE=path Path to the common-workflow-language source tree
42 if [[ -z "${leave_temp[$var]}" ]]
49 leaving+=" $var=\"${!var}\""
52 if [[ -n "$leaving" ]]; then
53 echo "Leaving behind temp dirs: $leaving"
59 echo >&2 "Fatal: $* (encountered in ${FUNCNAME[1]} at ${BASH_SOURCE[1]} line ${BASH_LINENO[0]})"
63 trap clear_temp INT EXIT
65 # Set up temporary install dirs (unless existing dirs were supplied)
68 if [[ -n "${!tmpdir}" ]]; then
71 eval $tmpdir=$(mktemp -d)
81 echo >&2 "$helpmessage"
98 eval export $(echo $arg | cut -d= -f1)=\"$(echo $arg | cut -d= -f2-)\"
101 echo >&2 "$0: Unrecognized option: '$arg'. Try: $0 --help"
108 if ! [[ -n "$WORKSPACE" ]]; then
109 echo >&2 "$helpmessage"
111 echo >&2 "Error: WORKSPACE environment variable not set"
116 if [[ "$DEBUG" != 0 ]]; then
117 echo "Workspace is $WORKSPACE"
120 virtualenv --setuptools "$VENVDIR" || fatal "virtualenv $VENVDIR failed"
121 . "$VENVDIR/bin/activate"
123 handle_python_package () {
124 # This function assumes the current working directory is the python package directory
125 if [[ "$UPLOAD_PYPI" != 0 ]]; then
126 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
127 if [[ "$DEBUG" != 0 ]]; then
128 python setup.py sdist upload
130 python setup.py -q sdist upload
133 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
134 if [[ "$DEBUG" != 0 ]]; then
135 python setup.py sdist
137 python setup.py -q sdist
142 # Make all files world-readable -- jenkins runs with umask 027, and has checked
143 # out our git tree here
144 chmod o+r "$WORKSPACE" -R
146 # Now fix our umask to something better suited to building and publishing
150 if [[ "$DEBUG" != 0 ]]; then
151 echo "umask is" `umask`
155 if [[ "$DEBUG" != 0 ]]; then
157 echo "Python packages"
163 if test -d cwltool ; then
166 git reset --hard origin/master
169 git clone git@github.com:common-workflow-language/cwltool.git
171 git config user.email "sysadmin@curoverse.com"
172 git config user.name "Curoverse build bot"
177 python setup.py install
181 ./run_test.sh RUNNER=cwltool DRAFT=draft-2
182 ./run_test.sh RUNNER=cwltool DRAFT=draft-3
185 handle_python_package
188 (cd cwltool/cwl-runner
189 handle_python_package
193 ./build-cwl-docker.sh
196 if [[ "$UPLOAD_DOCKER" != 0 ]]; then
197 docker push commonworkflowlanguage/cwltool_module
198 docker push commonworkflowlanguage/cwltool
201 if test -d common-workflow-language.github.io ; then
202 (cd common-workflow-language.github.io
204 git reset --hard origin/master
207 git clone git@github.com:common-workflow-language/common-workflow-language.github.io.git
208 (cd common-workflow-language.github.io
209 git config user.email "sysadmin@curoverse.com"
210 git config user.name "Curoverse build bot"
214 cwltool --outdir=$PWD/common-workflow-language.github.io site/cwlsite.cwl site/cwlsite-job.json
216 (cd common-workflow-language.github.io
218 git diff-index --quiet HEAD || git commit -m"Build bot"