From fbdae09e0be4eb713d4351333e9af0dda755b05c Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 16:55:34 +0100 Subject: [PATCH 01/13] [ci/conda] Remove docker specific stage Now all tests are run on the build stages --- .gitlab-ci.yml | 29 ----------------------------- conda/meta.yaml | 7 +++---- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 00ab79ce..e4b181ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,6 @@ variables: # Definition of our build pipeline order stages: - build - - docker - deploy - pypi @@ -63,23 +62,6 @@ stages: key: "macosx-cache" -# Docker host based testing (must be run inside dind or docker-enabled host) -.docker_test_linux_template: &linux_docker_job - stage: docker - before_script: - # safe keep artifacts as before_build.sh will erase those... - - mv ${CONDA_ROOT}/conda-bld . - - ./_ci/install.sh _ci master #updates ci support scripts - - ./_ci/before_build.sh - - mv conda-bld ${CONDA_ROOT} - - ./scripts/before_test.sh - script: - - export BEAT_DOCKER_TESTS=true - - BOB_TEST_ONLY=true ./_ci/build.sh - after_script: - - ./_ci/after_build.sh - - build_linux_36: <<: *linux_build_job variables: @@ -100,17 +82,6 @@ build_macosx_36: PYTHON_VERSION: "3.6" -# Docker host based testing -docker_linux_36: - <<: *linux_docker_job - variables: - PYTHON_VERSION: "3.6" - dependencies: - - build_linux_36 - tags: - - docker-build - - # Deploy targets .deploy_template: &deploy_job stage: deploy diff --git a/conda/meta.yaml b/conda/meta.yaml index ca26dc15..41dad405 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -53,10 +53,9 @@ test: commands: - worker --help - - if [ -n "${BEAT_DOCKER_TESTS}" ]; then nosetests --with-coverage --cover-package={{ name }} -sv {{ name }}; fi - - if [ -z "${BEAT_DOCKER_TESTS}" ]; then nosetests --with-coverage --cover-package={{ name }} -sv {{ name }} --exclude=".*test_docker.*"; fi - - if [ -z "${BEAT_DOCKER_TESTS}" ]; then sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx; fi - - if [ -z "${BEAT_DOCKER_TESTS}" ]; then sphinx-build -aEb doctest {{ project_dir }}/doc sphinx; fi + - nosetests --with-coverage --cover-package={{ name }} -sv {{ name }} + - sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx + - sphinx-build -aEb doctest {{ project_dir }}/doc sphinx - conda inspect linkages -p $PREFIX {{ name }} # [not win] - conda inspect objects -p $PREFIX {{ name }} # [osx] -- GitLab From 836031b6a7a0c7ce6c294eab14363c481b426eda Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 16:57:39 +0100 Subject: [PATCH 02/13] [ci] Update docker images versions and pull them --- .gitlab-ci.yml | 1 + buildout_compile_cxx_algorithm.sh | 2 +- buildout_pull_images.sh | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e4b181ab..ce72fe32 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,7 @@ stages: - chmod 755 _ci/install.sh - ./_ci/install.sh _ci master #installs ci support scripts - ./_ci/before_build.sh + - ./scripts/before_test.sh #pulls required docker images script: - ./_ci/build.sh after_script: diff --git a/buildout_compile_cxx_algorithm.sh b/buildout_compile_cxx_algorithm.sh index 84cd57fd..2ff9cab7 100755 --- a/buildout_compile_cxx_algorithm.sh +++ b/buildout_compile_cxx_algorithm.sh @@ -26,7 +26,7 @@ if [ "$1" == "build" ]; then # V2 builds echo "Building v2 algorithm" - DOCKER_IMAGE="docker.idiap.ch/beat/beat.env.client:2.0.0" + DOCKER_IMAGE="docker.idiap.ch/beat/beat.env.client:2.0.0r1" types=('legacy' 'autonomous' 'sequential' 'analyzer') # types=('autonomous') for type in "${types[@]}"; do diff --git a/buildout_pull_images.sh b/buildout_pull_images.sh index f407a481..f9c571be 100755 --- a/buildout_pull_images.sh +++ b/buildout_pull_images.sh @@ -1,8 +1,8 @@ #! /bin/bash IMAGES=( - docker.idiap.ch/beat/beat.env.system.python:1.3.0r1 - docker.idiap.ch/beat/beat.env.db.examples:1.4.0r1 + docker.idiap.ch/beat/beat.env.system.python:1.3.0r3 + docker.idiap.ch/beat/beat.env.db.examples:1.4.0r3 docker.idiap.ch/beat/beat.env.cxx:2.0.0r1 docker.idiap.ch/beat/beat.env.client:2.0.0r1 ) @@ -33,7 +33,7 @@ if [ ${#MISSING_IMAGES[@]} -gt 0 ]; then MUST_PULL=0 if [ -z "$CI_SERVER" ]; then - read -p "Do you want to install them now? (yes/no) " -n 1 -r + read -p "Do you want to install them now? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then -- GitLab From 875fac412c0c3ed2f5f322e353a10a5e0b850f2e Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 16:58:01 +0100 Subject: [PATCH 03/13] [test][prefix] Update root_folder path for macOS builds --- beat/core/test/prefix/databases/empty_protocol_sets/1.json | 2 +- beat/core/test/prefix/databases/empty_protocols/1.json | 2 +- beat/core/test/prefix/databases/empty_set_outputs/1.json | 2 +- beat/core/test/prefix/databases/large/1.json | 2 +- beat/core/test/prefix/databases/missing_protocol_name/1.json | 2 +- beat/core/test/prefix/databases/missing_protocols/1.json | 2 +- beat/core/test/prefix/databases/missing_set_name/1.json | 2 +- beat/core/test/prefix/databases/missing_set_outputs/1.json | 2 +- beat/core/test/prefix/databases/missing_set_view/1.json | 2 +- beat/core/test/prefix/databases/mixed_protocol_names/1.json | 2 +- beat/core/test/prefix/databases/mixed_set_names/1.json | 2 +- beat/core/test/prefix/databases/same_protocol_names/1.json | 2 +- beat/core/test/prefix/databases/same_set_names/1.json | 2 +- beat/core/test/prefix/databases/simple/1.json | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/beat/core/test/prefix/databases/empty_protocol_sets/1.json b/beat/core/test/prefix/databases/empty_protocol_sets/1.json index fef2d3f2..ef4c2af0 100644 --- a/beat/core/test/prefix/databases/empty_protocol_sets/1.json +++ b/beat/core/test/prefix/databases/empty_protocol_sets/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "double", diff --git a/beat/core/test/prefix/databases/empty_protocols/1.json b/beat/core/test/prefix/databases/empty_protocols/1.json index 6884a1bb..aa02e6a9 100644 --- a/beat/core/test/prefix/databases/empty_protocols/1.json +++ b/beat/core/test/prefix/databases/empty_protocols/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ ] } diff --git a/beat/core/test/prefix/databases/empty_set_outputs/1.json b/beat/core/test/prefix/databases/empty_set_outputs/1.json index 6fde45ea..c5ea0efe 100644 --- a/beat/core/test/prefix/databases/empty_set_outputs/1.json +++ b/beat/core/test/prefix/databases/empty_set_outputs/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "double", diff --git a/beat/core/test/prefix/databases/large/1.json b/beat/core/test/prefix/databases/large/1.json index f12c594f..2c8bc3a8 100644 --- a/beat/core/test/prefix/databases/large/1.json +++ b/beat/core/test/prefix/databases/large/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "large", diff --git a/beat/core/test/prefix/databases/missing_protocol_name/1.json b/beat/core/test/prefix/databases/missing_protocol_name/1.json index 91559e22..49a46140 100644 --- a/beat/core/test/prefix/databases/missing_protocol_name/1.json +++ b/beat/core/test/prefix/databases/missing_protocol_name/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "sets": [ diff --git a/beat/core/test/prefix/databases/missing_protocols/1.json b/beat/core/test/prefix/databases/missing_protocols/1.json index ebadcb19..7c90729b 100644 --- a/beat/core/test/prefix/databases/missing_protocols/1.json +++ b/beat/core/test/prefix/databases/missing_protocols/1.json @@ -1,3 +1,3 @@ { - "root_folder": "/path/not/set" + "root_folder": "/tmp/path/not/set" } diff --git a/beat/core/test/prefix/databases/missing_set_name/1.json b/beat/core/test/prefix/databases/missing_set_name/1.json index c083acdb..b81a112b 100644 --- a/beat/core/test/prefix/databases/missing_set_name/1.json +++ b/beat/core/test/prefix/databases/missing_set_name/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "double", diff --git a/beat/core/test/prefix/databases/missing_set_outputs/1.json b/beat/core/test/prefix/databases/missing_set_outputs/1.json index c2132825..3b2cfa28 100644 --- a/beat/core/test/prefix/databases/missing_set_outputs/1.json +++ b/beat/core/test/prefix/databases/missing_set_outputs/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "double", diff --git a/beat/core/test/prefix/databases/missing_set_view/1.json b/beat/core/test/prefix/databases/missing_set_view/1.json index a910e587..22051b0f 100644 --- a/beat/core/test/prefix/databases/missing_set_view/1.json +++ b/beat/core/test/prefix/databases/missing_set_view/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "double", diff --git a/beat/core/test/prefix/databases/mixed_protocol_names/1.json b/beat/core/test/prefix/databases/mixed_protocol_names/1.json index ec816823..5fdd6c78 100644 --- a/beat/core/test/prefix/databases/mixed_protocol_names/1.json +++ b/beat/core/test/prefix/databases/mixed_protocol_names/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "protocol", diff --git a/beat/core/test/prefix/databases/mixed_set_names/1.json b/beat/core/test/prefix/databases/mixed_set_names/1.json index b97af0da..2bc02b0c 100644 --- a/beat/core/test/prefix/databases/mixed_set_names/1.json +++ b/beat/core/test/prefix/databases/mixed_set_names/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "double", diff --git a/beat/core/test/prefix/databases/same_protocol_names/1.json b/beat/core/test/prefix/databases/same_protocol_names/1.json index 024f95ae..ea8f93f3 100644 --- a/beat/core/test/prefix/databases/same_protocol_names/1.json +++ b/beat/core/test/prefix/databases/same_protocol_names/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "double", diff --git a/beat/core/test/prefix/databases/same_set_names/1.json b/beat/core/test/prefix/databases/same_set_names/1.json index bbbe91e8..deabf9aa 100644 --- a/beat/core/test/prefix/databases/same_set_names/1.json +++ b/beat/core/test/prefix/databases/same_set_names/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/path/not/set", + "root_folder": "/tmp/path/not/set", "protocols": [ { "name": "double", diff --git a/beat/core/test/prefix/databases/simple/1.json b/beat/core/test/prefix/databases/simple/1.json index dcc64d57..db336902 100644 --- a/beat/core/test/prefix/databases/simple/1.json +++ b/beat/core/test/prefix/databases/simple/1.json @@ -1,5 +1,5 @@ { - "root_folder": "/foo/bar", + "root_folder": "/tmp/foo/bar", "protocols": [ { "name": "protocol", -- GitLab From 00585f9e2aca4949c1668357966daf0360bb67bf Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 16:58:56 +0100 Subject: [PATCH 04/13] [ci] Update docker image versions to pull before test run --- scripts/before_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/before_test.sh b/scripts/before_test.sh index a4900189..2b85c1d6 100755 --- a/scripts/before_test.sh +++ b/scripts/before_test.sh @@ -10,8 +10,8 @@ check_env REGISTRY IMAGES=( "${REGISTRY}/beat/beat.env.system.python:1.3.0r3" "${REGISTRY}/beat/beat.env.db.examples:1.4.0r3" - "${REGISTRY}/beat/beat.env.cxx:2.0.0r0" - "${REGISTRY}/beat/beat.env.client:2.0.0r0" + "${REGISTRY}/beat/beat.env.cxx:2.0.0r1" + "${REGISTRY}/beat/beat.env.client:2.0.0r1" ) check_array_env IMAGES -- GitLab From 0da0f76d069942c7d3745b98f1035feb1ac87208 Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 17:01:00 +0100 Subject: [PATCH 05/13] [ci/buildout] Buildout and CI now share the same setup scripts Image pulling and cxx algorithm compilation are done in only one place now. --- .gitlab-ci.yml | 3 +- buildout.cfg | 9 +++- buildout_compile_cxx_algorithm.sh | 55 --------------------- buildout_pull_images.sh | 64 ------------------------ scripts/before_test.sh | 81 ++++++++++++++++++++++--------- 5 files changed, 67 insertions(+), 145 deletions(-) delete mode 100755 buildout_compile_cxx_algorithm.sh delete mode 100755 buildout_pull_images.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ce72fe32..a2ac76e0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,8 @@ stages: - chmod 755 _ci/install.sh - ./_ci/install.sh _ci master #installs ci support scripts - ./_ci/before_build.sh - - ./scripts/before_test.sh #pulls required docker images + - docker info + - ./scripts/before_test.sh build #pulls required docker images and compiles script: - ./_ci/build.sh after_script: diff --git a/buildout.cfg b/buildout.cfg index f4dd8303..7f4c3aea 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -1,8 +1,15 @@ [buildout] -parts = scripts +parts = scripts docker eggs = beat.core develop = . newest = false [scripts] recipe = bob.buildout:scripts + +[docker] +recipe = collective.recipe.cmd +cmds = BUILDOUT=true ./scripts/before_test.sh build +uninstall_cmds = +on_install = true +on_update = true diff --git a/buildout_compile_cxx_algorithm.sh b/buildout_compile_cxx_algorithm.sh deleted file mode 100755 index 2ff9cab7..00000000 --- a/buildout_compile_cxx_algorithm.sh +++ /dev/null @@ -1,55 +0,0 @@ -#! /bin/bash - -ALGORITHMS_ROOT="beat/core/test/prefix/algorithms/user" - - -BEAT_CORE_PATH=$(dirname "$0") -cd $BEAT_CORE_PATH - - -# Compilation of the algorithm -if [ "$1" == "build" ]; then - cd $ALGORITHMS_ROOT - -# # V1 build -# echo "Building v1 algorithm" -# DOCKER_IMAGE="docker.idiap.ch/beat/beat.env.client:1.3.0r1" -# tar -cf cxx_integers_echo.tar cxx_integers_echo/ -# docker run -dti --name build $DOCKER_IMAGE > /dev/null -# docker cp cxx_integers_echo.tar build:/tmp/cxx_integers_echo.tar -# docker exec build bash -c 'cd /tmp ; tar -xf /tmp/cxx_integers_echo.tar' -# docker exec build bash -c 'cd /tmp/cxx_integers_echo ; mkdir build ; cd build ; cmake .. ; make' -# docker cp build:/tmp/cxx_integers_echo/1.so cxx_integers_echo/. -# docker stop build > /dev/null -# docker rm build > /dev/null -# rm cxx_integers_echo.tar - -# V2 builds - echo "Building v2 algorithm" - DOCKER_IMAGE="docker.idiap.ch/beat/beat.env.client:2.0.0r1" - types=('legacy' 'autonomous' 'sequential' 'analyzer') - # types=('autonomous') - for type in "${types[@]}"; do - algorithm_name="cxx_integers_echo_$type" - archive_name="$algorithm_name.tar" - echo "$archive_name" "$algorithm_name/" - tar -cf "$archive_name" "$algorithm_name/" - docker run -dti --name build $DOCKER_IMAGE > /dev/null - docker cp "$archive_name" "build:/tmp/$archive_name" - docker exec build bash -c "cd /tmp ; tar -xf /tmp/$archive_name" - docker exec build bash -c "cd /tmp/$algorithm_name ; mkdir build ; cd build ; cmake .. ; make" - docker cp "build:/tmp/$algorithm_name/1.so" "$algorithm_name/." - docker stop build > /dev/null - docker rm build > /dev/null - rm "$archive_name" - done -fi - - -# Cleanup of the compiled algorithms -if [ "$1" == "clean" ]; then - rm -f "$ALGORITHMS_ROOT/cxx_integers_echo/1.so" - for type in ['legacy', 'autonomous', 'sequential', 'analyzer']; do - rm -f "$ALGORITHMS_ROOT/cxx_integers_echo_$type/1.so" - done -fi diff --git a/buildout_pull_images.sh b/buildout_pull_images.sh deleted file mode 100755 index f9c571be..00000000 --- a/buildout_pull_images.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/bash - -IMAGES=( - docker.idiap.ch/beat/beat.env.system.python:1.3.0r3 - docker.idiap.ch/beat/beat.env.db.examples:1.4.0r3 - docker.idiap.ch/beat/beat.env.cxx:2.0.0r1 - docker.idiap.ch/beat/beat.env.client:2.0.0r1 -) - - -# Find all the missing images -declare -a MISSING_IMAGES - -for IMAGE in ${IMAGES[@]}; do - IMAGE_HASH=$(docker images -q $IMAGE) - - if [ -z "$IMAGE_HASH" ]; then - MISSING_IMAGES+=($IMAGE) - fi -done - - -# If there are some images missing, ask the user if he wants to download them -if [ ${#MISSING_IMAGES[@]} -gt 0 ]; then - echo "--------------------------------------------------------------------------------------" - echo "The following docker images are required (at least for the tests), but were not found:" - echo - for IMAGE in ${MISSING_IMAGES[@]}; do - echo " - $IMAGE" - done - echo - - MUST_PULL=0 - - if [ -z "$CI_SERVER" ]; then - read -p "Do you want to install them now? (y/n) " -n 1 -r - echo - - if [[ $REPLY =~ ^[Yy]$ ]]; then - MUST_PULL=1 - fi - else - MUST_PULL=1 - fi - - if [ $MUST_PULL -eq 1 ]; then - # Log in the registry if needed - if [ -z "$CI_SERVER" ]; then - if ! grep -q "docker.idiap.ch" ~/.docker/config.json ; then - docker login docker.idiap.ch - fi - else - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN docker.idiap.ch - fi - - # Pull the images - for IMAGE in ${MISSING_IMAGES[@]}; do - echo - CMD="docker pull $IMAGE" - echo "> $CMD" - $CMD - done - fi -fi diff --git a/scripts/before_test.sh b/scripts/before_test.sh index 2b85c1d6..2fa83393 100755 --- a/scripts/before_test.sh +++ b/scripts/before_test.sh @@ -1,6 +1,33 @@ #!/usr/bin/env bash basedir=`pwd` + +if [ ! -e ${basedir}/_ci/functions.sh ]; then + # this will happen when executing buildout for the first time + mkdir ${basedir}/_ci + curl --silent "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/install.sh" > ${basedir}/_ci/install.sh + chmod 755 ${basedir}/_ci/install.sh + ${basedir}/_ci/install.sh ${basedir}/_ci master #installs ci support scripts +else + ${basedir}/_ci/install.sh ${basedir}/_ci master #updates ci support scripts +fi + +if [ "${BUILDOUT}" == "true" ]; then + export PATH=${basedir}/bin:${PATH} #use python from here + # when executing in the context of buildout, define dummies + export CI_PROJECT_URL=https://gitlab.idiap.ch/beat/beat.core + export CI_PROJECT_DIR=beat + export CI_PROJECT_PATH=beat/beat.core + export CI_PROJECT_NAME=beat.core + export CI_COMMIT_REF_NAME=master + export PYPIUSER=pypiuser + export PYPIPASS=pypipass + export DOCUSER=docuser + export DOCPASS=docpass + export CONDA_ROOT=${basedir}/miniconda + export DOCSERVER=https://www.idiap.ch/software/bob +fi + source ${basedir}/_ci/functions.sh REGISTRY="docker.idiap.ch" @@ -15,6 +42,10 @@ IMAGES=( ) check_array_env IMAGES +# Docker image to be used for compiling the algorithm +BEAT_CXX_DEV_ENVIRONMENT="${REGISTRY}/beat/beat.env.client:2.0.0r1" +check_env BEAT_CXX_DEV_ENVIRONMENT + missing=() log_info "Checking for minimal set of docker images..." for k in ${IMAGES[@]}; do @@ -47,10 +78,6 @@ if [[ "${#missing[@]}" > 0 ]]; then done fi -# Docker image to be used for compiling the algorithm -BEAT_CXX_DEV_ENVIRONMENT="${REGISTRY}/beat/beat.env.client:2.0.0r0" -check_env BEAT_CXX_DEV_ENVIRONMENT - # These are the algorithms that need to be compiled and which we'll test ALGORITHMS=( "prefix/algorithms/user/cxx_integers_echo_legacy/1" @@ -61,34 +88,40 @@ ALGORITHMS=( check_array_env ALGORITHMS # Check where the package root is -BEAT_CORE_TEST_DIR=$(python -c 'import beat.core.test as f; import os; print os.path.abspath(os.path.dirname(f.__file__))') +if [ "${BUILDOUT}" == "true" ]; then + BEAT_CORE_TEST_DIR="${basedir}/beat/core/test" +else + BEAT_CORE_TEST_DIR=$(python -c 'import beat.core.test as f; import os; print os.path.abspath(os.path.dirname(f.__file__))') +fi check_env BEAT_CORE_TEST_DIR # Compilation of the algorithms in the list above if [ "$1" == "build" ]; then - for k in "${ALGORITHMS[@]}"; do - algodir=$(dirname "${k}") - run_cmd docker run --rm --user=$(id -u gitlab-runner):$(id -g gitlab-runner) --volume="${BEAT_CORE_TEST_DIR}/scripts/build.sh:/build.sh" --volume="${BEAT_CORE_TEST_DIR}/${algodir}:/sources" --workdir="/sources" --entrypoint="bash" "${BEAT_CXX_DEV_ENVIRONMENT}" /build.sh - done + for k in "${ALGORITHMS[@]}"; do + algodir=$(dirname "${k}") + run_cmd docker run --rm --user=$(id -u):$(id -g) --volume="${BEAT_CORE_TEST_DIR}/scripts/build.sh:/build.sh" --volume="${BEAT_CORE_TEST_DIR}/${algodir}:/sources" --workdir="/sources" --entrypoint="bash" "${BEAT_CXX_DEV_ENVIRONMENT}" /build.sh + done fi # Cleanup of the compiled algorithms if [ "$1" == "clean" ]; then - for k in "${ALGORITHMS[@]}"; do - algodir=$(dirname "${k}") - run_cmd rm -f "${BEAT_CORE_TEST_DIR}/${algodir}/*.so" - run_cmd rm -rf "${BEAT_CORE_TEST_DIR}/${algodir}/build/" - done + for k in "${ALGORITHMS[@]}"; do + algodir=$(dirname "${k}") + run_cmd rm -f "${BEAT_CORE_TEST_DIR}/${algodir}/*.so" + run_cmd rm -rf "${BEAT_CORE_TEST_DIR}/${algodir}/build/" + done fi -# Makes sure we activate the base environment if available -run_cmd source ${CONDA_ROOT}/etc/profile.d/conda.sh -run_cmd conda activate base -export_env PATH +if [ "${BUILDOUT}" != "true" ]; then + # Makes sure we activate the base environment if available + run_cmd source ${CONDA_ROOT}/etc/profile.d/conda.sh + run_cmd conda activate base + export_env PATH -for subchannel in linux-64 osx-64 noarch; do - if [ ! -d ${CONDA_ROOT}/conda-bld/${subchannel} ]; then - run_cmd mkdir -p ${CONDA_ROOT}/conda-bld/${subchannel} - fi - run_cmd conda index ${CONDA_ROOT}/conda-bld/${subchannel} -done + for subchannel in linux-64 osx-64 noarch; do + if [ ! -d ${CONDA_ROOT}/conda-bld/${subchannel} ]; then + run_cmd mkdir -p ${CONDA_ROOT}/conda-bld/${subchannel} + fi + run_cmd conda index ${CONDA_ROOT}/conda-bld/${subchannel} + done +fi -- GitLab From aff5f364aaf352c5accfdc896ec14f99abea4fb7 Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 17:02:37 +0100 Subject: [PATCH 06/13] [buildout] Add uninstall cleanup command on buildout --- buildout.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildout.cfg b/buildout.cfg index 7f4c3aea..9deabb26 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -10,6 +10,6 @@ recipe = bob.buildout:scripts [docker] recipe = collective.recipe.cmd cmds = BUILDOUT=true ./scripts/before_test.sh build -uninstall_cmds = +uninstall_cmds = BUILDOUT=true ./scripts/before_test.sh cleanup on_install = true on_update = true -- GitLab From d06fb27e7ca8df72fb148d83e05198c38813e728 Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 17:03:20 +0100 Subject: [PATCH 07/13] [scripts][before_test] Remove obsolete indexing commands for conda --- scripts/before_test.sh | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/scripts/before_test.sh b/scripts/before_test.sh index 2fa83393..eb1d1448 100755 --- a/scripts/before_test.sh +++ b/scripts/before_test.sh @@ -111,17 +111,3 @@ if [ "$1" == "clean" ]; then run_cmd rm -rf "${BEAT_CORE_TEST_DIR}/${algodir}/build/" done fi - -if [ "${BUILDOUT}" != "true" ]; then - # Makes sure we activate the base environment if available - run_cmd source ${CONDA_ROOT}/etc/profile.d/conda.sh - run_cmd conda activate base - export_env PATH - - for subchannel in linux-64 osx-64 noarch; do - if [ ! -d ${CONDA_ROOT}/conda-bld/${subchannel} ]; then - run_cmd mkdir -p ${CONDA_ROOT}/conda-bld/${subchannel} - fi - run_cmd conda index ${CONDA_ROOT}/conda-bld/${subchannel} - done -fi -- GitLab From 5aa9f73df4d5beedc16318032e10a3f4af92299e Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 17:04:07 +0100 Subject: [PATCH 08/13] [ci] Use docker-enabled conda-builder image --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a2ac76e0..28ddb129 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,7 +39,7 @@ stages: <<: *build_job tags: - docker - image: continuumio/conda-concourse-ci + image: docker.idiap.ch/beat/beat.docker.ci artifacts: expire_in: 1 week paths: -- GitLab From c334943220bd21d26e4f68b7a19d923a6134e104 Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 17:04:48 +0100 Subject: [PATCH 09/13] [ci] Ensure we use docker-login before attempting to download containers from Idiap's registry --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 28ddb129..e90f6ee5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ # Definition of global variables (all stages) variables: CONDA_ROOT: "${CI_PROJECT_DIR}/miniconda" + DOCKER_REGISTRY: docker.idiap.ch # Definition of our build pipeline order @@ -23,6 +24,7 @@ stages: - ./_ci/install.sh _ci master #installs ci support scripts - ./_ci/before_build.sh - docker info + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN docker.idiap.ch - ./scripts/before_test.sh build #pulls required docker images and compiles script: - ./_ci/build.sh -- GitLab From 302a98034f44000419ccb682dcc45b0f838f859d Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 17:05:35 +0100 Subject: [PATCH 10/13] [scripts][before_tests] Fix python 2 print syntax --- scripts/before_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/before_test.sh b/scripts/before_test.sh index eb1d1448..17ce8313 100755 --- a/scripts/before_test.sh +++ b/scripts/before_test.sh @@ -91,7 +91,7 @@ check_array_env ALGORITHMS if [ "${BUILDOUT}" == "true" ]; then BEAT_CORE_TEST_DIR="${basedir}/beat/core/test" else - BEAT_CORE_TEST_DIR=$(python -c 'import beat.core.test as f; import os; print os.path.abspath(os.path.dirname(f.__file__))') + BEAT_CORE_TEST_DIR=$(python -c 'import beat.core.test as f; import os; print(os.path.abspath(os.path.dirname(f.__file__)))') fi check_env BEAT_CORE_TEST_DIR -- GitLab From b4dcc38a24166e86a52b53f3493571ec0353bcdd Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 14:51:02 +0100 Subject: [PATCH 11/13] [ci] Use docker-build in .gitlab-ci.yml for linux builds --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e90f6ee5..c947b702 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,7 +40,7 @@ stages: .build_linux_template: &linux_build_job <<: *build_job tags: - - docker + - docker-build image: docker.idiap.ch/beat/beat.docker.ci artifacts: expire_in: 1 week -- GitLab From 08912e2b0c526bfdc5db627610d28fde0d68901e Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 16:41:09 +0100 Subject: [PATCH 12/13] [ci] Remove outdated image entry from build section; Deploy betas from master only --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c947b702..4eaf3cfc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,6 @@ stages: <<: *build_job tags: - docker-build - image: docker.idiap.ch/beat/beat.docker.ci artifacts: expire_in: 1 week paths: @@ -104,7 +103,7 @@ deploy_beta: <<: *deploy_job environment: beta only: - - 1.7.x + - master deploy_stable: -- GitLab From 6a42bfb4b2caf314afc00de6733698c180dad4df Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Mon, 10 Dec 2018 18:52:32 +0100 Subject: [PATCH 13/13] [scripts][before_test] Slightly modify script to accomodate use from beat.web/buildout --- scripts/before_test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/before_test.sh b/scripts/before_test.sh index 17ce8313..f7b19f9c 100755 --- a/scripts/before_test.sh +++ b/scripts/before_test.sh @@ -13,7 +13,6 @@ else fi if [ "${BUILDOUT}" == "true" ]; then - export PATH=${basedir}/bin:${PATH} #use python from here # when executing in the context of buildout, define dummies export CI_PROJECT_URL=https://gitlab.idiap.ch/beat/beat.core export CI_PROJECT_DIR=beat @@ -30,6 +29,12 @@ fi source ${basedir}/_ci/functions.sh +if [ -e ${basedir}/bin ]; then + log_info "Found ${basedir}/bin directory, prepending to PATH..." + PATH=${basedir}/bin:${PATH} + export_env PATH +fi + REGISTRY="docker.idiap.ch" check_env REGISTRY -- GitLab