|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +: ${PLANEMO_TARGET:="planemo==0.50.1"} |
| 4 | +: ${PLANEMO_OPTIONS:="--verbose"} |
| 5 | +: ${PLANEMO_PROFILE_NAME:="wxflowtest"} |
| 6 | +: ${PLANEMO_SERVE_PORT:="9019"} |
| 7 | +: ${PLANEMO_TEST_STYLE:="serve_and_test"} # profile_serve_and_test, serve_and_test, docker_serve_and_test, test, docker_test |
| 8 | +: ${PLANEMO_SERVE_DATABASE_TYPE:="postgres"} # used if not using Docker with PLANEMO_TEST_STYLE |
| 9 | +: ${PLANEMO_DOCKER_GALAXY_IMAGE:="quay.io/bgruening/galaxy:18.01"} # used if used Docker with PLANEMO_TEST_STYLE |
| 10 | + |
| 11 | +GALAXY_URL="http://localhost:$PLANEMO_SERVE_PORT" |
| 12 | + |
| 13 | +# Ensure Planemo is installed. |
| 14 | +if [ ! -d .venv ]; then |
| 15 | + virtualenv .venv |
| 16 | + . .venv/bin/activate |
| 17 | + pip install -U pip |
| 18 | + # Intentionally expand wildcards in PLANEMO_TARGET. |
| 19 | + shopt -s extglob |
| 20 | + pip install ${PLANEMO_TARGET} |
| 21 | +fi |
| 22 | +. .venv/bin/activate |
| 23 | + |
| 24 | +# Run test. |
| 25 | +# This example shows off a bunch of different ways one could test with Planemo, |
| 26 | +# but for actual workflow testing projects - probably best just to take one of the last |
| 27 | +# two very easy invocations to simplify things. |
| 28 | +if [ "$PLANEMO_TEST_STYLE" = "profile_serve_and_test" ]; then |
| 29 | + planemo $PLANEMO_OPTIONS profile_create \ |
| 30 | + --database_type "$PLANEMO_SERVE_DATABASE_TYPE" \ |
| 31 | + "$PLANEMO_PROFILE_NAME" |
| 32 | + planemo $PLANEMO_OPTIONS serve \ |
| 33 | + --daemon \ |
| 34 | + --profile "$PLANEMO_PROFILE_NAME" \ |
| 35 | + --port "$PLANEMO_SERVE_PORT" \ |
| 36 | + "$1" |
| 37 | + planemo $PLANEMO_OPTIONS test \ |
| 38 | + --galaxy_url "$GALAXY_URL" \ |
| 39 | + --engine external_galaxy \ |
| 40 | + "$1" |
| 41 | +elif [ "$PLANEMO_TEST_STYLE" = "serve_and_test" ]; then |
| 42 | + planemo $PLANEMO_OPTIONS serve \ |
| 43 | + --daemon \ |
| 44 | + --database_type "$PLANEMO_SERVE_DATABASE_TYPE" \ |
| 45 | + --port "$PLANEMO_SERVE_PORT" \ |
| 46 | + "$1" |
| 47 | + planemo $PLANEMO_OPTIONS test \ |
| 48 | + --galaxy_url "$GALAXY_URL" \ |
| 49 | + --engine external_galaxy \ |
| 50 | + "$1" |
| 51 | +elif [ "$PLANEMO_TEST_STYLE" = "docker_serve_and_test" ]; then |
| 52 | + docker pull "${PLANEMO_DOCKER_GALAXY_IMAGE}" |
| 53 | + planemo $PLANEMO_OPTIONS serve \ |
| 54 | + --daemon \ |
| 55 | + --engine docker_galaxy \ |
| 56 | + --docker_galaxy_image "${PLANEMO_DOCKER_GALAXY_IMAGE}" \ |
| 57 | + --docker_extra_volume . \ |
| 58 | + --port "$PLANEMO_SERVE_PORT" \ |
| 59 | + "$1" |
| 60 | + planemo $PLANEMO_OPTIONS test \ |
| 61 | + --galaxy_url "$GALAXY_URL" \ |
| 62 | + --engine external_galaxy \ |
| 63 | + "$1" |
| 64 | +elif [ "$PLANEMO_TEST_STYLE" = "test" ]; then |
| 65 | + planemo $PLANEMO_OPTIONS test \ |
| 66 | + --database_type "$PLANEMO_SERVE_DATABASE_TYPE" \ |
| 67 | + "$1" |
| 68 | +elif [ "$PLANEMO_TEST_STYLE" = "docker_test" ]; then |
| 69 | + docker pull "${PLANEMO_DOCKER_GALAXY_IMAGE}" |
| 70 | + planemo $PLANEMO_OPTIONS test \ |
| 71 | + --engine docker_galaxy \ |
| 72 | + --docker_galaxy_image "${PLANEMO_DOCKER_GALAXY_IMAGE}" \ |
| 73 | + --docker_extra_volume . \ |
| 74 | + "$1" > /dev/null |
| 75 | +else |
| 76 | + echo "Unknown test style ${PLANEMO_TEST_STYLE}" |
| 77 | + exit 1 |
| 78 | +fi |
0 commit comments