diff --git a/Applications/SlicerApp/CMakeLists.txt b/Applications/SlicerApp/CMakeLists.txt index d9874602299..74e2440ad36 100755 --- a/Applications/SlicerApp/CMakeLists.txt +++ b/Applications/SlicerApp/CMakeLists.txt @@ -69,7 +69,7 @@ slicerMacroBuildAppLibrary( NAME ${APPLIB_NAME} APPLICATION_NAME ${SlicerApp_APPLICATION_NAME} DESCRIPTION_SUMMARY ${APPLIB_DESCRIPTION_SUMMARY} - DESCRIPTION_FILE ${Slicer_SOURCE_DIR}/README.txt + DESCRIPTION_FILE ${Slicer_SOURCE_DIR}/README.rst EXPORT_DIRECTIVE "Q_SLICER_APP_EXPORT" FOLDER ${${PROJECT_NAME}_FOLDER} SRCS ${APPLIB_SRCS} diff --git a/CMake/CircleCI/run.sh b/CMake/CircleCI/run.sh new file mode 100755 index 00000000000..a216509872c --- /dev/null +++ b/CMake/CircleCI/run.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +script_dir="`cd $(dirname $0); pwd`" + +# Run the images which contains the build of slicer (to link with the testing image with mounted volume) +docker run -d --name slicer-build-with-test slicer/slicer-test bash + +# Run the opengl docker image which will run the tests located on the volume shared by slicer/slicer-build +$script_dir/run_opengl.sh \ + -i slicer/slicer-test:opengl \ + -p 6081 \ + -r --env="CIRCLE_SHA1=$1" -r --env="CIRCLE_BRANCH=$2" \ + -r --volumes-from -r slicer-build-with-test + +# Remove the container used to mount volumes from slicer-build +#docker rm slicer-build-with-test diff --git a/CMake/CircleCI/run_opengl.sh b/CMake/CircleCI/run_opengl.sh new file mode 100755 index 00000000000..39a2222a58d --- /dev/null +++ b/CMake/CircleCI/run_opengl.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +container=opengl +image=slicer/slicer-test:opengl +port=6080 +extra_run_args="" +quiet="" + +show_help() { +cat << EOF +Usage: ${0##*/} [-h] [-q] [-c CONTAINER] [-i IMAGE] [-p PORT] [-r DOCKER_RUN_FLAGS] + +This script is a convenience script to run Docker images based on +thewtex/opengl. It: + +- Makes sure docker is available +- On Windows and Mac OSX, creates a docker machine if required +- Informs the user of the URL to access the container with a web browser +- Stops and removes containers from previous runs to avoid conflicts +- Mounts the present working directory to /home/user/work on Linux and Mac OSX +- Prints out the graphical app output log following execution +- Exits with the same return code as the graphical app + +Options: + + -h Display this help and exit. + -c Container name to use (default ${container}). + -i Image name (default ${image}). + -p Port to expose HTTP server (default ${port}). If an empty + string, the port is not exposed. + -r Extra arguments to pass to 'docker run'. E.g. + --env="APP=glxgears" + -q Do not output informational messages. +EOF +} + +while [ $# -gt 0 ]; do + case "$1" in + -h) + show_help + exit 0 + ;; + -c) + container=$2 + shift + ;; + -i) + image=$2 + shift + ;; + -p) + port=$2 + shift + ;; + -r) + extra_run_args="$extra_run_args $2" + shift + ;; + -q) + quiet=1 + ;; + *) + show_help >&2 + exit 1 + ;; + esac + shift +done + + +which docker 2>&1 >/dev/null +if [ $? -ne 0 ]; then + echo "Error: the 'docker' command was not found. Please install docker." + exit 1 +fi + +os=$(uname) +if [ "${os}" != "Linux" ]; then + vm=$(docker-machine active 2> /dev/null || echo "default") + if ! docker-machine inspect "${vm}" &> /dev/null; then + if [ -z "$quiet" ]; then + echo "Creating machine ${vm}..." + fi + docker-machine -D create -d virtualbox --virtualbox-memory 2048 ${vm} + fi + docker-machine start ${vm} > /dev/null + eval $(docker-machine env $vm --shell=sh) +fi + +ip=$(docker-machine ip ${vm} 2> /dev/null || echo "localhost") +url="http://${ip}:$port" + +cleanup() { + docker stop $container >/dev/null + #docker rm $container >/dev/null +} + +running=$(docker ps -a -q --filter "name=${container}") +if [ -n "$running" ]; then + if [ -z "$quiet" ]; then + echo "Stopping and removing the previous session..." + echo "" + fi + cleanup +fi + +if [ -z "$quiet" ]; then + echo "" + echo "Setting up the graphical application container..." + echo "" + if [ -n "$port" ]; then + echo "Point your web browser to ${url}" + echo "" + fi +fi + +#pwd_dir="`cd $(dirname $0)/../..; pwd`" +mount_local="" +#if [ "${os}" = "Linux" ] || [ "${os}" = "Darwin" ]; then +# mount_local=" -v ${pwd_dir}:/usr/src/Slicer " +#fi +port_arg="" +if [ -n "$port" ]; then + port_arg="-p $port:6080" +fi + +docker run \ + -d \ + --name $container \ + ${mount_local} \ + $port_arg \ + $extra_run_args \ + $image >/dev/null + +print_app_output() { + docker cp $container:/var/log/supervisor/graphical-app-launcher.log - \ + | tar xO + result=$(docker cp $container:/tmp/graphical-app.return_code - \ + | tar xO) + cleanup + exit $result +} + +trap "docker stop $container >/dev/null && print_app_output" SIGINT SIGTERM + +# Avoid CircleCI Timed Out by displaying a dot every minute +RUNNING=$(docker inspect --format="{{ .State.Running }}" $container) +while "$RUNNING" == "true" +do + echo -n . + sleep 1m + RUNNING=$(docker inspect --format="{{ .State.Running }}" $container) +done + +print_app_output + +# vim: noexpandtab shiftwidth=4 tabstop=4 softtabstop=0 diff --git a/CMake/SlicerGenerateSlicerConfig.cmake b/CMake/SlicerGenerateSlicerConfig.cmake index 17c396a4650..59f331f564e 100644 --- a/CMake/SlicerGenerateSlicerConfig.cmake +++ b/CMake/SlicerGenerateSlicerConfig.cmake @@ -32,7 +32,7 @@ set(Slicer_LAUNCH_COMMAND_CONFIG ${Slicer_LAUNCH_COMMAND}) # License and Readme file set(Slicer_LICENSE_FILE_CONFIG ${Slicer_SOURCE_DIR}/License.txt) -set(Slicer_README_FILE_CONFIG ${Slicer_SOURCE_DIR}/README.txt) +set(Slicer_README_FILE_CONFIG ${Slicer_SOURCE_DIR}/README.rst) # Test templates directory set(Slicer_CXX_MODULE_TEST_TEMPLATES_DIR_CONFIG ${Slicer_CXX_MODULE_TEST_TEMPLATES_DIR}) diff --git a/README.txt b/README.rst similarity index 53% rename from README.txt rename to README.rst index d0971fc4976..8247e16acc8 100644 --- a/README.txt +++ b/README.rst @@ -1,8 +1,14 @@ -Slicer, or 3D Slicer, is a free, open source software package for visualization and -image analysis. +Slicer +============== -3D Slicer is natively designed to be available on multiple platforms, -including Windows, Linux and Mac Os X. +.. image:: https://circleci.com/gh/Slicer/Slicer.svg?style=svg + :target: http://slicer.cdash.org/index.php?project=Slicer4 + +Slicer, or 3D Slicer, is a free, open source software package for visualization and +image analysis. + +3D Slicer is natively designed to be available on multiple platforms, +including Windows, Linux and Mac Os X. For more information, please see: diff --git a/circle.yml b/circle.yml index c249cc3d72b..48b44a2185f 100644 --- a/circle.yml +++ b/circle.yml @@ -14,9 +14,16 @@ dependencies: - docker info - pip install scikit-ci-addons==0.11.0 - ci_addons docker load-pull-save slicer/slicer-dependencies + - if [[ -e ~/docker/image-test.tar ]]; then docker load -i ~/docker/image-test.tar; fi + - docker pull slicer/slicer-test + - mkdir -p ~/docker; docker save slicer/slicer-test > ~/docker/image-test.tar + - if [[ -e ~/docker/image-test-opengl.tar ]]; then docker load -i ~/docker/image-test-opengl.tar; fi + - docker pull slicer/slicer-test:opengl + - mkdir -p ~/docker; docker save slicer/slicer-test:opengl > ~/docker/image-test-opengl.tar test: override: - "echo 'Notice: CircleCI does not build changes to Slicer dependencies' && if git diff --name-only master | grep -q SuperBuild > /dev/null; then false; fi" - docker run -e "BUILD_TOOL_FLAGS=-j5" --name slicer -v ~/Slicer:/usr/src/Slicer slicer/slicer-dependencies - docker cp slicer:$(docker cp slicer:/usr/src/Slicer-build/Slicer-build/PACKAGE_FILE.txt - | tar xO) $CIRCLE_ARTIFACTS + - bash ./CMake/CircleCI/run.sh $CIRCLE_SHA1 $CIRCLE_BRANCH