From beec7c9b13c46a5277396f724b73a385f1a9a570 Mon Sep 17 00:00:00 2001 From: Mayeul Chassagnard Date: Thu, 3 Nov 2016 10:01:32 -0400 Subject: [PATCH 1/8] ENH: Continuous Integration for Slicer Run tests (which are built in the slicer/slicer-test docker image) with X_Window_System supported inside the slicer/slicer-test:opengl docker image based on thewtex/opengl:centos --- CMake/CircleCI/CircleCI_Slicer_Docker.cmake | 90 ++++++++++++ CMake/CircleCI/Dockerfile | 42 ++++++ CMake/CircleCI/build.sh | 5 + CMake/CircleCI/push.sh | 8 ++ CMake/CircleCI/run.sh | 16 +++ CMake/CircleCI/run_opengl.sh | 151 ++++++++++++++++++++ CMake/CircleCI/test.sh | 19 +++ circle.yml | 1 + 8 files changed, 332 insertions(+) create mode 100644 CMake/CircleCI/CircleCI_Slicer_Docker.cmake create mode 100644 CMake/CircleCI/Dockerfile create mode 100755 CMake/CircleCI/build.sh create mode 100755 CMake/CircleCI/push.sh create mode 100755 CMake/CircleCI/run.sh create mode 100755 CMake/CircleCI/run_opengl.sh create mode 100755 CMake/CircleCI/test.sh diff --git a/CMake/CircleCI/CircleCI_Slicer_Docker.cmake b/CMake/CircleCI/CircleCI_Slicer_Docker.cmake new file mode 100644 index 00000000000..e6dd4f68681 --- /dev/null +++ b/CMake/CircleCI/CircleCI_Slicer_Docker.cmake @@ -0,0 +1,90 @@ +############################################################################## +# +# Library: Slicer +# +# Copyright 2010 Kitware Inc. 28 Corporate Drive, +# Clifton Park, NY, 12065, USA. +# +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +############################################################################## + +set( Slicer_SOURCE_DIR "/usr/src/Slicer" ) +set( Slicer_BINARY_DIR "/usr/src/Slicer-build" ) + +set( CTEST_SOURCE_DIRECTORY "${Slicer_SOURCE_DIR}" ) +set( CTEST_BINARY_DIRECTORY "${Slicer_BINARY_DIR}/Slicer-build" ) + +######### Options for CDash ######### + +set( SITE_CTEST_MODE "Experimental" ) # Experimental, Continuous, or Nightly + +set( CTEST_CMAKE_GENERATOR "Unix Makefiles" ) # Ninja or Unix Makefiles + +set( Slicer_GIT_REPOSITORY "https://github.com/Slicer/Slicer.git" ) + +# Follow format for caps and components as given on Slicer dashboard +set( CTEST_SITE "CircleCI_Slicer" ) + +# Follow format for caps and components as given on Slicer dashboard +set( SITE_PLATFORM "Ubuntu-64" ) + +# Use SITE_BUILD_TYPE specified by circle.yml +set( SITE_BUILD_TYPE "$ENV{SITE_BUILD_TYPE}" ) +if( NOT( (SITE_BUILD_TYPE MATCHES "Debug") OR (SITE_BUILD_TYPE MATCHES "Release") ) ) + set( SITE_BUILD_TYPE "Debug" ) # Release, Debug +endif( NOT( (SITE_BUILD_TYPE MATCHES "Debug") OR (SITE_BUILD_TYPE MATCHES "Release") ) ) + +# Named SITE_BUILD_NAME +string( SUBSTRING $ENV{CIRCLE_SHA1} 0 7 commit ) +set( what $ENV{CIRCLE_BRANCH} ) +set( SITE_BUILD_NAME_SUFFIX _${commit}_${what} ) + +set( SITE_BUILD_NAME "CircleCI-${SITE_PLATFORM}-${SITE_BUILD_TYPE}${SITE_BUILD_NAME_SUFFIX}" ) + +set( CTEST_BUILD_NAME "${SITE_BUILD_NAME}-BuildTest-${SITE_CTEST_MODE}" ) + +######### Config ########## + +set( CTEST_CONFIGURATION_TYPE "${SITE_BUILD_TYPE}" ) +set( CMAKE_BUILD_TYPE "${SITE_BUILD_TYPE}" ) +set( BUILD_TESTING ON ) + +#set( TEST_GUI "qSlicerBaseQTGUICxxTests" ) +#set( CTEST_BUILD_TARGET "${TEST_GUI}" ) + +#set( BUILD_TOOL_FLAGS "-j8" ) + +#set( RUN_TEST_GUI "qSlicerWidgetTest2" ) +#set( CTEST_TEST_TARGET "${RUN_TEST_GUI}" ) + +######### Submit ########## + +# Done automatically by reading the CTestConfig.cmake file inside /usr/src/Slicer + +########## Run ctest ######### + +ctest_start( "${SITE_CTEST_MODE}" ) + +#ctest_configure( BUILD ${CTEST_BINARY_DIR} +# SOURCE "${Slicer_SOURCE_DIR}" ) + +#ctest_build( BUILD ${CTEST_BINARY_DIR} ) +# TARGET "${TEST_GUI}" ) + +ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" ) +# INCLUDE "${RUN_TEST_GUI}" ) + +ctest_submit() diff --git a/CMake/CircleCI/Dockerfile b/CMake/CircleCI/Dockerfile new file mode 100644 index 00000000000..df1438f461b --- /dev/null +++ b/CMake/CircleCI/Dockerfile @@ -0,0 +1,42 @@ +FROM thewtex/opengl:centos +MAINTAINER 3D Slicer Community +# Test Slicer +# Graphic rendering support is required, so we use a base image that support +# rendering. + +# Build the same version of CMake that is in thewtex/centos-build +WORKDIR /usr/src +RUN git clone git://cmake.org/cmake.git CMake && \ + cd CMake && \ + git checkout v3.4.1 && \ + mkdir /usr/src/CMake-build && \ + cd /usr/src/CMake-build && \ + /usr/src/CMake/bootstrap \ + --parallel=$(grep -c processor /proc/cpuinfo) \ + --prefix=/usr && \ + make -j$(grep -c processor /proc/cpuinfo) && \ + ./bin/cmake \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DCMAKE_USE_OPENSSL:BOOL=ON . && \ + make install && \ + cd .. && rm -rf CMake* + +RUN yum update -y && \ + yum install -y glx-utils \ + subversion \ + build-essential \ + qt4-dev-tools \ + x11-xserver-utils \ + x11vnc \ + xinit \ + libxt-dev \ + ninja \ + libboost-all-dev \ + wget \ + vim \ + valgrind \ + python2.7-dev + +# Because the sources are mounted, we cannot `chown` on `/usr/src` +# It authorizes to write in Slicer-build to recover logs of ctest +ENV APP "sudo chown -R user.user /usr/src/Slicer-build && /usr/src/Slicer/CMake/CircleCI/test.sh" diff --git a/CMake/CircleCI/build.sh b/CMake/CircleCI/build.sh new file mode 100755 index 00000000000..d964a561e8b --- /dev/null +++ b/CMake/CircleCI/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +script_dir="`cd $(dirname $0); pwd`" + +docker build -t slicer/slicer-test:opengl $script_dir diff --git a/CMake/CircleCI/push.sh b/CMake/CircleCI/push.sh new file mode 100755 index 00000000000..84468c97f4e --- /dev/null +++ b/CMake/CircleCI/push.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +die() { + echo "Error: $@" 1>&2 + exit 1; +} + +docker push slicer/slicer-test:opengl diff --git a/CMake/CircleCI/run.sh b/CMake/CircleCI/run.sh new file mode 100755 index 00000000000..c09f78edc5b --- /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 --env="SITE_BUILD_TYPE=$3" \ + -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..8ce9806673d --- /dev/null +++ b/CMake/CircleCI/run_opengl.sh @@ -0,0 +1,151 @@ +#!/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 + +# We do not need the source BUT if we don't mount, we can't launch test.sh +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 + +docker wait $container >/dev/null + +print_app_output + +# vim: noexpandtab shiftwidth=4 tabstop=4 softtabstop=0 diff --git a/CMake/CircleCI/test.sh b/CMake/CircleCI/test.sh new file mode 100755 index 00000000000..75484d11319 --- /dev/null +++ b/CMake/CircleCI/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# This is a script to build the modules and run the test suite in the base +# Docker container. + +die() { + echo "Error: $@" 1>&2 + exit 1; +} + +mkdir /usr/src/Slicer-build +cd /usr/src/Slicer-build || die "Could not cd into the build directory" + +mkdir /usr/src/Slicer-build/Slicer-build +cd /usr/src/Slicer-build/Slicer-build || die "Could not cd into the build directory" + +ctest \ + -S /usr/src/Slicer/CMake/CircleCI/CircleCI_Slicer_Docker.cmake \ + -VV || die "ctest failed" diff --git a/circle.yml b/circle.yml index c249cc3d72b..31bdc887f1b 100644 --- a/circle.yml +++ b/circle.yml @@ -20,3 +20,4 @@ test: - "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 $SITE_BUILD_TYPE From 6247258f3b8db51d79f00253995d774399266e9b Mon Sep 17 00:00:00 2001 From: Mayeul Chassagnard Date: Fri, 28 Oct 2016 16:34:23 -0400 Subject: [PATCH 2/8] ENH: Update README to .rst format with links to CDash & CircleCI --- Applications/SlicerApp/CMakeLists.txt | 2 +- CMake/SlicerGenerateSlicerConfig.cmake | 2 +- README.txt => README.rst | 14 ++++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) rename README.txt => README.rst (53%) 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/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: From 5224297159b57d619ac2a2407b0873bc479dd256 Mon Sep 17 00:00:00 2001 From: Mayeul Chassagnard Date: Wed, 26 Oct 2016 09:31:14 -0400 Subject: [PATCH 3/8] ENH: Pull & Cache image slicer/slicer-test(& :opengl) --- circle.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/circle.yml b/circle.yml index 31bdc887f1b..d741c6cc586 100644 --- a/circle.yml +++ b/circle.yml @@ -14,6 +14,12 @@ 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: From 23a96e26e4d8fb0034bf811d2ec0d9a089d67c3a Mon Sep 17 00:00:00 2001 From: Mayeul Chassagnard Date: Thu, 27 Oct 2016 16:16:39 -0400 Subject: [PATCH 4/8] ENH: Slicer src are not mounted anymore in slicer/slicer-test:opengl image * Remove mounted src (-v ...) from run-opengl.sh * Keep only useful files needed to run the tests from the src such as: - test.sh - CircleCI_Slicer_Docker.cmake - sumbit config CTestConfig.cmake (we copied directly what there is inside, into CircleCI_Slicer_Docker.cmake) --- CMake/CircleCI/CircleCI_Slicer_Docker.cmake | 10 ++++++++-- CMake/CircleCI/Dockerfile | 8 +++++--- CMake/CircleCI/run_opengl.sh | 9 ++++----- CMake/CircleCI/test.sh | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CMake/CircleCI/CircleCI_Slicer_Docker.cmake b/CMake/CircleCI/CircleCI_Slicer_Docker.cmake index e6dd4f68681..9e106f8e7ae 100644 --- a/CMake/CircleCI/CircleCI_Slicer_Docker.cmake +++ b/CMake/CircleCI/CircleCI_Slicer_Docker.cmake @@ -70,9 +70,15 @@ set( BUILD_TESTING ON ) #set( RUN_TEST_GUI "qSlicerWidgetTest2" ) #set( CTEST_TEST_TARGET "${RUN_TEST_GUI}" ) -######### Submit ########## +######### Submit Config ########## -# Done automatically by reading the CTestConfig.cmake file inside /usr/src/Slicer +set(CTEST_PROJECT_NAME "Slicer") +set(CTEST_NIGHTLY_START_TIME "3:00:00 UTC") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "slicer.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=Slicer4") +set(CTEST_DROP_SITE_CDASH TRUE) ########## Run ctest ######### diff --git a/CMake/CircleCI/Dockerfile b/CMake/CircleCI/Dockerfile index df1438f461b..a48d899ea02 100644 --- a/CMake/CircleCI/Dockerfile +++ b/CMake/CircleCI/Dockerfile @@ -37,6 +37,8 @@ RUN yum update -y && \ valgrind \ python2.7-dev -# Because the sources are mounted, we cannot `chown` on `/usr/src` -# It authorizes to write in Slicer-build to recover logs of ctest -ENV APP "sudo chown -R user.user /usr/src/Slicer-build && /usr/src/Slicer/CMake/CircleCI/test.sh" +COPY test.sh /usr/src/test.sh +COPY CircleCI_Slicer_Docker.cmake /usr/src/CircleCI_Slicer_Docker.cmake + +# Authorize to write in Slicer-build to recover logs of ctest +ENV APP "sudo chown -R user.user /usr/src/Slicer-build && /usr/src/test.sh" diff --git a/CMake/CircleCI/run_opengl.sh b/CMake/CircleCI/run_opengl.sh index 8ce9806673d..21e2f574fcb 100755 --- a/CMake/CircleCI/run_opengl.sh +++ b/CMake/CircleCI/run_opengl.sh @@ -114,12 +114,11 @@ if [ -z "$quiet" ]; then fi fi -# We do not need the source BUT if we don't mount, we can't launch test.sh -pwd_dir="`cd $(dirname $0)/../..; pwd`" +#pwd_dir="`cd $(dirname $0)/../..; pwd`" mount_local="" -if [ "${os}" = "Linux" ] || [ "${os}" = "Darwin" ]; then - mount_local=" -v ${pwd_dir}:/usr/src/Slicer " -fi +#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" diff --git a/CMake/CircleCI/test.sh b/CMake/CircleCI/test.sh index 75484d11319..d0aa588e2f5 100755 --- a/CMake/CircleCI/test.sh +++ b/CMake/CircleCI/test.sh @@ -15,5 +15,5 @@ mkdir /usr/src/Slicer-build/Slicer-build cd /usr/src/Slicer-build/Slicer-build || die "Could not cd into the build directory" ctest \ - -S /usr/src/Slicer/CMake/CircleCI/CircleCI_Slicer_Docker.cmake \ + -S /usr/src/CircleCI_Slicer_Docker.cmake \ -VV || die "ctest failed" From e45ffda4d73410f11bfedb1b0d8b3b075d974f4e Mon Sep 17 00:00:00 2001 From: Mayeul Chassagnard Date: Mon, 31 Oct 2016 11:43:11 -0400 Subject: [PATCH 5/8] ENH: Move slicer-test:opengl image from Slicer to SlicerDocker Only run.sh & run_opengl.sh are needed inside Slicer to be able to launch the automatic build & tests from circle.yml --- CMake/CircleCI/CircleCI_Slicer_Docker.cmake | 96 --------------------- CMake/CircleCI/Dockerfile | 44 ---------- CMake/CircleCI/build.sh | 5 -- CMake/CircleCI/push.sh | 8 -- CMake/CircleCI/test.sh | 19 ---- 5 files changed, 172 deletions(-) delete mode 100644 CMake/CircleCI/CircleCI_Slicer_Docker.cmake delete mode 100644 CMake/CircleCI/Dockerfile delete mode 100755 CMake/CircleCI/build.sh delete mode 100755 CMake/CircleCI/push.sh delete mode 100755 CMake/CircleCI/test.sh diff --git a/CMake/CircleCI/CircleCI_Slicer_Docker.cmake b/CMake/CircleCI/CircleCI_Slicer_Docker.cmake deleted file mode 100644 index 9e106f8e7ae..00000000000 --- a/CMake/CircleCI/CircleCI_Slicer_Docker.cmake +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################## -# -# Library: Slicer -# -# Copyright 2010 Kitware Inc. 28 Corporate Drive, -# Clifton Park, NY, 12065, USA. -# -# All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -############################################################################## - -set( Slicer_SOURCE_DIR "/usr/src/Slicer" ) -set( Slicer_BINARY_DIR "/usr/src/Slicer-build" ) - -set( CTEST_SOURCE_DIRECTORY "${Slicer_SOURCE_DIR}" ) -set( CTEST_BINARY_DIRECTORY "${Slicer_BINARY_DIR}/Slicer-build" ) - -######### Options for CDash ######### - -set( SITE_CTEST_MODE "Experimental" ) # Experimental, Continuous, or Nightly - -set( CTEST_CMAKE_GENERATOR "Unix Makefiles" ) # Ninja or Unix Makefiles - -set( Slicer_GIT_REPOSITORY "https://github.com/Slicer/Slicer.git" ) - -# Follow format for caps and components as given on Slicer dashboard -set( CTEST_SITE "CircleCI_Slicer" ) - -# Follow format for caps and components as given on Slicer dashboard -set( SITE_PLATFORM "Ubuntu-64" ) - -# Use SITE_BUILD_TYPE specified by circle.yml -set( SITE_BUILD_TYPE "$ENV{SITE_BUILD_TYPE}" ) -if( NOT( (SITE_BUILD_TYPE MATCHES "Debug") OR (SITE_BUILD_TYPE MATCHES "Release") ) ) - set( SITE_BUILD_TYPE "Debug" ) # Release, Debug -endif( NOT( (SITE_BUILD_TYPE MATCHES "Debug") OR (SITE_BUILD_TYPE MATCHES "Release") ) ) - -# Named SITE_BUILD_NAME -string( SUBSTRING $ENV{CIRCLE_SHA1} 0 7 commit ) -set( what $ENV{CIRCLE_BRANCH} ) -set( SITE_BUILD_NAME_SUFFIX _${commit}_${what} ) - -set( SITE_BUILD_NAME "CircleCI-${SITE_PLATFORM}-${SITE_BUILD_TYPE}${SITE_BUILD_NAME_SUFFIX}" ) - -set( CTEST_BUILD_NAME "${SITE_BUILD_NAME}-BuildTest-${SITE_CTEST_MODE}" ) - -######### Config ########## - -set( CTEST_CONFIGURATION_TYPE "${SITE_BUILD_TYPE}" ) -set( CMAKE_BUILD_TYPE "${SITE_BUILD_TYPE}" ) -set( BUILD_TESTING ON ) - -#set( TEST_GUI "qSlicerBaseQTGUICxxTests" ) -#set( CTEST_BUILD_TARGET "${TEST_GUI}" ) - -#set( BUILD_TOOL_FLAGS "-j8" ) - -#set( RUN_TEST_GUI "qSlicerWidgetTest2" ) -#set( CTEST_TEST_TARGET "${RUN_TEST_GUI}" ) - -######### Submit Config ########## - -set(CTEST_PROJECT_NAME "Slicer") -set(CTEST_NIGHTLY_START_TIME "3:00:00 UTC") - -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "slicer.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=Slicer4") -set(CTEST_DROP_SITE_CDASH TRUE) - -########## Run ctest ######### - -ctest_start( "${SITE_CTEST_MODE}" ) - -#ctest_configure( BUILD ${CTEST_BINARY_DIR} -# SOURCE "${Slicer_SOURCE_DIR}" ) - -#ctest_build( BUILD ${CTEST_BINARY_DIR} ) -# TARGET "${TEST_GUI}" ) - -ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" ) -# INCLUDE "${RUN_TEST_GUI}" ) - -ctest_submit() diff --git a/CMake/CircleCI/Dockerfile b/CMake/CircleCI/Dockerfile deleted file mode 100644 index a48d899ea02..00000000000 --- a/CMake/CircleCI/Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -FROM thewtex/opengl:centos -MAINTAINER 3D Slicer Community -# Test Slicer -# Graphic rendering support is required, so we use a base image that support -# rendering. - -# Build the same version of CMake that is in thewtex/centos-build -WORKDIR /usr/src -RUN git clone git://cmake.org/cmake.git CMake && \ - cd CMake && \ - git checkout v3.4.1 && \ - mkdir /usr/src/CMake-build && \ - cd /usr/src/CMake-build && \ - /usr/src/CMake/bootstrap \ - --parallel=$(grep -c processor /proc/cpuinfo) \ - --prefix=/usr && \ - make -j$(grep -c processor /proc/cpuinfo) && \ - ./bin/cmake \ - -DCMAKE_BUILD_TYPE:STRING=Release \ - -DCMAKE_USE_OPENSSL:BOOL=ON . && \ - make install && \ - cd .. && rm -rf CMake* - -RUN yum update -y && \ - yum install -y glx-utils \ - subversion \ - build-essential \ - qt4-dev-tools \ - x11-xserver-utils \ - x11vnc \ - xinit \ - libxt-dev \ - ninja \ - libboost-all-dev \ - wget \ - vim \ - valgrind \ - python2.7-dev - -COPY test.sh /usr/src/test.sh -COPY CircleCI_Slicer_Docker.cmake /usr/src/CircleCI_Slicer_Docker.cmake - -# Authorize to write in Slicer-build to recover logs of ctest -ENV APP "sudo chown -R user.user /usr/src/Slicer-build && /usr/src/test.sh" diff --git a/CMake/CircleCI/build.sh b/CMake/CircleCI/build.sh deleted file mode 100755 index d964a561e8b..00000000000 --- a/CMake/CircleCI/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -script_dir="`cd $(dirname $0); pwd`" - -docker build -t slicer/slicer-test:opengl $script_dir diff --git a/CMake/CircleCI/push.sh b/CMake/CircleCI/push.sh deleted file mode 100755 index 84468c97f4e..00000000000 --- a/CMake/CircleCI/push.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -die() { - echo "Error: $@" 1>&2 - exit 1; -} - -docker push slicer/slicer-test:opengl diff --git a/CMake/CircleCI/test.sh b/CMake/CircleCI/test.sh deleted file mode 100755 index d0aa588e2f5..00000000000 --- a/CMake/CircleCI/test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# This is a script to build the modules and run the test suite in the base -# Docker container. - -die() { - echo "Error: $@" 1>&2 - exit 1; -} - -mkdir /usr/src/Slicer-build -cd /usr/src/Slicer-build || die "Could not cd into the build directory" - -mkdir /usr/src/Slicer-build/Slicer-build -cd /usr/src/Slicer-build/Slicer-build || die "Could not cd into the build directory" - -ctest \ - -S /usr/src/CircleCI_Slicer_Docker.cmake \ - -VV || die "ctest failed" From 5a4b5cb170f06f5a3d323cd4781e44861f1508c5 Mon Sep 17 00:00:00 2001 From: Mayeul Chassagnard Date: Thu, 10 Nov 2016 10:41:53 -0500 Subject: [PATCH 6/8] BUG: Error removing container by circleCI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FROM https://circleci.com/docs/docker-btrfs-error/ ``` When Docker creates a container, the container is created on Btrfs, the filesystem that we use to store all build containers, and removing a container is equivalent to removing a Btrfs subvolume. However, the Docker process doesn’t have permission to remove btrfs subvolumes, resulting in the error ``` BUG: --rm=false replaced by commenting docker rm cmd --- CMake/CircleCI/run.sh | 2 +- CMake/CircleCI/run_opengl.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMake/CircleCI/run.sh b/CMake/CircleCI/run.sh index c09f78edc5b..e93f967dd29 100755 --- a/CMake/CircleCI/run.sh +++ b/CMake/CircleCI/run.sh @@ -13,4 +13,4 @@ $script_dir/run_opengl.sh \ -r --volumes-from -r slicer-build-with-test # Remove the container used to mount volumes from slicer-build -docker rm slicer-build-with-test +#docker rm slicer-build-with-test diff --git a/CMake/CircleCI/run_opengl.sh b/CMake/CircleCI/run_opengl.sh index 21e2f574fcb..2e9f7a55647 100755 --- a/CMake/CircleCI/run_opengl.sh +++ b/CMake/CircleCI/run_opengl.sh @@ -92,7 +92,7 @@ url="http://${ip}:$port" cleanup() { docker stop $container >/dev/null - docker rm $container >/dev/null + #docker rm $container >/dev/null } running=$(docker ps -a -q --filter "name=${container}") From fba473648bd27525b29ca8fac10bebbc7a632038 Mon Sep 17 00:00:00 2001 From: Mayeul Chassagnard Date: Thu, 17 Nov 2016 17:32:09 -0500 Subject: [PATCH 7/8] ENH: Fix CircleCI Timed Out by displaying dot every minute when run tests Because tests results were displayed only at the end, CircleCI was running into a timed out due to no output during more than 10minutes. Fixed by displaying a dot every minute. --- CMake/CircleCI/run_opengl.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMake/CircleCI/run_opengl.sh b/CMake/CircleCI/run_opengl.sh index 2e9f7a55647..39a2222a58d 100755 --- a/CMake/CircleCI/run_opengl.sh +++ b/CMake/CircleCI/run_opengl.sh @@ -143,7 +143,14 @@ print_app_output() { trap "docker stop $container >/dev/null && print_app_output" SIGINT SIGTERM -docker wait $container >/dev/null +# 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 From 7f73a93c19057881483ad3d3ce20ce6521639dbc Mon Sep 17 00:00:00 2001 From: Mayeul Chassagnard Date: Wed, 4 Jan 2017 15:03:29 -0500 Subject: [PATCH 8/8] STYLE: Remove SITE_BUILD_TYPE Information This information should be provided by slicer-build docker image (The place where Slicer is built) --- CMake/CircleCI/run.sh | 2 +- circle.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMake/CircleCI/run.sh b/CMake/CircleCI/run.sh index e93f967dd29..a216509872c 100755 --- a/CMake/CircleCI/run.sh +++ b/CMake/CircleCI/run.sh @@ -9,7 +9,7 @@ docker run -d --name slicer-build-with-test slicer/slicer-test bash $script_dir/run_opengl.sh \ -i slicer/slicer-test:opengl \ -p 6081 \ - -r --env="CIRCLE_SHA1=$1" -r --env="CIRCLE_BRANCH=$2" -r --env="SITE_BUILD_TYPE=$3" \ + -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 diff --git a/circle.yml b/circle.yml index d741c6cc586..48b44a2185f 100644 --- a/circle.yml +++ b/circle.yml @@ -26,4 +26,4 @@ test: - "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 $SITE_BUILD_TYPE + - bash ./CMake/CircleCI/run.sh $CIRCLE_SHA1 $CIRCLE_BRANCH