diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..07f6752e --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,13 @@ +# Files or directories with designated code owner. +# Branch with "Require review from Code Owners" will automaticaly trigger a request to a designated code owner + +# DevOps related +/build_system/ @RedLeader962 +/.github/ @RedLeader962 +/.dockerignore @RedLeader962 +/.gitignore @RedLeader962 + +# Core +/pointmatcher @boxanm @simonpierredeschenes @aguenette +/python @boxanm @simonpierredeschenes @aguenette +/utest @boxanm @simonpierredeschenes @aguenette diff --git a/build_system/.env b/build_system/.env index d30c0d3a..9b80e43c 100644 --- a/build_system/.env +++ b/build_system/.env @@ -2,7 +2,7 @@ # # Dockerhub or self hosted hub domain name # -LPM_PROJECT_DOCKERHUB=norlabulaval +NBS_DOCKERHUB_NAMESPACE=norlabulaval # # Repository url @@ -11,17 +11,14 @@ LPM_PROJECT_DOCKERHUB=norlabulaval # - Original repo: https://github.com/ethz-asl/libpointmatcher # - DEV repo: https://github.com/norlab-ulaval/libpointmatcher-build-system -# ToDo: on repository ownership transfer >> modify next bloc ↓↓ -LPM_LIBPOINTMATCHER_SRC_DOMAIN=ethz-asl -#LPM_LIBPOINTMATCHER_SRC_DOMAIN=norlab-ulaval +NBS_REPOSITORY_DOMAIN=norlab-ulaval -#LPM_LIBPOINTMATCHER_SRC_REPO_NAME=libpointmatcher-build-system # Temporary dev fork -LPM_LIBPOINTMATCHER_SRC_REPO_NAME=libpointmatcher +NBS_REPOSITORY_NAME=libpointmatcher # # Install script variables # -LPM_INSTALLED_LIBRARIES_PATH=/opt/percep3d_libraries +NBS_LIB_INSTALL_PATH=/opt/percep3d_libraries # # Docker built-in environment variable (do not change the variable name diff --git a/build_system/.env.build_matrix b/build_system/.env.build_matrix index b75eba85..48f596b0 100644 --- a/build_system/.env.build_matrix +++ b/build_system/.env.build_matrix @@ -2,28 +2,33 @@ # Build matrix variables # +# +# The compose file on which the build matrix will be crawled +# +NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE=docker-compose.libpointmatcher.yaml + # # Libpointmatcher version # -# 'head' is the latest push to the libpointmatcher master branch -#LPM_MATRIX_LIBPOINTMATCHER_VERSIONS=( 'v1.3.1' 'head' 'v2.0.test' ) -LPM_MATRIX_LIBPOINTMATCHER_VERSIONS=( 'head' ) +# 'latest' is the latest push to the libpointmatcher master branch +#NBS_MATRIX_REPOSITORY_VERSIONS=( 'v1.3.1' 'latest' 'v2.0.test' ) +NBS_MATRIX_REPOSITORY_VERSIONS=( 'latest' ) # # Libpointmatcher CMAKE_BUILD_TYPE # # Part of the build matrix used for assessing the state of the codebase # Note: 'None' for building dependencies images -LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE_SITREP=( 'Debug' 'Release' 'RelWithDebInfo' 'MinSizeRel' ) +NBS_MATRIX_CMAKE_BUILD_TYPE_SITREP=( 'Debug' 'Release' 'RelWithDebInfo' 'MinSizeRel' ) # Part of the build matrix used for PR -LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE=( 'Release' 'RelWithDebInfo' 'MinSizeRel' ) +NBS_MATRIX_CMAKE_BUILD_TYPE=( 'Release' 'RelWithDebInfo' 'MinSizeRel' ) # # LIBPOINTMATCHER supported OS # # (Priority) ToDo: implement OsX support for arm64-Darwin (ref task NMO-213) -#LPM_MATRIX_SUPPORTED_OS=( 'ubuntu' 'osx' ) -LPM_MATRIX_SUPPORTED_OS=( 'ubuntu' ) +#NBS_MATRIX_SUPPORTED_OS=( 'ubuntu' 'osx' ) +NBS_MATRIX_SUPPORTED_OS=( 'ubuntu' ) # # ubuntu supported versions @@ -31,13 +36,13 @@ LPM_MATRIX_SUPPORTED_OS=( 'ubuntu' ) # Ubuntu release: https://ubuntu.com/about/release-cycle # bionic=18.04 focal=20.04 jammy=22.04 # Part of the build matrix used for PR -LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS_SITREP=( 'bionic' 'focal' 'jammy' ) +NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS_SITREP=( 'bionic' 'focal' 'jammy' ) # Part of the build matrix used for assessing the state of the codebase # ToDo: fixme!! (ref task NMO-305 ﹅→ Build fail: ubuntu jammy with utest compilation). # Mute 'jammy' from the build matrix until then. -LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS=( 'bionic' 'focal' ) +NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS=( 'bionic' 'focal' ) # # iceboxed: implement other OS support (ref task NMO-213 OsX arm64-Darwin and NMO-210 OsX x86 CD components) -#LPM_MATRIX_OSX_SUPPORTED_VERSIONS=( 'monterey' 'ventura' ) -LPM_MATRIX_OSX_SUPPORTED_VERSIONS=( ) +#NBS_MATRIX_OSX_SUPPORTED_VERSIONS=( 'monterey' 'ventura' ) +NBS_MATRIX_OSX_SUPPORTED_VERSIONS=( ) diff --git a/build_system/.env.prompt b/build_system/.env.prompt index b4a01d91..e02f741a 100644 --- a/build_system/.env.prompt +++ b/build_system/.env.prompt @@ -1,14 +1,14 @@ -# (NICE TO HAVE) ToDo: refactor (ref task NMO-304 ♻︎ → Refactor .env.prompt variables prefixed by LPM_ to MSG_) -LPM_PROMPT_NAME="LPM" -LPM_SPLASH_NAME="Libpoinmatcher" -LPM_BUILD_SYSTEM_SPLASH_NAME="Libpoinmatcher Build System" +# (NICE TO HAVE) ToDo: refactor (ref task NMO-304 ♻︎ → Refactor .env.prompt variables prefixed by NBS_ to MSG_) +NBS_PROMPT_NAME="LPM" +NBS_SPLASH_NAME="Libpoinmatcher" +NBS_BUILD_SYSTEM_SPLASH_NAME="Libpoinmatcher Build System" -LPM_LINE_CHAR_BUILDER_LVL1='▉' -LPM_LINE_CHAR_BUILDER_LVL2='⣿' -LPM_LINE_CHAR_INSTALLER=':' -LPM_LINE_CHAR_UTIL='.' -LPM_LINE_CHAR_TEST=' ' +NBS_LINE_CHAR_BUILDER_LVL1='▉' +NBS_LINE_CHAR_BUILDER_LVL2='⣿' +NBS_LINE_CHAR_INSTALLER=':' +NBS_LINE_CHAR_UTIL='.' +NBS_LINE_CHAR_TEST=' ' # # Formating environment variables @@ -33,12 +33,12 @@ MSG_DONE_FORMAT="\033[1;32m" MSG_WARNING_FORMAT="\033[1;33m" MSG_END_FORMAT="\033[0m" -MSG_AWAITING_INPUT="${MSG_BASE_FORMAT}[${LPM_PROMPT_NAME} awaiting input]${MSG_END_FORMAT}" -MSG_BASE="${MSG_BASE_FORMAT}[${LPM_PROMPT_NAME}]${MSG_END_FORMAT}" -#MSG_DONE="\033[1;32m[${LPM_PROMPT_NAME} done]${MSG_END_FORMAT}" -MSG_DONE="${MSG_DONE_FORMAT}[${LPM_PROMPT_NAME} done]${MSG_END_FORMAT}" -MSG_WARNING="${MSG_WARNING_FORMAT}[${LPM_PROMPT_NAME} warning]${MSG_END_FORMAT}" -MSG_ERROR="${MSG_ERROR_FORMAT}[${LPM_PROMPT_NAME} error]${MSG_END_FORMAT}" +MSG_AWAITING_INPUT="${MSG_BASE_FORMAT}[${NBS_PROMPT_NAME} awaiting input]${MSG_END_FORMAT}" +MSG_BASE="${MSG_BASE_FORMAT}[${NBS_PROMPT_NAME}]${MSG_END_FORMAT}" +#MSG_DONE="\033[1;32m[${NBS_PROMPT_NAME} done]${MSG_END_FORMAT}" +MSG_DONE="${MSG_DONE_FORMAT}[${NBS_PROMPT_NAME} done]${MSG_END_FORMAT}" +MSG_WARNING="${MSG_WARNING_FORMAT}[${NBS_PROMPT_NAME} warning]${MSG_END_FORMAT}" +MSG_ERROR="${MSG_ERROR_FORMAT}[${NBS_PROMPT_NAME} error]${MSG_END_FORMAT}" # # TeamCity service message version @@ -47,13 +47,13 @@ MSG_DIMMED_FORMAT_TEAMCITY="|[1;2m" MSG_BASE_FORMAT_TEAMCITY="|[1m" MSG_ERROR_FORMAT_TEAMCITY="|[1;31m" MSG_WARNING_FORMAT_TEAMCITY="|[1;33m" -#MSG_LPM_STEP_FORMAT_TEAMCITY="|[1;104m" -MSG_LPM_STEP_FORMAT_TEAMCITY="|[30;107m" +#MSG_NBS_STEP_FORMAT_TEAMCITY="|[1;104m" +MSG_NBS_STEP_FORMAT_TEAMCITY="|[30;107m" MSG_END_FORMAT_TEAMCITY="|[0m" # (!) Note: substitution fail in the TeamCity Overview tab when using -# >>> MSG_BASE_TEAMCITY="${MSG_BASE_FORMAT_TEAMCITY}|[${LPM_PROMPT_NAME}|]${MSG_END_FORMAT_TEAMCITY}" -MSG_BASE_TEAMCITY="|[${LPM_PROMPT_NAME}|]" +# >>> MSG_BASE_TEAMCITY="${MSG_BASE_FORMAT_TEAMCITY}|[${NBS_PROMPT_NAME}|]${MSG_END_FORMAT_TEAMCITY}" +MSG_BASE_TEAMCITY="|[${NBS_PROMPT_NAME}|]" # # References: diff --git "a/build_system/.jetbrains_run_config/(HELP) bash lpm_execute_compose._ \342\200\272 --help menu.run.xml" "b/build_system/.jetbrains_run_config/(HELP) bash lpm_execute_compose._ \342\200\272 --help menu.run.xml" new file mode 100644 index 00000000..ca3fafd6 --- /dev/null +++ "b/build_system/.jetbrains_run_config/(HELP) bash lpm_execute_compose._ \342\200\272 --help menu.run.xml" @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/build_system/.jetbrains_run_config/(command version) docker build & run IamBuildSystemTester.run.xml b/build_system/.jetbrains_run_config/(command version) docker build & run IamBuildSystemTester.run.xml new file mode 100644 index 00000000..a677818b --- /dev/null +++ b/build_system/.jetbrains_run_config/(command version) docker build & run IamBuildSystemTester.run.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/(investigate compose var substitution) lpm_execute_compose_over_build_matrix.bash \342\200\272 config.run.xml" "b/build_system/.jetbrains_run_config/(investigate compose var substitution) lpm_execute_compose_over_build_matrix.bash \342\200\272 config.run.xml" new file mode 100644 index 00000000..4a046cc0 --- /dev/null +++ "b/build_system/.jetbrains_run_config/(investigate compose var substitution) lpm_execute_compose_over_build_matrix.bash \342\200\272 config.run.xml" @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/(test compose file) lpm_execute_compose_over_build_matrix.bash \342\200\272 config --quiet.run.xml" "b/build_system/.jetbrains_run_config/(test compose file) lpm_execute_compose_over_build_matrix.bash \342\200\272 config --quiet.run.xml" new file mode 100644 index 00000000..ad70644a --- /dev/null +++ "b/build_system/.jetbrains_run_config/(test compose file) lpm_execute_compose_over_build_matrix.bash \342\200\272 config --quiet.run.xml" @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/(test) lpm_execute_compose_over_build_matrix.bash \342\200\272 build --dry-run.run.xml" "b/build_system/.jetbrains_run_config/(test) lpm_execute_compose_over_build_matrix.bash \342\200\272 build --dry-run.run.xml" new file mode 100644 index 00000000..efc8e04b --- /dev/null +++ "b/build_system/.jetbrains_run_config/(test) lpm_execute_compose_over_build_matrix.bash \342\200\272 build --dry-run.run.xml" @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build _service_ _popup_.run.xml" "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build _service_ _popup_.run.xml" new file mode 100644 index 00000000..8d144362 --- /dev/null +++ "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build _service_ _popup_.run.xml" @@ -0,0 +1,19 @@ + + + + diff --git "a/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build dependencies_arm64v8 ci_PR_arm64v8 _popup_.run.xml" "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build dependencies_arm64v8 ci_PR_arm64v8 _popup_.run.xml" new file mode 100644 index 00000000..96d09d6e --- /dev/null +++ "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build dependencies_arm64v8 ci_PR_arm64v8 _popup_.run.xml" @@ -0,0 +1,19 @@ + + + + diff --git "a/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build dependencies-general dependencies (BUILD MATRIX SUBSET).run.xml" "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build dependencies-general dependencies (BUILD MATRIX SUBSET).run.xml" new file mode 100644 index 00000000..b16f2ee3 --- /dev/null +++ "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build dependencies-general dependencies (BUILD MATRIX SUBSET).run.xml" @@ -0,0 +1,19 @@ + + + + diff --git "a/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build test_compilation__ (Release).run.xml" "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build test_compilation__ (Release).run.xml" new file mode 100644 index 00000000..06b0ec12 --- /dev/null +++ "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build test_compilation__ (Release).run.xml" @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build test_compilation_prefixed_path (BUILD MATRIX SUBSET).run.xml" "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build test_compilation_prefixed_path (BUILD MATRIX SUBSET).run.xml" new file mode 100644 index 00000000..5ee5cf77 --- /dev/null +++ "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build test_compilation_prefixed_path (BUILD MATRIX SUBSET).run.xml" @@ -0,0 +1,19 @@ + + + + diff --git "a/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build&push dependencies-general dependencies (AS IN TC).run.xml" "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build&push dependencies-general dependencies (AS IN TC).run.xml" new file mode 100644 index 00000000..9f1ccbf9 --- /dev/null +++ "b/build_system/.jetbrains_run_config/bash lpm_execute_compose_over_build_matrix.bash \342\200\272 build&push dependencies-general dependencies (AS IN TC).run.xml" @@ -0,0 +1,19 @@ + + + + diff --git a/build_system/.jetbrains_run_config/cwd tree + docker system disk usage.run.xml b/build_system/.jetbrains_run_config/cwd tree + docker system disk usage.run.xml new file mode 100644 index 00000000..3234c0a3 --- /dev/null +++ b/build_system/.jetbrains_run_config/cwd tree + docker system disk usage.run.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/build_system/.jetbrains_run_config/interactive.run.xml b/build_system/.jetbrains_run_config/interactive.run.xml new file mode 100644 index 00000000..1a0a0dd3 --- /dev/null +++ b/build_system/.jetbrains_run_config/interactive.run.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/build_system/.jetbrains_run_config/list docker images + container.run.xml b/build_system/.jetbrains_run_config/list docker images + container.run.xml new file mode 100644 index 00000000..9894da23 --- /dev/null +++ b/build_system/.jetbrains_run_config/list docker images + container.run.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/lpm_execute_compose.bash \342\200\272 lpm_execute_compose.bash -- build.run.xml" "b/build_system/.jetbrains_run_config/lpm_execute_compose.bash \342\200\272 lpm_execute_compose.bash -- build.run.xml" new file mode 100644 index 00000000..88c22945 --- /dev/null +++ "b/build_system/.jetbrains_run_config/lpm_execute_compose.bash \342\200\272 lpm_execute_compose.bash -- build.run.xml" @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/lpm_execute_compose.bash \342\200\272 lpm_execute_compose.bash \342\200\272 test flag (popup).run.xml" "b/build_system/.jetbrains_run_config/lpm_execute_compose.bash \342\200\272 lpm_execute_compose.bash \342\200\272 test flag (popup).run.xml" new file mode 100644 index 00000000..a5ba4015 --- /dev/null +++ "b/build_system/.jetbrains_run_config/lpm_execute_compose.bash \342\200\272 lpm_execute_compose.bash \342\200\272 test flag (popup).run.xml" @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/lpm_execute_compose_over_build_matrix.bash \342\200\272 test flag (popup).run.xml" "b/build_system/.jetbrains_run_config/lpm_execute_compose_over_build_matrix.bash \342\200\272 test flag (popup).run.xml" new file mode 100644 index 00000000..e9d21345 --- /dev/null +++ "b/build_system/.jetbrains_run_config/lpm_execute_compose_over_build_matrix.bash \342\200\272 test flag (popup).run.xml" @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git "a/build_system/.jetbrains_run_config/lpm_execute_compose_over_build_matrix.bash \342\200\272 test flag override (popup).run.xml" "b/build_system/.jetbrains_run_config/lpm_execute_compose_over_build_matrix.bash \342\200\272 test flag override (popup).run.xml" new file mode 100644 index 00000000..3de41519 --- /dev/null +++ "b/build_system/.jetbrains_run_config/lpm_execute_compose_over_build_matrix.bash \342\200\272 test flag override (popup).run.xml" @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/build_system/.jetbrains_run_config/run and open a terminal in a Ubuntu 20.04 container.run.xml b/build_system/.jetbrains_run_config/run and open a terminal in a Ubuntu 20.04 container.run.xml new file mode 100644 index 00000000..d2ac23c8 --- /dev/null +++ b/build_system/.jetbrains_run_config/run and open a terminal in a Ubuntu 20.04 container.run.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/build_system/docker-compose.libpointmatcher.yaml b/build_system/docker-compose.libpointmatcher.yaml index befe2487..c8c8798d 100644 --- a/build_system/docker-compose.libpointmatcher.yaml +++ b/build_system/docker-compose.libpointmatcher.yaml @@ -1,9 +1,10 @@ services: - # ====Dependency related services=================================================================================== - dependencies: - image: ${LPM_PROJECT_DOCKERHUB:?err}/libpointmatcher-dependencies:${LPM_IMAGE_TAG:?err} + # ====Dependency related services================================================================ + dependencies-general: + image: ${NBS_DOCKERHUB_NAMESPACE:?err}/libpointmatcher-dependencies-general:${NBS_IMAGE_TAG:?err} build: + target: libpointmatcher-dependencies-general context: .. dockerfile: ./build_system/ubuntu/Dockerfile.dependencies platforms: @@ -13,13 +14,22 @@ services: BASE_IMAGE: ${DEPENDENCIES_BASE_IMAGE:?err} BASE_IMAGE_TAG: ${DEPENDENCIES_BASE_IMAGE_TAG:?err} IS_TEAMCITY_RUN: ${IS_TEAMCITY_RUN} - LPM_INSTALLED_LIBRARIES_PATH: ${LPM_INSTALLED_LIBRARIES_PATH:?err} - LPM_LIBPOINTMATCHER_SRC_REPO_NAME: ${LPM_LIBPOINTMATCHER_SRC_REPO_NAME:?err} + NBS_LIB_INSTALL_PATH: ${NBS_LIB_INSTALL_PATH:?err} + NBS_REPOSITORY_NAME: ${NBS_REPOSITORY_NAME:?err} tty: true stdin_open: true init: true # Propagate exit code (See remark in task NMO-266) + + dependencies: + extends: dependencies-general + image: ${NBS_DOCKERHUB_NAMESPACE:?err}/libpointmatcher-dependencies:${NBS_IMAGE_TAG:?err} + build: + target: libpointmatcher-dependencies-libnabo + depends_on: + - dependencies-general + dependencies-doc: - image: ${LPM_PROJECT_DOCKERHUB:?err}/libpointmatcher-dependencies-doc:${LPM_IMAGE_TAG:?err} + image: ${NBS_DOCKERHUB_NAMESPACE:?err}/libpointmatcher-dependencies-doc:${NBS_IMAGE_TAG:?err} build: context: .. dockerfile: ./build_system/ubuntu/Dockerfile.dependencies_doc @@ -27,53 +37,96 @@ services: - "linux/amd64" - "linux/arm64/v8" args: - PROJECT_HUB: ${LPM_PROJECT_DOCKERHUB} + PROJECT_HUB: ${NBS_DOCKERHUB_NAMESPACE} BASE_IMAGE: libpointmatcher-dependencies - BASE_IMAGE_TAG: ${LPM_IMAGE_TAG} + BASE_IMAGE_TAG: ${NBS_IMAGE_TAG} IS_TEAMCITY_RUN: ${IS_TEAMCITY_RUN} tty: true stdin_open: true - # ====Pull-request related services================================================================================ + # ====Pull-request related services============================================================== + _test_compilation: + image: ${NBS_DOCKERHUB_NAMESPACE:?err}/libpointmatcher-compilation-test:${NBS_IMAGE_TAG:?err} + pull_policy: build + build: + context: .. + dockerfile: './build_system/ubuntu/Dockerfile.libpointmatcher_test_compilation' + target: test-compilation-auto-path-resolution + ## Mute 'platforms' while using arch virtualization with C++ build to prevent segmentation fault during lpm cmake install +# platforms: +# - "linux/amd64" +# - "linux/arm64/v8" + args: + PROJECT_HUB: ${NBS_DOCKERHUB_NAMESPACE} + BASE_IMAGE: libpointmatcher-dependencies-general + BASE_IMAGE_TAG: ${NBS_IMAGE_TAG} + IS_TEAMCITY_RUN: ${IS_TEAMCITY_RUN} + REPOSITORY_VERSION: 'latest' + LIBPOINTMATCHER_CMAKE_BUILD_TYPE: ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE:?err} + LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG: '--build-system-CI-install' + tty: true + stdin_open: true + init: true # Propagate exit code (See remark in task NMO-266) + depends_on: + - dependencies-general + test_compilation_prefixed_path: + extends: _test_compilation + build: + target: test-compilation-prefixed-path + depends_on: + - _test_compilation + test_compilation_auto_path_resolution: + extends: _test_compilation + build: + target: test-compilation-auto-path-resolution + depends_on: + - _test_compilation + ci_PR: - image: ${LPM_PROJECT_DOCKERHUB:?err}/libpointmatcher-ci-pr:${LPM_IMAGE_TAG:?err} + image: ${NBS_DOCKERHUB_NAMESPACE:?err}/libpointmatcher-ci-pr:${NBS_IMAGE_TAG:?err} pull_policy: build build: context: .. dockerfile: './build_system/ubuntu/Dockerfile.libpointmatcher_ci_PR' no_cache: true args: - PROJECT_HUB: ${LPM_PROJECT_DOCKERHUB} + PROJECT_HUB: ${NBS_DOCKERHUB_NAMESPACE} BASE_IMAGE: libpointmatcher-dependencies - BASE_IMAGE_TAG: ${LPM_IMAGE_TAG} + BASE_IMAGE_TAG: ${NBS_IMAGE_TAG} IS_TEAMCITY_RUN: ${IS_TEAMCITY_RUN} - LIBPOINTMATCHER_VERSION: 'head' + REPOSITORY_VERSION: 'latest' LIBPOINTMATCHER_CMAKE_BUILD_TYPE: ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE:?err} LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG: '--build-system-CI-install --compile-test' tty: true stdin_open: true init: true # Propagate exit code (See remark in task NMO-266) + depends_on: + - dependencies ci_PR_amd64: extends: ci_PR - platform: "linux/amd64" + build: + platforms: + - "linux/amd64" ci_PR_arm64v8: extends: ci_PR - platform: "linux/arm64/v8" + build: + platforms: + - "linux/arm64/v8" - # ====Build system assessment services============================================================================== + # ====Build system assessment services=========================================================== ci_SITREP_matrix: - image: ${LPM_PROJECT_DOCKERHUB:?err}/libpointmatcher-ci-sitrep-matrix:${LPM_IMAGE_TAG:?err} + image: ${NBS_DOCKERHUB_NAMESPACE:?err}/libpointmatcher-ci-sitrep-matrix:${NBS_IMAGE_TAG:?err} pull_policy: build build: context: .. dockerfile: './build_system/ubuntu/Dockerfile.libpointmatcher_ci_SITREP_matrix' no_cache: true args: - PROJECT_HUB: ${LPM_PROJECT_DOCKERHUB} + PROJECT_HUB: ${NBS_DOCKERHUB_NAMESPACE} BASE_IMAGE: libpointmatcher-dependencies - BASE_IMAGE_TAG: ${LPM_IMAGE_TAG} + BASE_IMAGE_TAG: ${NBS_IMAGE_TAG} IS_TEAMCITY_RUN: ${IS_TEAMCITY_RUN} - LIBPOINTMATCHER_VERSION: ${LIBPOINTMATCHER_VERSION:?err} + REPOSITORY_VERSION: ${REPOSITORY_VERSION:?err} LIBPOINTMATCHER_CMAKE_BUILD_TYPE: ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE:?err} LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG: '--compile-test' tty: true @@ -86,9 +139,9 @@ services: extends: ci_SITREP_matrix platform: "linux/arm64/v8" - # ====Dockerhub release image====================================================================================== + # ====Dockerhub release image==================================================================== release: - image: ${LPM_PROJECT_DOCKERHUB:?err}/libpointmatcher:${LPM_IMAGE_TAG:?err} + image: ${NBS_DOCKERHUB_NAMESPACE:?err}/libpointmatcher:${NBS_IMAGE_TAG:?err} container_name: libpointmatcher build: context: .. @@ -98,11 +151,11 @@ services: - "linux/arm64/v8" no_cache: true args: - PROJECT_HUB: ${LPM_PROJECT_DOCKERHUB} + PROJECT_HUB: ${NBS_DOCKERHUB_NAMESPACE} BASE_IMAGE: libpointmatcher-dependencies-doc - BASE_IMAGE_TAG: ${LPM_IMAGE_TAG} + BASE_IMAGE_TAG: ${NBS_IMAGE_TAG} IS_TEAMCITY_RUN: ${IS_TEAMCITY_RUN} - LIBPOINTMATCHER_VERSION: ${LIBPOINTMATCHER_VERSION:?err} + REPOSITORY_VERSION: ${REPOSITORY_VERSION:?err} LIBPOINTMATCHER_CMAKE_BUILD_TYPE: 'Release' LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG: '--compile-test --generate-doc' tty: true diff --git a/build_system/function_library/general_utilities.bash b/build_system/function_library/general_utilities.bash index aabc0d4d..a678e0c9 100644 --- a/build_system/function_library/general_utilities.bash +++ b/build_system/function_library/general_utilities.bash @@ -24,7 +24,7 @@ source .env.prompt set +o allexport # ....Load helper function......................................................................................... -## import shell functions from Libpointmatcher-build-system utilities library +# import shell functions from utilities library source ./function_library/prompt_utilities.bash # ================================================================================================================= @@ -39,6 +39,8 @@ source ./function_library/prompt_utilities.bash # Returns: # Return docker command exit code # ================================================================================================================= +# ToDo: redaction >> add read global IS_TEAMCITY_RUN to the doc +# ToDo: assessment >> consider adding the logic determine if run in teamcity in the script instead of relying on the IS_TEAMCITY_RUN env variable function show_and_execute_docker() { local FULL_DOCKER_COMMAND=$1 unset DOCKER_EXIT_CODE diff --git a/build_system/function_library/prompt_utilities.bash b/build_system/function_library/prompt_utilities.bash index be296574..d3b7dacb 100644 --- a/build_system/function_library/prompt_utilities.bash +++ b/build_system/function_library/prompt_utilities.bash @@ -133,7 +133,7 @@ function draw_horizontal_line_across_the_terminal_window() { local pad # Ref https://bash.cyberciti.biz/guide/$TERM_variable - TPUT_FLAG='' + TPUT_FLAG="-T $TERM" if [[ -z ${TERM} ]]; then TPUT_FLAG='-T xterm-256color' elif [[ ${TERM} == dumb ]]; then @@ -149,6 +149,7 @@ function draw_horizontal_line_across_the_terminal_window() { #printf '%*s\n' "${COLUMNS:-$(tput ${TPUT_FLAG} cols)}" '' | tr ' ' "${SYMBOL}" # Alt version + # shellcheck disable=SC2086 terminal_width="${COLUMNS:-$(tput ${TPUT_FLAG} cols)}" pad=$(printf -- "${SYMBOL}%.0s" $(seq $terminal_width)) printf -- "${pad}\n" diff --git a/build_system/function_library/terminal_splash.bash b/build_system/function_library/terminal_splash.bash index eee57083..b9d74062 100644 --- a/build_system/function_library/terminal_splash.bash +++ b/build_system/function_library/terminal_splash.bash @@ -9,6 +9,7 @@ #set -v # ....Pre-condition................................................................................................ +# ToDo: assessment >> next precondition ↓↓ not required if [[ "$(basename $(pwd))" != "build_system" ]]; then echo -e "\nERROR: This script must be sourced from directory 'build_system'!\n cwd: $(pwd)" exit 1 @@ -56,7 +57,7 @@ function echo_centering_str() { #echo "\$COLUMNS=${COLUMNS}" # Ref https://bash.cyberciti.biz/guide/$TERM_variable - TPUT_FLAG='' + TPUT_FLAG="-T $TERM" if [[ -z ${TERM} ]]; then TPUT_FLAG='-T xterm-256color' elif [[ ${TERM} == dumb ]]; then @@ -70,6 +71,7 @@ function echo_centering_str() { local terminal_width # terminal_width=$(tput ${TPUT_FLAG} cols) + # shellcheck disable=SC2086 terminal_width="${COLUMNS:-$(tput ${TPUT_FLAG} cols)}" local total_padding_len=$(( $terminal_width - $str_len )) local single_side_padding_len=$(( $total_padding_len / 2 )) diff --git a/build_system/lpm_execute_compose_over_build_matrix.bash b/build_system/lpm_execute_compose_over_build_matrix.bash index 3e42a147..25bfdd13 100644 --- a/build_system/lpm_execute_compose_over_build_matrix.bash +++ b/build_system/lpm_execute_compose_over_build_matrix.bash @@ -1,318 +1,3 @@ #!/bin/bash -# -# Execute build matrix on docker compose docker-compose.libpointmatcher.yaml -# -# Usage: -# $ bash lpm_execute_compose_over_build_matrix.bash [] [-- ] -# -# $ bash lpm_execute_compose_over_build_matrix.bash -- up --build --force-recreate -# -# Arguments: -# [--libpointmatcher-version-build-matrix-override head] -# The libpointmatcher release tag. Override must be a single value -# (default to array sequence specified in .env.build_matrix) -# [--libpointmatcher-cmake-build-type-build-matrix-override RelWithDebInfo] -# Change the libpointmatcher compilation mode. -# Either 'None' 'Debug' 'Release' 'RelWithDebInfo' or 'MinSizeRel' -# (default to array sequence specified in .env.build_matrix) -# [--os-name-build-matrix-override ubuntu] -# The operating system name. Override must be a single value -# (default to array sequence specified in .env.build_matrix) -# [--ubuntu-version-build-matrix-override jammy] -# [--osx-version-build-matrix-override ventura] -# Named operating system version. Override must be a single value -# (default to array sequence specified in .env.build_matrix) -# [-- ] -# Any argument passed after '--' will be passed to docker compose -# as docker command and arguments (default: 'up --build --force-recreate') -# Note: passing script flag via docker --build-arg can be tricky, -# pass them in the docker-compose.yaml if you experience problem. -# [--docker-debug-logs] Set Docker builder log output for debug (i.e.BUILDKIT_PROGRESS=plain) -# [--fail-fast] Exit script at first encountered error -# [--ci-sitrep-run] Override LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE and -# LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS with there respective _SITREP version -# [-h, --help] Get help -# -# Note: -# Dont use "set -e" in this script as it will affect the build system policy, use the --fail-fast flag instead -# -## Debug flags -#set -v -#set -x - -# ....Default...................................................................................................... -DOCKER_COMPOSE_CMD_ARGS='up --build --force-recreate' -BUILD_STATUS_PASS=0 - -# ....Project root logic........................................................................................... -TMP_CWD=$(pwd) - -# ....Load environment variables from file......................................................................... -set -o allexport -source .env -source .env.build_matrix -source .env.prompt -set +o allexport - -# ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library -source ./function_library/prompt_utilities.bash -source ./function_library/general_utilities.bash -source ./function_library/terminal_splash.bash - -function print_help_in_terminal() { - echo -e "\n -\$ ${0} [] [-- ] - \033[1m - :\033[0m - -h, --help Get help - --libpointmatcher-version-build-matrix-override head - The libpointmatcher release tag. Override must be a single value - (default to array sequence specified in .env.build_matrix) - --libpointmatcher-cmake-build-type-build-matrix-override RelWithDebInfo - Change the libpointmatcher compilation mode. - Either 'None' 'Debug' 'Release' 'RelWithDebInfo' or 'MinSizeRel' - (default to array sequence specified in .env.build_matrix) - --os-name-build-matrix-override ubuntu - The operating system name. Override must be a single value - (default to array sequence specified in .env.build_matrix) - --ubuntu-version-build-matrix-override jammy - --osx-version-build-matrix-override ventura - Named operating system version. Override must be a single value - (default to array sequence specified in .env.build_matrix) - --docker-debug-logs - Set Docker builder log output for debug (i.e.BUILDKIT_PROGRESS=plain) - --fail-fast Exit script at first encountered error - --ci-sitrep-run Override LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE and - LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS with there respective _SITREP version - - \033[1m - [-- ]\033[0m Any argument passed after '--' will be passed to docker compose as docker - command and arguments (default to '${DOCKER_COMPOSE_CMD_ARGS}') -" -} - -# ====Begin======================================================================================================== -norlab_splash "${LPM_BUILD_SYSTEM_SPLASH_NAME}" "https://github.com/${LPM_LIBPOINTMATCHER_SRC_DOMAIN}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" - -print_formated_script_header 'lpm_execute_compose_over_build_matrix.bash' "${LPM_LINE_CHAR_BUILDER_LVL1}" - -# ....Script command line flags.................................................................................... -while [ $# -gt 0 ]; do - - case $1 in - --libpointmatcher-version-build-matrix-override) - unset LPM_MATRIX_LIBPOINTMATCHER_VERSIONS - LPM_MATRIX_LIBPOINTMATCHER_VERSIONS=("$2") - shift # Remove argument (--libpointmatcher-version-build-matrix-override) - shift # Remove argument value - ;; - --libpointmatcher-cmake-build-type-build-matrix-override) - unset LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE - LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE=("$2") - shift # Remove argument (--libpointmatcher-cmake-build-type-build-matrix-override) - shift # Remove argument value - ;; - --os-name-build-matrix-override) - unset LPM_MATRIX_SUPPORTED_OS - LPM_MATRIX_SUPPORTED_OS=("$2") - shift # Remove argument (--os-name-build-matrix-override) - shift # Remove argument value - ;; - --ubuntu-version-build-matrix-override) - unset LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS - LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS=("$2") - shift # Remove argument (--ubuntu-version-build-matrix-override) - shift # Remove argument value - ;; - --osx-version-build-matrix-override) - unset LPM_MATRIX_OSX_SUPPORTED_VERSIONS - LPM_MATRIX_OSX_SUPPORTED_VERSIONS=("$2") - shift # Remove argument (--osx-version-build-matrix-override) - shift # Remove argument value - ;; - --docker-debug-logs) -# set -v -# set -x - export BUILDKIT_PROGRESS=plain - shift # Remove argument (--docker-debug-logs) - ;; - --fail-fast) - set -e - shift # Remove argument (--fail-fast) - ;; - --ci-sitrep-run) - shift # Remove argument (--ci-sitrep-run) - unset LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE - unset LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS - LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE=("${LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE_SITREP[@]}") - LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS=("${LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS_SITREP[@]}") - print_msg "${MSG_DIMMED_FORMAT}ci-sitrep${MSG_END_FORMAT} run environment variable override: - - ${MSG_DIMMED_FORMAT}LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE=(${LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE_SITREP[*]})${MSG_END_FORMAT} - - ${MSG_DIMMED_FORMAT}LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS=(${LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS_SITREP[*]})${MSG_END_FORMAT}" - ;; - -h | --help) - print_help_in_terminal - exit - ;; - --) # no more option - shift - DOCKER_COMPOSE_CMD_ARGS="$*" - break - ;; - *) # Default case - break - ;; - esac - -done - - -# .................................................................................................................. -print_msg "Build images specified in ${MSG_DIMMED_FORMAT}'docker-compose.libpointmatcher.yaml'${MSG_END_FORMAT} following ${MSG_DIMMED_FORMAT}.env.build_matrix${MSG_END_FORMAT}" - -## Freeze build matrix env variable to prevent override by lpm_execute_compose.bash when reloading .env/build_matrix -FREEZED_LPM_MATRIX_LIBPOINTMATCHER_VERSIONS=("${LPM_MATRIX_LIBPOINTMATCHER_VERSIONS[@]}") -FREEZED_LPM_MATRIX_SUPPORTED_OS=("${LPM_MATRIX_SUPPORTED_OS[@]}") -FREEZED_LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS=("${LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS[@]}") -FREEZED_LPM_MATRIX_OSX_SUPPORTED_VERSIONS=("${LPM_MATRIX_OSX_SUPPORTED_VERSIONS[@]}") -FREEZED_LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE=("${LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE[@]}") - - -print_msg "Environment variables ${MSG_EMPH_FORMAT}(build matrix)${MSG_END_FORMAT} set for compose:\n -${MSG_DIMMED_FORMAT} LPM_MATRIX_LIBPOINTMATCHER_VERSIONS=(${FREEZED_LPM_MATRIX_LIBPOINTMATCHER_VERSIONS[*]}) ${MSG_END_FORMAT} -${MSG_DIMMED_FORMAT} LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE=(${FREEZED_LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE[*]}) ${MSG_END_FORMAT} -${MSG_DIMMED_FORMAT} LPM_MATRIX_SUPPORTED_OS=(${FREEZED_LPM_MATRIX_SUPPORTED_OS[*]}) ${MSG_END_FORMAT} -${MSG_DIMMED_FORMAT} LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS=(${FREEZED_LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS[*]}) ${MSG_END_FORMAT} -${MSG_DIMMED_FORMAT} LPM_MATRIX_OSX_SUPPORTED_VERSIONS=(${FREEZED_LPM_MATRIX_OSX_SUPPORTED_VERSIONS[*]}) ${MSG_END_FORMAT} -" - -# Note: EACH_LPM_VERSION is used for container labeling and to fetch the repo at release tag -for EACH_LPM_VERSION in "${FREEZED_LPM_MATRIX_LIBPOINTMATCHER_VERSIONS[@]}"; do - if [[ ${TEAMCITY_VERSION} ]]; then - echo -e "##teamcity[blockOpened name='${MSG_BASE_TEAMCITY} ${EACH_LPM_VERSION}']" - fi - - for EACH_OS_NAME in "${FREEZED_LPM_MATRIX_SUPPORTED_OS[@]}"; do - unset CRAWL_OS_VERSIONS - - if [[ ${EACH_OS_NAME} == 'ubuntu' ]]; then - CRAWL_OS_VERSIONS=("${FREEZED_LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS[@]}") - elif [[ ${EACH_OS_NAME} == 'osx' ]]; then - CRAWL_OS_VERSIONS=("${FREEZED_LPM_MATRIX_OSX_SUPPORTED_VERSIONS[@]}") - else - print_msg_error_and_exit "${EACH_OS_NAME} not supported!" - fi - - if [[ -z ${CRAWL_OS_VERSIONS} ]]; then - print_msg_error_and_exit "Can't crawl ${EACH_OS_NAME} supported version array because it's empty!" - fi - - if [[ ${TEAMCITY_VERSION} ]]; then - echo -e "##teamcity[blockOpened name='${MSG_BASE_TEAMCITY} ${EACH_OS_NAME}']" - fi - - for EACH_OS_VERSION in "${CRAWL_OS_VERSIONS[@]}"; do -# export LPM_JOB_ID=${LPM_JOB_ID} - - if [[ ${TEAMCITY_VERSION} ]]; then - echo -e "##teamcity[blockOpened name='${MSG_BASE_TEAMCITY} ${EACH_OS_VERSION}']" - fi - - for EACH_CMAKE_BUILD_TYPE in "${FREEZED_LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE[@]}"; do - - # shellcheck disable=SC2034 - SHOW_SPLASH_EC='false' - - if [[ ${TEAMCITY_VERSION} ]]; then - echo -e "##teamcity[blockOpened name='${MSG_BASE_TEAMCITY} execute lpm_execute_compose.bash' description='${MSG_DIMMED_FORMAT_TEAMCITY} --libpointmatcher-version ${EACH_LPM_VERSION} --libpointmatcher-cmake-build-type ${EACH_CMAKE_BUILD_TYPE} --os-name ${EACH_OS_NAME} --os-version ${EACH_OS_VERSION} -- ${DOCKER_COMPOSE_CMD_ARGS}${MSG_END_FORMAT_TEAMCITY}|n']" - echo " " - fi - - source ./lpm_execute_compose.bash --libpointmatcher-version "${EACH_LPM_VERSION}" \ - --libpointmatcher-cmake-build-type "${EACH_CMAKE_BUILD_TYPE}" \ - --os-name "${EACH_OS_NAME}" \ - --os-version "${EACH_OS_VERSION}" \ - -- "${DOCKER_COMPOSE_CMD_ARGS}" - - # ....Collect image tags exported by lpm_execute_compose.bash.............................................. - # Global: Read 'DOCKER_EXIT_CODE' env variable exported by function show_and_execute_docker - if [[ ${DOCKER_EXIT_CODE} == 0 ]]; then - MSG_STATUS="${MSG_DONE_FORMAT}Pass ${MSG_DIMMED_FORMAT}›" - MSG_STATUS_TC_TAG="Pass ›" - else - MSG_STATUS="${MSG_ERROR_FORMAT}Fail ${MSG_DIMMED_FORMAT}›" - MSG_STATUS_TC_TAG="Fail ›" - BUILD_STATUS_PASS=$DOCKER_EXIT_CODE - - if [[ ${TEAMCITY_VERSION} ]]; then - # Fail the build › Will appear on the TeamCity Build Results page - echo -e "##teamcity[buildProblem description='BUILD FAIL with docker exit code: ${BUILD_STATUS_PASS}']" - fi - fi - - # Collect image tags exported by lpm_execute_compose.bash - # Global: Read 'LPM_IMAGE_TAG' env variable exported by lpm_execute_compose.bash - if [[ ${EACH_CMAKE_BUILD_TYPE} == 'None' ]] || [[ -z ${EACH_CMAKE_BUILD_TYPE} ]]; then - IMAGE_TAG_CRAWLED=("${IMAGE_TAG_CRAWLED[@]}" "${MSG_STATUS} ${LPM_IMAGE_TAG}") - IMAGE_TAG_CRAWLED_TC=("${IMAGE_TAG_CRAWLED_TC[@]}" "${MSG_STATUS_TC_TAG} ${LPM_IMAGE_TAG}") - else - IMAGE_TAG_CRAWLED=("${IMAGE_TAG_CRAWLED[@]}" "${MSG_STATUS} ${LPM_IMAGE_TAG} Compile mode: ${EACH_CMAKE_BUILD_TYPE}") - IMAGE_TAG_CRAWLED_TC=("${IMAGE_TAG_CRAWLED_TC[@]}" "${MSG_STATUS_TC_TAG} ${LPM_IMAGE_TAG} Compile mode: ${EACH_CMAKE_BUILD_TYPE}") - fi - # ......................................................................................................... - - if [[ ${TEAMCITY_VERSION} ]]; then - echo -e "##teamcity[blockClosed name='${MSG_BASE_TEAMCITY} execute lpm_execute_compose.bash']" - fi - - done - - if [[ ${TEAMCITY_VERSION} ]]; then - echo -e "##teamcity[blockClosed name='${MSG_BASE_TEAMCITY} ${EACH_OS_VERSION}']" - fi - - done - - if [[ ${TEAMCITY_VERSION} ]]; then - echo -e "##teamcity[blockClosed name='${MSG_BASE_TEAMCITY} ${EACH_OS_NAME}']" - fi - - done - if [[ ${TEAMCITY_VERSION} ]]; then - echo -e "##teamcity[blockClosed name='${MSG_BASE_TEAMCITY} ${EACH_LPM_VERSION}']" - fi -done - -echo " " -print_msg "Environment variables ${MSG_EMPH_FORMAT}(build matrix)${MSG_END_FORMAT} used by compose:\n -${MSG_DIMMED_FORMAT} LPM_MATRIX_LIBPOINTMATCHER_VERSIONS=(${FREEZED_LPM_MATRIX_LIBPOINTMATCHER_VERSIONS[*]}) ${MSG_END_FORMAT} -${MSG_DIMMED_FORMAT} LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE=(${FREEZED_LPM_MATRIX_LIBPOINTMATCHER_CMAKE_BUILD_TYPE[*]}) ${MSG_END_FORMAT} -${MSG_DIMMED_FORMAT} LPM_MATRIX_SUPPORTED_OS=(${FREEZED_LPM_MATRIX_SUPPORTED_OS[*]}) ${MSG_END_FORMAT} -${MSG_DIMMED_FORMAT} LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS=(${FREEZED_LPM_MATRIX_UBUNTU_SUPPORTED_VERSIONS[*]}) ${MSG_END_FORMAT} -${MSG_DIMMED_FORMAT} LPM_MATRIX_OSX_SUPPORTED_VERSIONS=(${FREEZED_LPM_MATRIX_OSX_SUPPORTED_VERSIONS[*]}) ${MSG_END_FORMAT} -" - -print_msg_done "FINAL › Build matrix completed with command - -${MSG_DIMMED_FORMAT} $ docker compose -f docker-compose.libpointmatcher.yaml ${DOCKER_COMPOSE_CMD_ARGS} ${MSG_END_FORMAT} - -Status of tag crawled: -" -for tag in "${IMAGE_TAG_CRAWLED[@]}" ; do - echo -e " ${tag}${MSG_END_FORMAT}" -done - -print_formated_script_footer 'lpm_execute_compose_over_build_matrix.bash' "${LPM_LINE_CHAR_BUILDER_LVL1}" - -# ====TeamCity service message===================================================================================== -if [[ ${TEAMCITY_VERSION} ]]; then - # Tag added to the TeamCity build via a service message - for tc_build_tag in "${IMAGE_TAG_CRAWLED_TC[@]}" ; do - echo -e "##teamcity[addBuildTag '${tc_build_tag}']" - done -fi -# ====Teardown===================================================================================================== -cd "${TMP_CWD}" -exit $BUILD_STATUS_PASS +source ./nbs_execute_compose_over_build_matrix.bash "$@" diff --git a/build_system/lpm_utility_script/lpm_bashrc_config.bash b/build_system/lpm_utility_script/lpm_bashrc_config.bash index fd3c4a04..0185af4f 100644 --- a/build_system/lpm_utility_script/lpm_bashrc_config.bash +++ b/build_system/lpm_utility_script/lpm_bashrc_config.bash @@ -2,48 +2,58 @@ # # (Optional) .bashrc config script # +# Usage: +# $ bash lpm_bashrc_config.bash +# + +function configure_bashrc() { + local TMP_CWD + TMP_CWD=$(pwd) + + # ....Project root logic......................................................................... + LPM_PATH=$(git rev-parse --show-toplevel) + + # ....Load environment variables from file....................................................... + cd "${LPM_PATH}/build_system" || exit + set -o allexport + source .env + source .env.prompt + set +o allexport + + # ....Helper function............................................................................ + ## import shell functions from build-system utilities library + source ./function_library/prompt_utilities.bash + + # ====Begin====================================================================================== + print_formated_script_header 'lpm_bashrc_config.bash' "${NBS_LINE_CHAR_UTIL}" + + + if [[ "$(basename ${LPM_PATH})" != "${NBS_REPOSITORY_NAME}" ]]; then + print_msg_error_and_exit "Can't find directory ${MSG_DIMMED_FORMAT}${NBS_REPOSITORY_NAME}${MSG_END_FORMAT}" + fi + + + # ....Config bashrc.............................................................................. + # Add the following lines to .bashsrc if no alias prefixed with `lpm_` exist + if [[ -z $(alias | grep -i lpm_) ]]; then + ( + echo + echo "# libpointmatcher build-system aliases" + echo "export LPM_PATH=${LPM_PATH}" + echo "alias lpm_cd='cd ${LPM_PATH}'" + echo "alias lpmm_cd='cd ${LPM_PATH}/build_system'" + echo + ) >> ~/.bashrc && source ~/.bashrc + # echo "alias lpm_attach='cd $DN_PATH && bash dn_attach.bash'" + fi + + print_msg_done "New aliases with prefix 'lpm' added to .bashrc" + + print_formated_script_footer 'lpm_bashrc_config.bash' "${NBS_LINE_CHAR_UTIL}" -# ....Load environment variables from file......................................................................... -set -o allexport -source .env -source .env.prompt -set +o allexport - -# ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library -source ./function_library/prompt_utilities.bash - -# ....Project root logic........................................................................................... -TMP_CWD=$(pwd) - -if [[ "$(basename $(pwd))" != "${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" ]]; then - cd .. -elif [[ "$(basename $(pwd))" == "${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" ]]; then - LPM_PATH=$(pwd) -else - print_msg_error_and_exit "Can't find directory ${MSG_DIMMED_FORMAT}${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}${MSG_END_FORMAT}" -fi - -# ====Begin======================================================================================================== -print_formated_script_header 'lpm_bashrc_config.bash' "${LPM_LINE_CHAR_UTIL}" - -# ....Config bashrc................................................................................................ -# Add the following lines to .bashsrc if no alias prefixed with `lpm_` exist -if [[ -z $(alias | grep -i lpm_) ]]; then - ( - echo - echo "# libpointmatcher build-system aliases" - echo "export LPM_PATH=${LPM_PATH}" - echo "alias lpm_cd='cd $LPM_PATH'" - echo "alias lpmm_cd='cd $LPM_PATH/build_system'" - echo - ) >> ~/.bashrc && source ~/.bashrc - # echo "alias lpm_attach='cd $DN_PATH && bash dn_attach.bash'" -fi - -print_msg_done "New aliases with prefix 'lpm' added to .bashrc" - -print_formated_script_footer 'lpm_bashrc_config.bash' "${LPM_LINE_CHAR_UTIL}" -# ====Teardown===================================================================================================== -cd "${TMP_CWD}" + # ====Teardown=================================================================================== + cd "${TMP_CWD}" +} +# ::::main::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +configure_bashrc diff --git a/build_system/lpm_utility_script/lpm_export_which_architecture.bash b/build_system/lpm_utility_script/lpm_export_which_architecture.bash index 86ca3073..58181424 100644 --- a/build_system/lpm_utility_script/lpm_export_which_architecture.bash +++ b/build_system/lpm_utility_script/lpm_export_which_architecture.bash @@ -1,20 +1,20 @@ #!/bin/bash # -# Tools to export the LPM_IMAGE_ARCHITECTURE environment variable with the host architecture and OS type. +# Tools to export the NBS_IMAGE_ARCHITECTURE environment variable with the host architecture and OS type. # # Usage: # $ source ./lpm_utility_script/lpm_export_which_architecture.bash # # Globals: -# Read LPM_LINE_CHAR_UTIL +# Read NBS_LINE_CHAR_UTIL # Arguments: # none # Outputs: -# environment variable LPM_IMAGE_ARCHITECTURE will be exported either as -# - LPM_IMAGE_ARCHITECTURE=x86-linux -# - LPM_IMAGE_ARCHITECTURE=arm64-linux -# - LPM_IMAGE_ARCHITECTURE=arm64-l4t -# - LPM_IMAGE_ARCHITECTURE=arm64-darwin +# environment variable NBS_IMAGE_ARCHITECTURE will be exported either as +# - NBS_IMAGE_ARCHITECTURE=x86-linux +# - NBS_IMAGE_ARCHITECTURE=arm64-linux +# - NBS_IMAGE_ARCHITECTURE=arm64-l4t +# - NBS_IMAGE_ARCHITECTURE=arm64-darwin # depending on which architecture and OS type the script is running: # - ARCH: aarch64, arm64, x86_64 # - OS: Linux, Darwin, Window @@ -27,40 +27,48 @@ # # Returns: # exit 1 in case of unsupported processor architecture -# ================================================================================================================= -if [[ "$(basename $(pwd))" != "build_system" ]]; then - cd ../ -fi +function export_which_architecture() { + local TMP_CWD + TMP_CWD=$(pwd) -# ....Load environment variables from file......................................................................... -set -o allexport -source .env.prompt -set +o allexport + # ....Project root logic......................................................................... + LPM_PATH=$(git rev-parse --show-toplevel) + cd "${LPM_PATH}/build_system" || exit -# ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library -source ./function_library/prompt_utilities.bash + # ....Load environment variables from file....................................................... + set -o allexport + source .env.prompt + set +o allexport -# ====Begin======================================================================================================== -#print_formated_script_header 'lpm_export_which_architecture.bash' "${LPM_LINE_CHAR_UTIL}" + # ....Helper function............................................................................ + # import shell functions from utilities library + source ./function_library/prompt_utilities.bash -if [[ $(uname -m) == "aarch64" ]]; then - if [[ -n $(uname -r | grep tegra) ]]; then - export LPM_IMAGE_ARCHITECTURE='arm64-l4t' - elif [[ $(uname) == "Linux" ]]; then - export LPM_IMAGE_ARCHITECTURE='arm64-linux' + # ====Begin====================================================================================== + #print_formated_script_header 'lpm_export_which_architecture.bash' "${NBS_LINE_CHAR_UTIL}" + + if [[ $(uname -m) == "aarch64" ]]; then + if [[ -n $(uname -r | grep tegra) ]]; then + export NBS_IMAGE_ARCHITECTURE='arm64-l4t' + elif [[ $(uname) == "Linux" ]]; then + export NBS_IMAGE_ARCHITECTURE='arm64-linux' + else + echo -e "${MSG_ERROR} Unsupported OS for aarch64 processor" + fi + elif [[ $(uname -m) == "arm64" ]] && [[ $(uname) == "Darwin" ]]; then + export NBS_IMAGE_ARCHITECTURE='arm64-darwin' + elif [[ $(uname -m) == "x86_64" ]] && [[ $(uname) == "Linux" ]]; then + export NBS_IMAGE_ARCHITECTURE='x86-linux' else - echo -e "${MSG_ERROR} Unsupported OS for aarch64 processor" + print_msg_error_and_exit "Unsupported processor architecture" fi -elif [[ $(uname -m) == "arm64" ]] && [[ $(uname) == "Darwin" ]]; then - export LPM_IMAGE_ARCHITECTURE='arm64-darwin' -elif [[ $(uname -m) == "x86_64" ]] && [[ $(uname) == "Linux" ]]; then - export LPM_IMAGE_ARCHITECTURE='x86-linux' -else - print_msg_error_and_exit "Unsupported processor architecture" -fi -print_msg "Setting LPM_IMAGE_ARCHITECTURE=${LPM_IMAGE_ARCHITECTURE}" -#print_formated_script_footer 'lpm_export_which_architecture.bash' "${LPM_LINE_CHAR_UTIL}" -# ====Done========================================================================================================= + print_msg "Setting NBS_IMAGE_ARCHITECTURE=${NBS_IMAGE_ARCHITECTURE}" + #print_formated_script_footer 'lpm_export_which_architecture.bash' "${NBS_LINE_CHAR_UTIL}" + # ====Teardown=================================================================================== + cd "${TMP_CWD}" +} + +# ::::main::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +export_which_architecture diff --git a/build_system/lpm_utility_script/lpm_install_docker_tools.bash b/build_system/lpm_utility_script/lpm_install_docker_tools.bash index 08b306a0..c543f18c 100644 --- a/build_system/lpm_utility_script/lpm_install_docker_tools.bash +++ b/build_system/lpm_utility_script/lpm_install_docker_tools.bash @@ -6,83 +6,98 @@ # $ bash ./lpm_utility_script/lpm_install_docker_tools.bash # -# ....Project root logic........................................................................................... -TMP_CWD=$(pwd) - -if [[ "$(basename $(pwd))" != "build_system" ]]; then - cd ../ -fi - - -# ....Load environment variables from file......................................................................... -set -o allexport -source .env -source .env.prompt -set +o allexport - -# ....Load helper function......................................................................................... -## import shell functions from Libpointmatcher-build-system utilities library -source ./function_library/prompt_utilities.bash - -# ====Begin======================================================================================================== -print_formated_script_header 'lpm_install_docker_tools.bash' - -# ................................................................................................................. -echo -print_msg "Install utilities" -echo - -sudo apt-get update && - sudo apt-get upgrade --assume-yes && - sudo apt-get install --assume-yes \ - ca-certificates \ - curl \ - lsb-release \ - gnupg \ - apt-utils && - sudo rm -rf /var/lib/apt/lists/* - -# ................................................................................................................. -echo -print_msg "Install Docker tools" "${LPM_LINE_CHAR_UTIL}" - -# . . Add Docker’s official GPG key:. . . . . . . . . . . . . . . . . . . . . . . . . . . -sudo mkdir -m 0755 -p /etc/apt/keyrings -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg - -# . . set up the docker repository:. . . . . . . . . . . . . . . . . . . . . . . . . . . -echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null - -# ................................................................................................................. -print_msg "Install Docker-compose" -echo - -sudo apt-get update && - sudo apt-get upgrade && - sudo apt-get install --assume-yes \ - docker-ce \ - docker-ce-cli \ - containerd.io \ - docker-buildx-plugin \ - docker-compose-plugin - -# ................................................................................................................. -echo -print_msg "Configure docker" -echo - -print_msg "Manage Docker as a non-root user" -# Config so that we dont have to preface docker command with sudo everytime -# Ref: https://docs.docker.com/engine/install/linux-postinstall/ -echo - -sudo groupadd -f docker -sudo usermod -a -G docker "$(whoami)" - -print_msg "${NTSI_ADMIN_USER} added to docker group" - -print_formated_script_footer 'lpm_install_docker_tools.bash' "${LPM_LINE_CHAR_UTIL}" -# ====Teardown===================================================================================================== -cd "${TMP_CWD}" +function install_docker_tools() { + # ....Project root logic......................................................................... + local TMP_CWD + TMP_CWD=$(pwd) + + # ....Project root logic......................................................................... + LPM_PATH=$(git rev-parse --show-toplevel) + cd "${LPM_PATH}/build_system" || exit + + # ....Load environment variables from file....................................................... + set -o allexport + source .env + source .env.prompt + set +o allexport + + # ....Load helper function....................................................................... + # import shell functions from utilities library + source ./function_library/prompt_utilities.bash + + # ====Begin====================================================================================== + print_formated_script_header 'lpm_install_docker_tools.bash' + + # ............................................................................................... + echo + print_msg "Install utilities" + echo + + sudo apt-get update && + sudo apt-get upgrade --assume-yes && + sudo apt-get install --assume-yes \ + ca-certificates \ + curl \ + lsb-release \ + gnupg \ + apt-utils && + sudo rm -rf /var/lib/apt/lists/* + + # ............................................................................................... + echo + print_msg "Install Docker tools" "${NBS_LINE_CHAR_UTIL}" + + # . . Add Docker’s official GPG key:. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + sudo mkdir -m 0755 -p /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + + # . . set up the docker repository:. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null + + # ............................................................................................... + print_msg "Install Docker-compose" + echo + + sudo apt-get update && + sudo apt-get upgrade && + sudo apt-get install --assume-yes \ + docker-ce \ + docker-ce-cli \ + containerd.io \ + docker-buildx-plugin \ + docker-compose-plugin + + # ............................................................................................... + echo + print_msg "Configure docker" + echo + + print_msg "Manage Docker as a non-root user" + # Config so that we dont have to preface docker command with sudo everytime + # Ref: https://docs.docker.com/engine/install/linux-postinstall/ + echo + + sudo groupadd -f docker + sudo usermod -a -G docker "$(whoami)" + + print_msg "${NTSI_ADMIN_USER} added to docker group" + + print_msg "Create a multi-architecture docker builder" + docker buildx create \ + --name local-builder-multiarch-virtual \ + --driver docker-container \ + --platform linux/amd64,linux/arm64 \ + --bootstrap \ + --use + + docker buildx ls + + print_formated_script_footer 'lpm_install_docker_tools.bash' "${NBS_LINE_CHAR_UTIL}" + # ====Teardown=================================================================================== + cd "${TMP_CWD}" +} + +# ::::main::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +install_docker_tools diff --git a/build_system/lpm_execute_compose.bash b/build_system/nbs_execute_compose.bash similarity index 74% rename from build_system/lpm_execute_compose.bash rename to build_system/nbs_execute_compose.bash index 7d33a27a..894b3025 100644 --- a/build_system/lpm_execute_compose.bash +++ b/build_system/nbs_execute_compose.bash @@ -1,15 +1,15 @@ #!/bin/bash # -# Build and run a single container based on docker compose docker-compose.libpointmatcher.yaml +# Build and run a single container based on a norlab-build-system docker-compose.yaml file # # Usage: -# $ bash lpm_execute_compose.bash [] [-- ] +# $ bash nbs_execute_compose.bash [] [-- ] # -# $ bash lpm_execute_compose.bash -- run --rm ci +# $ bash nbs_execute_compose.bash -- run --rm ci # # Arguments: -# [--libpointmatcher-version v1.3.1] The libpointmatcher release tag (default: see LIBPOINTMATCHER_VERSION) -# [--libpointmatcher-cmake-build-type RelWithDebInfo] +# [--repository-version v1.3.1] The libpointmatcher release tag (default: see REPOSITORY_VERSION) +# [--cmake-build-type RelWithDebInfo] # Change the libpointmatcher compilation mode. # Either 'None' 'Debug' 'Release' 'RelWithDebInfo' or 'MinSizeRel' # [--os-name ubuntu] The operating system name. Either 'ubuntu' or 'osx' (default: see OS_NAME) @@ -29,12 +29,12 @@ # # ....Default...................................................................................................... -LIBPOINTMATCHER_VERSION='head' +REPOSITORY_VERSION='latest' LIBPOINTMATCHER_CMAKE_BUILD_TYPE='RelWithDebInfo' OS_NAME='ubuntu' OS_VERSION='focal' -#LPM_JOB_ID='0' -DOCKER_COMPOSE_CMD_ARGS='up --build --force-recreate' # alt: build --no-cache --push +#NBS_JOB_ID='0' +DOCKER_COMPOSE_CMD_ARGS='build --dry-run' # alt: "build --no-cache --push" or "up --build --force-recreate" # ....Project root logic........................................................................................... TMP_CWD=$(pwd) @@ -42,12 +42,11 @@ TMP_CWD=$(pwd) # ....Load environment variables from file......................................................................... set -o allexport source .env -source .env.build_matrix source .env.prompt set +o allexport # ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library +# import shell functions from utilities library source ./function_library/prompt_utilities.bash source ./function_library/general_utilities.bash source ./function_library/terminal_splash.bash @@ -58,8 +57,8 @@ function print_help_in_terminal() { \033[1m :\033[0m -h, --help Get help - --libpointmatcher-version v1.3.1 The libpointmatcher release tag (default to master branch head) - --libpointmatcher-cmake-build-type RelWithDebInfo + --repository-version v1.3.1 The libpointmatcher release tag (default to master branch latest) + --cmake-build-type RelWithDebInfo Change the libpointmatcher compilation mode. Either 'None' 'Debug' 'Release' 'RelWithDebInfo' or 'MinSizeRel' --os-name ubuntu The operating system name. Either 'ubuntu' or 'osx' (default to 'ubuntu') @@ -88,23 +87,30 @@ print_msg "IS_TEAMCITY_RUN=${IS_TEAMCITY_RUN} ${TC_VERSION}" SHOW_SPLASH_EC="${SHOW_SPLASH_EC:-true}" if [[ "${SHOW_SPLASH_EC}" == 'true' ]]; then - norlab_splash "${LPM_BUILD_SYSTEM_SPLASH_NAME}" "https://github.com/${LPM_LIBPOINTMATCHER_SRC_DOMAIN}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" + norlab_splash "${NBS_BUILD_SYSTEM_SPLASH_NAME}" "https://github.com/${NBS_REPOSITORY_DOMAIN}/${NBS_REPOSITORY_NAME}" fi -print_formated_script_header 'lpm_execute_compose.bash' "${LPM_LINE_CHAR_BUILDER_LVL2}" +_COMPOSE_FILE="${1:?'Missing the docker-compose.yaml file mandatory argument'}" +shift # Remove argument value + +if [[ ! -f ${_COMPOSE_FILE} ]]; then + print_msg_error_and_exit "docker-compose file ${_COMPOSE_FILE} is unreachable" +fi + +print_formated_script_header 'nbs_execute_compose.bash' "${NBS_LINE_CHAR_BUILDER_LVL2}" # ....Script command line flags.................................................................................... while [ $# -gt 0 ]; do case $1 in - --libpointmatcher-version) - LIBPOINTMATCHER_VERSION="${2}" - shift # Remove argument (--libpointmatcher-version) + --repository-version) + REPOSITORY_VERSION="${2}" + shift # Remove argument (--repository-version) shift # Remove argument value ;; - --libpointmatcher-cmake-build-type) + --cmake-build-type) LIBPOINTMATCHER_CMAKE_BUILD_TYPE="${2}" - shift # Remove argument (--libpointmatcher-cmake-build-type) + shift # Remove argument (--cmake-build-type) shift # Remove argument value ;; --os-name) @@ -117,11 +123,6 @@ while [ $# -gt 0 ]; do shift # Remove argument (--os-version) shift # Remove argument value ;; -# --job-id) -# LPM_JOB_ID="${2}" -# shift # Remove argument (--job-id) -# shift # Remove argument value -# ;; --docker-debug-logs) # set -v # set -x @@ -149,38 +150,38 @@ while [ $# -gt 0 ]; do done # .................................................................................................................. -# Note: LIBPOINTMATCHER_VERSION will be used to fetch the repo at release tag (ref task NMO-252) -export LIBPOINTMATCHER_VERSION="${LIBPOINTMATCHER_VERSION}" +# Note: REPOSITORY_VERSION will be used to fetch the repo at release tag (ref task NMO-252) +export REPOSITORY_VERSION="${REPOSITORY_VERSION}" export LIBPOINTMATCHER_CMAKE_BUILD_TYPE="${LIBPOINTMATCHER_CMAKE_BUILD_TYPE}" export DEPENDENCIES_BASE_IMAGE="${OS_NAME}" export DEPENDENCIES_BASE_IMAGE_TAG="${OS_VERSION}" -export LPM_IMAGE_TAG="${LIBPOINTMATCHER_VERSION}-${DEPENDENCIES_BASE_IMAGE}-${DEPENDENCIES_BASE_IMAGE_TAG}" +export NBS_IMAGE_TAG="${REPOSITORY_VERSION}-${DEPENDENCIES_BASE_IMAGE}-${DEPENDENCIES_BASE_IMAGE_TAG}" print_msg "Environment variables set for compose:\n -${MSG_DIMMED_FORMAT} LIBPOINTMATCHER_VERSION=${LIBPOINTMATCHER_VERSION} ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} REPOSITORY_VERSION=${REPOSITORY_VERSION} ${MSG_END_FORMAT} ${MSG_DIMMED_FORMAT} LIBPOINTMATCHER_CMAKE_BUILD_TYPE=${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} ${MSG_END_FORMAT} ${MSG_DIMMED_FORMAT} DEPENDENCIES_BASE_IMAGE=${DEPENDENCIES_BASE_IMAGE} ${MSG_END_FORMAT} ${MSG_DIMMED_FORMAT} DEPENDENCIES_BASE_IMAGE_TAG=${DEPENDENCIES_BASE_IMAGE_TAG} ${MSG_END_FORMAT} " -print_msg "Executing docker compose command on ${MSG_DIMMED_FORMAT}docker-compose.libpointmatcher.yaml${MSG_END_FORMAT} with command ${MSG_DIMMED_FORMAT}${DOCKER_COMPOSE_CMD_ARGS}${MSG_END_FORMAT}" -print_msg "Image tag ${MSG_DIMMED_FORMAT}${LPM_IMAGE_TAG}${MSG_END_FORMAT}" -#${MSG_DIMMED_FORMAT}$(printenv | grep -i -e LPM_ -e DEPENDENCIES_BASE_IMAGE -e BUILDKIT)${MSG_END_FORMAT} +print_msg "Executing docker compose command on ${MSG_DIMMED_FORMAT}${_COMPOSE_FILE}${MSG_END_FORMAT} with command ${MSG_DIMMED_FORMAT}${DOCKER_COMPOSE_CMD_ARGS}${MSG_END_FORMAT}" +print_msg "Image tag ${MSG_DIMMED_FORMAT}${NBS_IMAGE_TAG}${MSG_END_FORMAT}" +#${MSG_DIMMED_FORMAT}$(printenv | grep -i -e NBS_ -e DEPENDENCIES_BASE_IMAGE -e BUILDKIT)${MSG_END_FORMAT} ## docker compose [-f ...] [options] [COMMAND] [ARGS...] ## docker compose build [OPTIONS] [SERVICE...] ## docker compose run [OPTIONS] SERVICE [COMMAND] [ARGS...] -show_and_execute_docker "compose -f docker-compose.libpointmatcher.yaml ${DOCKER_COMPOSE_CMD_ARGS}" +show_and_execute_docker "compose -f ${_COMPOSE_FILE} ${DOCKER_COMPOSE_CMD_ARGS}" print_msg "Environment variables used by compose:\n -${MSG_DIMMED_FORMAT} LIBPOINTMATCHER_VERSION=${LIBPOINTMATCHER_VERSION} ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} REPOSITORY_VERSION=${REPOSITORY_VERSION} ${MSG_END_FORMAT} ${MSG_DIMMED_FORMAT} LIBPOINTMATCHER_CMAKE_BUILD_TYPE=${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} ${MSG_END_FORMAT} ${MSG_DIMMED_FORMAT} DEPENDENCIES_BASE_IMAGE=${DEPENDENCIES_BASE_IMAGE} ${MSG_END_FORMAT} ${MSG_DIMMED_FORMAT} DEPENDENCIES_BASE_IMAGE_TAG=${DEPENDENCIES_BASE_IMAGE_TAG} ${MSG_END_FORMAT}" -print_formated_script_footer 'lpm_execute_compose.bash' "${LPM_LINE_CHAR_BUILDER_LVL2}" +print_formated_script_footer 'nbs_execute_compose.bash' "${NBS_LINE_CHAR_BUILDER_LVL2}" # ====Teardown===================================================================================================== cd "${TMP_CWD}" diff --git a/build_system/nbs_execute_compose_over_build_matrix.bash b/build_system/nbs_execute_compose_over_build_matrix.bash new file mode 100644 index 00000000..1cabdeec --- /dev/null +++ b/build_system/nbs_execute_compose_over_build_matrix.bash @@ -0,0 +1,320 @@ +#!/bin/bash +# +# Execute build matrix over docker compose file specified in NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE +# +# Usage: +# $ bash nbs_execute_compose_over_build_matrix.bash [] [-- ] +# +# $ bash nbs_execute_compose_over_build_matrix.bash -- build --dry-run +# +# Arguments: +# [--repository-version-build-matrix-override latest] +# The repository release tag. Override must be a single value +# (default to array sequence specified in .env.build_matrix) +# [--cmake-build-type-build-matrix-override RelWithDebInfo] +# Change the compilation mode. +# Either 'None' 'Debug' 'Release' 'RelWithDebInfo' or 'MinSizeRel' +# (default to array sequence specified in .env.build_matrix) +# [--os-name-build-matrix-override ubuntu] +# The operating system name. Override must be a single value +# (default to array sequence specified in .env.build_matrix) +# [--ubuntu-version-build-matrix-override jammy] +# [--osx-version-build-matrix-override ventura] +# Named operating system version. Override must be a single value +# (default to array sequence specified in .env.build_matrix) +# [-- ] +# Any argument passed after '--' will be passed to docker compose +# as docker command and arguments (default: 'build --dry-run') +# Note: passing script flag via docker --build-arg can be tricky, +# pass them in the docker-compose.yaml if you experience problem. +# [--docker-debug-logs] Set Docker builder log output for debug (i.e.BUILDKIT_PROGRESS=plain) +# [--fail-fast] Exit script at first encountered error +# [--ci-sitrep-run] Override NBS_MATRIX_CMAKE_BUILD_TYPE and +# NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS with there respective _SITREP version +# [-h, --help] Get help +# +# Note: +# Dont use "set -e" in this script as it will affect the build system policy, use the --fail-fast flag instead +# + +## Debug flags +#set -v +#set -x + +# ....Default...................................................................................................... +DOCKER_COMPOSE_CMD_ARGS='build --dry-run' +BUILD_STATUS_PASS=0 + +# ....Project root logic........................................................................................... +TMP_CWD=$(pwd) + +# ....Load environment variables from file......................................................................... +set -o allexport +source .env +source .env.build_matrix +source .env.prompt +set +o allexport + +# ....Helper function.............................................................................................. +## import shell functions from norlab-build-system utilities library +source ./function_library/prompt_utilities.bash +source ./function_library/general_utilities.bash +source ./function_library/terminal_splash.bash + +function print_help_in_terminal() { + echo -e "\n +\$ ${0} [] [-- ] + \033[1m + :\033[0m + -h, --help Get help + --repository-version-build-matrix-override latest + The libpointmatcher release tag. Override must be a single value + (default to array sequence specified in .env.build_matrix) + --cmake-build-type-build-matrix-override RelWithDebInfo + Change the libpointmatcher compilation mode. + Either 'None' 'Debug' 'Release' 'RelWithDebInfo' or 'MinSizeRel' + (default to array sequence specified in .env.build_matrix) + --os-name-build-matrix-override ubuntu + The operating system name. Override must be a single value + (default to array sequence specified in .env.build_matrix) + --ubuntu-version-build-matrix-override jammy + --osx-version-build-matrix-override ventura + Named operating system version. Override must be a single value + (default to array sequence specified in .env.build_matrix) + --docker-debug-logs + Set Docker builder log output for debug (i.e.BUILDKIT_PROGRESS=plain) + --fail-fast Exit script at first encountered error + --ci-sitrep-run Override NBS_MATRIX_CMAKE_BUILD_TYPE and + NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS with there respective _SITREP version + + \033[1m + [-- ]\033[0m Any argument passed after '--' will be passed to docker compose as docker + command and arguments (default to '${DOCKER_COMPOSE_CMD_ARGS}') +" +} + +# ====Begin======================================================================================================== +norlab_splash "${NBS_BUILD_SYSTEM_SPLASH_NAME}" "https://github.com/${NBS_REPOSITORY_DOMAIN}/${NBS_REPOSITORY_NAME}" + +print_formated_script_header 'nbs_execute_compose_over_build_matrix.bash' "${NBS_LINE_CHAR_BUILDER_LVL1}" + +# ....Script command line flags.................................................................................... +while [ $# -gt 0 ]; do + + case $1 in + --repository-version-build-matrix-override) + unset NBS_MATRIX_REPOSITORY_VERSIONS + NBS_MATRIX_REPOSITORY_VERSIONS=("$2") + shift # Remove argument (--repository-version-build-matrix-override) + shift # Remove argument value + ;; + --cmake-build-type-build-matrix-override) + unset NBS_MATRIX_CMAKE_BUILD_TYPE + NBS_MATRIX_CMAKE_BUILD_TYPE=("$2") + shift # Remove argument (--cmake-build-type-build-matrix-override) + shift # Remove argument value + ;; + --os-name-build-matrix-override) + unset NBS_MATRIX_SUPPORTED_OS + NBS_MATRIX_SUPPORTED_OS=("$2") + shift # Remove argument (--os-name-build-matrix-override) + shift # Remove argument value + ;; + --ubuntu-version-build-matrix-override) + unset NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS + NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS=("$2") + shift # Remove argument (--ubuntu-version-build-matrix-override) + shift # Remove argument value + ;; + --osx-version-build-matrix-override) + unset NBS_MATRIX_OSX_SUPPORTED_VERSIONS + NBS_MATRIX_OSX_SUPPORTED_VERSIONS=("$2") + shift # Remove argument (--osx-version-build-matrix-override) + shift # Remove argument value + ;; + --docker-debug-logs) +# set -v +# set -x + export BUILDKIT_PROGRESS=plain + shift # Remove argument (--docker-debug-logs) + ;; + --fail-fast) + set -e + shift # Remove argument (--fail-fast) + ;; + --ci-sitrep-run) + shift # Remove argument (--ci-sitrep-run) + unset NBS_MATRIX_CMAKE_BUILD_TYPE + unset NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS + NBS_MATRIX_CMAKE_BUILD_TYPE=("${NBS_MATRIX_CMAKE_BUILD_TYPE_SITREP[@]}") + NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS=("${NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS_SITREP[@]}") + print_msg "${MSG_DIMMED_FORMAT}ci-sitrep${MSG_END_FORMAT} run environment variable override: + - ${MSG_DIMMED_FORMAT}NBS_MATRIX_CMAKE_BUILD_TYPE=(${NBS_MATRIX_CMAKE_BUILD_TYPE_SITREP[*]})${MSG_END_FORMAT} + - ${MSG_DIMMED_FORMAT}NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS=(${NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS_SITREP[*]})${MSG_END_FORMAT}" + ;; + -h | --help) + print_help_in_terminal + exit + ;; + --) # no more option + shift + DOCKER_COMPOSE_CMD_ARGS="$*" + break + ;; + *) # Default case + break + ;; + esac + +done + + +# .................................................................................................................. +print_msg "Build images specified in ${MSG_DIMMED_FORMAT}'${NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE}'${MSG_END_FORMAT} following ${MSG_DIMMED_FORMAT}.env.build_matrix${MSG_END_FORMAT}" + +# Freeze build matrix env variable to prevent accidental override +# Note: declare -r ==> set as read-only, declare -a ==> set as an array +declare -ra NBS_MATRIX_REPOSITORY_VERSIONS +declare -ra NBS_MATRIX_CMAKE_BUILD_TYPE +declare -ra NBS_MATRIX_SUPPORTED_OS +declare -ra NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS +declare -ra NBS_MATRIX_OSX_SUPPORTED_VERSIONS + +print_msg "Environment variables ${MSG_EMPH_FORMAT}(build matrix)${MSG_END_FORMAT} set for compose:\n +${MSG_DIMMED_FORMAT} NBS_MATRIX_REPOSITORY_VERSIONS=(${NBS_MATRIX_REPOSITORY_VERSIONS[*]}) ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} NBS_MATRIX_CMAKE_BUILD_TYPE=(${NBS_MATRIX_CMAKE_BUILD_TYPE[*]}) ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} NBS_MATRIX_SUPPORTED_OS=(${NBS_MATRIX_SUPPORTED_OS[*]}) ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS=(${NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS[*]}) ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} NBS_MATRIX_OSX_SUPPORTED_VERSIONS=(${NBS_MATRIX_OSX_SUPPORTED_VERSIONS[*]}) ${MSG_END_FORMAT} +" + +# Note: EACH_REPO_VERSION is used for container labeling and to fetch the repo at release tag +for EACH_REPO_VERSION in "${NBS_MATRIX_REPOSITORY_VERSIONS[@]}"; do + if [[ ${TEAMCITY_VERSION} ]]; then + echo -e "##teamcity[blockOpened name='${MSG_BASE_TEAMCITY} ${EACH_REPO_VERSION}']" + fi + + for EACH_OS_NAME in "${NBS_MATRIX_SUPPORTED_OS[@]}"; do + unset CRAWL_OS_VERSIONS + + if [[ ${EACH_OS_NAME} == 'ubuntu' ]]; then + CRAWL_OS_VERSIONS=("${NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS[@]}") + elif [[ ${EACH_OS_NAME} == 'osx' ]]; then + CRAWL_OS_VERSIONS=("${NBS_MATRIX_OSX_SUPPORTED_VERSIONS[@]}") + else + print_msg_error_and_exit "${EACH_OS_NAME} not supported!" + fi + + if [[ -z ${CRAWL_OS_VERSIONS} ]]; then + print_msg_error_and_exit "Can't crawl ${EACH_OS_NAME} supported version array because it's empty!" + fi + + if [[ ${TEAMCITY_VERSION} ]]; then + echo -e "##teamcity[blockOpened name='${MSG_BASE_TEAMCITY} ${EACH_OS_NAME}']" + fi + + for EACH_OS_VERSION in "${CRAWL_OS_VERSIONS[@]}"; do +# export NBS_JOB_ID=${NBS_JOB_ID} + + if [[ ${TEAMCITY_VERSION} ]]; then + echo -e "##teamcity[blockOpened name='${MSG_BASE_TEAMCITY} ${EACH_OS_VERSION}']" + fi + + for EACH_CMAKE_BUILD_TYPE in "${NBS_MATRIX_CMAKE_BUILD_TYPE[@]}"; do + + # shellcheck disable=SC2034 + SHOW_SPLASH_EC='false' + + if [[ ${TEAMCITY_VERSION} ]]; then + echo -e "##teamcity[blockOpened name='${MSG_BASE_TEAMCITY} execute nbs_execute_compose.bash' description='${MSG_DIMMED_FORMAT_TEAMCITY} --repository-version ${EACH_REPO_VERSION} --cmake-build-type ${EACH_CMAKE_BUILD_TYPE} --os-name ${EACH_OS_NAME} --os-version ${EACH_OS_VERSION} -- ${DOCKER_COMPOSE_CMD_ARGS}${MSG_END_FORMAT_TEAMCITY}|n']" + echo " " + fi + + source nbs_execute_compose.bash ${NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE} \ + --repository-version "${EACH_REPO_VERSION}" \ + --cmake-build-type "${EACH_CMAKE_BUILD_TYPE}" \ + --os-name "${EACH_OS_NAME}" \ + --os-version "${EACH_OS_VERSION}" \ + -- "${DOCKER_COMPOSE_CMD_ARGS}" + + # ....Collect image tags exported by nbs_execute_compose.bash.............................................. + # Global: Read 'DOCKER_EXIT_CODE' env variable exported by function show_and_execute_docker + if [[ ${DOCKER_EXIT_CODE} == 0 ]]; then + MSG_STATUS="${MSG_DONE_FORMAT}Pass ${MSG_DIMMED_FORMAT}›" + MSG_STATUS_TC_TAG="Pass ›" + else + MSG_STATUS="${MSG_ERROR_FORMAT}Fail ${MSG_DIMMED_FORMAT}›" + MSG_STATUS_TC_TAG="Fail ›" + BUILD_STATUS_PASS=$DOCKER_EXIT_CODE + + if [[ ${TEAMCITY_VERSION} ]]; then + # Fail the build › Will appear on the TeamCity Build Results page + echo -e "##teamcity[buildProblem description='BUILD FAIL with docker exit code: ${BUILD_STATUS_PASS}']" + fi + fi + + # Collect image tags exported by nbs_execute_compose.bash + # Global: Read 'NBS_IMAGE_TAG' env variable exported by nbs_execute_compose.bash + if [[ ${EACH_CMAKE_BUILD_TYPE} == 'None' ]] || [[ -z ${EACH_CMAKE_BUILD_TYPE} ]]; then + IMAGE_TAG_CRAWLED=("${IMAGE_TAG_CRAWLED[@]}" "${MSG_STATUS} ${NBS_IMAGE_TAG}") + IMAGE_TAG_CRAWLED_TC=("${IMAGE_TAG_CRAWLED_TC[@]}" "${MSG_STATUS_TC_TAG} ${NBS_IMAGE_TAG}") + else + IMAGE_TAG_CRAWLED=("${IMAGE_TAG_CRAWLED[@]}" "${MSG_STATUS} ${NBS_IMAGE_TAG} Compile mode: ${EACH_CMAKE_BUILD_TYPE}") + IMAGE_TAG_CRAWLED_TC=("${IMAGE_TAG_CRAWLED_TC[@]}" "${MSG_STATUS_TC_TAG} ${NBS_IMAGE_TAG} Compile mode: ${EACH_CMAKE_BUILD_TYPE}") + fi + # ......................................................................................................... + + if [[ ${TEAMCITY_VERSION} ]]; then + echo -e "##teamcity[blockClosed name='${MSG_BASE_TEAMCITY} execute nbs_execute_compose.bash']" + fi + + done + + if [[ ${TEAMCITY_VERSION} ]]; then + echo -e "##teamcity[blockClosed name='${MSG_BASE_TEAMCITY} ${EACH_OS_VERSION}']" + fi + + done + + if [[ ${TEAMCITY_VERSION} ]]; then + echo -e "##teamcity[blockClosed name='${MSG_BASE_TEAMCITY} ${EACH_OS_NAME}']" + fi + + done + if [[ ${TEAMCITY_VERSION} ]]; then + echo -e "##teamcity[blockClosed name='${MSG_BASE_TEAMCITY} ${EACH_REPO_VERSION}']" + fi +done + +echo " " +print_msg "Environment variables ${MSG_EMPH_FORMAT}(build matrix)${MSG_END_FORMAT} used by compose:\n +${MSG_DIMMED_FORMAT} NBS_MATRIX_REPOSITORY_VERSIONS=(${NBS_MATRIX_REPOSITORY_VERSIONS[*]}) ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} NBS_MATRIX_CMAKE_BUILD_TYPE=(${NBS_MATRIX_CMAKE_BUILD_TYPE[*]}) ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} NBS_MATRIX_SUPPORTED_OS=(${NBS_MATRIX_SUPPORTED_OS[*]}) ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS=(${NBS_MATRIX_UBUNTU_SUPPORTED_VERSIONS[*]}) ${MSG_END_FORMAT} +${MSG_DIMMED_FORMAT} NBS_MATRIX_OSX_SUPPORTED_VERSIONS=(${NBS_MATRIX_OSX_SUPPORTED_VERSIONS[*]}) ${MSG_END_FORMAT} +" + +print_msg_done "FINAL › Build matrix completed with command + +${MSG_DIMMED_FORMAT} $ docker compose -f ${NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE} ${DOCKER_COMPOSE_CMD_ARGS} ${MSG_END_FORMAT} + +Status of tag crawled: +" +for tag in "${IMAGE_TAG_CRAWLED[@]}" ; do + echo -e " ${tag}${MSG_END_FORMAT}" +done + +print_formated_script_footer 'nbs_execute_compose_over_build_matrix.bash' "${NBS_LINE_CHAR_BUILDER_LVL1}" + +# ====TeamCity service message===================================================================================== +if [[ ${TEAMCITY_VERSION} ]]; then + # Tag added to the TeamCity build via a service message + for tc_build_tag in "${IMAGE_TAG_CRAWLED_TC[@]}" ; do + echo -e "##teamcity[addBuildTag '${tc_build_tag}']" + done +fi + +# ====Teardown===================================================================================================== +cd "${TMP_CWD}" +exit $BUILD_STATUS_PASS diff --git a/build_system/readme_test.md b/build_system/readme_test.md deleted file mode 100644 index 821abe1c..00000000 --- a/build_system/readme_test.md +++ /dev/null @@ -1,5 +0,0 @@ - -`libpointmatcher` TeamCity project config test - -- [x] PR to `develop` branch -- [x] PR from `release` to `master` branch › test 3 diff --git a/build_system/test/Dockerfile.build_system_test b/build_system/test/Dockerfile.build_system_test index 92b928ed..37918644 100644 --- a/build_system/test/Dockerfile.build_system_test +++ b/build_system/test/Dockerfile.build_system_test @@ -45,6 +45,11 @@ RUN apt-get update \ # ....Install docker tools......................................................................................... + +# Required for norlab-build-system path resolution logic +WORKDIR /libpointmatcher-build-system +COPY ./.git ./.git + # Copy all files from the checkout branch in the repository (except those in the .dockerignore) WORKDIR /libpointmatcher-build-system/build_system @@ -55,7 +60,6 @@ COPY ./build_system/function_library/prompt_utilities.bash ./function_library/pr RUN chmod +x ./lpm_utility_script/lpm_install_docker_tools.bash - RUN source ./lpm_utility_script/lpm_install_docker_tools.bash diff --git a/build_system/test/test_build_and_run_IamBuildSystemTester.bash b/build_system/test/test_build_and_run_IamBuildSystemTester.bash index 35e0a4b6..0a1cfb45 100644 --- a/build_system/test/test_build_and_run_IamBuildSystemTester.bash +++ b/build_system/test/test_build_and_run_IamBuildSystemTester.bash @@ -40,7 +40,7 @@ fi # ====Begin======================================================================================================== -print_formated_script_header 'test_build_and_run_IamBuildSystemTester.bash' "${LPM_LINE_CHAR_TEST}" +print_formated_script_header 'test_build_and_run_IamBuildSystemTester.bash' "${NBS_LINE_CHAR_TEST}" # ....Build image.................................................................................................. echo @@ -59,6 +59,6 @@ fi show_and_execute_docker "run --name IamBuildSystemTester -t -i --rm lpm.ubuntu20.buildsystem.test ${DOCKER_CMD_ARGS}" -print_formated_script_footer 'test_build_and_run_IamBuildSystemTester.bash' "${LPM_LINE_CHAR_TEST}" +print_formated_script_footer 'test_build_and_run_IamBuildSystemTester.bash' "${NBS_LINE_CHAR_TEST}" # ====Teardown===================================================================================================== cd "${TMP_CWD}" diff --git a/build_system/ubuntu/Dockerfile.dependencies b/build_system/ubuntu/Dockerfile.dependencies index c1f59a6e..2827da94 100644 --- a/build_system/ubuntu/Dockerfile.dependencies +++ b/build_system/ubuntu/Dockerfile.dependencies @@ -4,10 +4,10 @@ FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS base-image LABEL org.opencontainers.image.authors="luc.coupal.1@ulaval.ca" -ARG LPM_INSTALLED_LIBRARIES_PATH -ARG LPM_LIBPOINTMATCHER_SRC_REPO_NAME -ENV LPM_INSTALLED_LIBRARIES_PATH=${LPM_INSTALLED_LIBRARIES_PATH:?'Build argument needs to be set and non-empty.'} -ENV LPM_LIBPOINTMATCHER_SRC_REPO_NAME=${LPM_LIBPOINTMATCHER_SRC_REPO_NAME:?'Build argument needs to be set and non-empty.'} +ARG NBS_LIB_INSTALL_PATH +ARG NBS_REPOSITORY_NAME +ENV NBS_LIB_INSTALL_PATH=${NBS_LIB_INSTALL_PATH:?'Build argument needs to be set and non-empty.'} +ENV NBS_REPOSITORY_NAME=${NBS_REPOSITORY_NAME:?'Build argument needs to be set and non-empty.'} ARG IS_TEAMCITY_RUN ENV IS_TEAMCITY_RUN=${IS_TEAMCITY_RUN:-false} @@ -19,7 +19,7 @@ ENV TZ=Etc/UTC ENV TERM=${TERM:-"xterm-256color"} -# ....Setup timezone and localization.............................................................................. +# ....Setup timezone and localization.............................................................. # change the locale from POSIX to UTF-8 RUN apt-get update && \ apt-get install --assume-yes --no-install-recommends \ @@ -32,9 +32,9 @@ ENV LANG=en_US.UTF-8 ENV PYTHONIOENCODING=utf-8 -# ====Begin install================================================================================================= +# ====Begin install================================================================================= -# ....Install development utilities................................................................................ +# ....Install development utilities................................................................ RUN apt-get update && \ apt-get install --assume-yes --no-install-recommends \ sudo \ @@ -51,8 +51,13 @@ RUN apt-get update && \ apt-utils && \ rm -rf /var/lib/apt/lists/* -# ====Begin======================================================================================================== -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/build_system" +# ====Begin======================================================================================== + +# Required for norlab-build-system path resolution logic +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" +COPY ./.git ./.git + +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system" COPY ./build_system/.env.prompt . COPY ./build_system/.env . @@ -65,24 +70,29 @@ RUN chmod +x ./ubuntu/lpm_install_python_dev_tools.bash RUN source ./ubuntu/lpm_install_python_dev_tools.bash -# ====Install Libpointmatcher dependencies========================================================================== -FROM base-image AS libpointmatcher-dependencies +# ====Install Libpointmatcher dependencies========================================================= +FROM base-image AS libpointmatcher-dependencies-general -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/build_system" +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system" -COPY ./build_system/ubuntu/lpm_install_dependencies_ubuntu.bash ./ubuntu/ +COPY ./build_system/ubuntu/lpm_install_dependencies_general_ubuntu.bash ./ubuntu/ +COPY ./build_system/ubuntu/lpm_install_dependencies_libnabo_ubuntu.bash ./ubuntu/ COPY ./build_system/ubuntu/lpm_install_python_dev_tools.bash ./ubuntu/ COPY ./build_system/function_library/ ./function_library/ COPY ./build_system/lpm_utility_script/lpm_export_which_architecture.bash ./lpm_utility_script/ WORKDIR ./ubuntu +RUN chmod +x ./lpm_install_dependencies_general_ubuntu.bash +RUN source ./lpm_install_dependencies_general_ubuntu.bash + +FROM libpointmatcher-dependencies-general AS libpointmatcher-dependencies-libnabo -RUN chmod +x ./lpm_install_dependencies_ubuntu.bash -RUN source ./lpm_install_dependencies_ubuntu.bash +RUN chmod +x ./lpm_install_dependencies_libnabo_ubuntu.bash +RUN source ./lpm_install_dependencies_libnabo_ubuntu.bash -# ====End========================================================================================================== -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/" -RUN rm -r -f "./${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" +# ====End========================================================================================== +#FROM libpointmatcher-dependencies-libnabo AS final +WORKDIR "${NBS_LIB_INSTALL_PATH}/" +RUN rm -r -f "./${NBS_REPOSITORY_NAME}" -FROM libpointmatcher-dependencies AS final CMD [ "bash" ] diff --git a/build_system/ubuntu/Dockerfile.dependencies_doc b/build_system/ubuntu/Dockerfile.dependencies_doc index d717b077..a3dc1a1b 100644 --- a/build_system/ubuntu/Dockerfile.dependencies_doc +++ b/build_system/ubuntu/Dockerfile.dependencies_doc @@ -11,8 +11,11 @@ ENV IS_TEAMCITY_RUN=${IS_TEAMCITY_RUN:-false} SHELL ["/bin/bash", "-c"] ARG DEBIAN_FRONTEND=noninteractive +# Required for norlab-build-system path resolution logic +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" +COPY ./.git ./.git -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/build_system" +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system" COPY ./build_system/.env.prompt . COPY ./build_system/.env . @@ -21,16 +24,16 @@ COPY ./build_system/ubuntu/lpm_install_doc_dependencies_ubuntu.bash ./ubuntu/ COPY ./build_system/function_library/ ./function_library/ COPY ./build_system/lpm_utility_script/lpm_export_which_architecture.bash ./lpm_utility_script/ -# ====Install Libpointmatcher documentation related dependencies==================================================== +# ====Install Libpointmatcher documentation related dependencies=================================== WORKDIR ./ubuntu RUN chmod +x lpm_install_doc_dependencies_ubuntu.bash RUN source lpm_install_doc_dependencies_ubuntu.bash -# ====End========================================================================================================== -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/" -RUN rm -r -f "./${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" +# ====End========================================================================================== +WORKDIR "${NBS_LIB_INSTALL_PATH}/" +RUN rm -r -f "./${NBS_REPOSITORY_NAME}" FROM libpointmatcher-dependencies-full AS final CMD [ "bash" ] diff --git a/build_system/ubuntu/Dockerfile.libpointmatcher b/build_system/ubuntu/Dockerfile.libpointmatcher index 263d74fe..dfbd8ee1 100644 --- a/build_system/ubuntu/Dockerfile.libpointmatcher +++ b/build_system/ubuntu/Dockerfile.libpointmatcher @@ -5,15 +5,15 @@ FROM ${PROJECT_HUB}/${BASE_IMAGE}:${BASE_IMAGE_TAG:?err} AS libpointmatcher-depe LABEL org.opencontainers.image.authors="luc.coupal.1@ulaval.ca" -ARG LIBPOINTMATCHER_VERSION -ENV LIBPOINTMATCHER_VERSION=${LIBPOINTMATCHER_VERSION:?'Build argument needs to be set and non-empty.'} -LABEL libpointmatcher.version="${LIBPOINTMATCHER_VERSION}" +ARG REPOSITORY_VERSION +ENV REPOSITORY_VERSION=${REPOSITORY_VERSION:?'Build argument needs to be set and non-empty.'} +LABEL libpointmatcher.version="${REPOSITORY_VERSION}" -ARG LPM_INSTALLED_LIBRARIES_PATH -ARG LPM_LIBPOINTMATCHER_SRC_REPO_NAME -ENV LPM_INSTALLED_LIBRARIES_PATH=${LPM_INSTALLED_LIBRARIES_PATH:?'Build argument needs to be set and non-empty.'} -ENV LPM_LIBPOINTMATCHER_SRC_REPO_NAME=${LPM_LIBPOINTMATCHER_SRC_REPO_NAME:?'Build argument needs to be set and non-empty.'} +ARG NBS_LIB_INSTALL_PATH +ARG NBS_REPOSITORY_NAME +ENV NBS_LIB_INSTALL_PATH=${NBS_LIB_INSTALL_PATH:?'Build argument needs to be set and non-empty.'} +ENV NBS_REPOSITORY_NAME=${NBS_REPOSITORY_NAME:?'Build argument needs to be set and non-empty.'} ARG LIBPOINTMATCHER_CMAKE_BUILD_TYPE=Release ARG LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG="" @@ -27,41 +27,35 @@ ENV IS_TEAMCITY_RUN=${IS_TEAMCITY_RUN:-false} SHELL ["/bin/bash", "-c"] ARG DEBIAN_FRONTEND=noninteractive -# ====Build system related setup==================================================================================== -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}-CICD/" +# ====Build system related setup=================================================================== +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}-CICD/" # Copy only the build system file for running the install and test scripts # Note: Logic to copy files from the checkout branch is handle by 'lpm_install_libpointmatcher_ubuntu.bash' script COPY ./build_system/ ./build_system/ -# ==== Build libpointmatcher checkout branch ====================================================================== +# ==== Build libpointmatcher checkout branch ====================================================== WORKDIR ./build_system/ubuntu RUN chmod +x lpm_install_libpointmatcher_ubuntu.bash RUN chmod +x entrypoint_execute_lpm_unittest.bash RUN chmod +x entrypoint.bash -## (CRITICAL) ToDo: on task end >> delete next bloc ↓↓ -#RUN chmod +x lpm_install_doc_dependencies_ubuntu.bash -#RUN bash lpm_install_doc_dependencies_ubuntu.bash - -# ====Install Libpointmatcher======================================================================================= - -# (CRITICAL) ToDo: validate effect on teamcity build log (source vs bash) +# ====Install Libpointmatcher====================================================================== RUN source lpm_install_libpointmatcher_ubuntu.bash \ - --libpointmatcher-version ${LIBPOINTMATCHER_VERSION} \ + --repository-version ${REPOSITORY_VERSION} \ --cmake-build-type ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} \ ${LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG} -# ==== Execute libpointmatcher unit-test=========================================================================== +# ==== Execute libpointmatcher unit-test=========================================================== # Conditional execution if build/utest/ directory is present RUN source entrypoint_execute_lpm_unittest.bash -# ====End========================================================================================================== +# ====End========================================================================================== FROM libpointmatcher-dependencies AS libpointmatcher-release -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}-CICD/build_system/ubuntu" +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}-CICD/build_system/ubuntu" ENTRYPOINT [ "./entrypoint.bash" ] CMD [ "bash" ] diff --git a/build_system/ubuntu/Dockerfile.libpointmatcher_ci_PR b/build_system/ubuntu/Dockerfile.libpointmatcher_ci_PR index 72f15968..7c3202d6 100644 --- a/build_system/ubuntu/Dockerfile.libpointmatcher_ci_PR +++ b/build_system/ubuntu/Dockerfile.libpointmatcher_ci_PR @@ -5,14 +5,14 @@ FROM ${PROJECT_HUB}/${BASE_IMAGE}:${BASE_IMAGE_TAG:?err} AS libpointmatcher-depe LABEL org.opencontainers.image.authors="luc.coupal.1@ulaval.ca" -ARG LIBPOINTMATCHER_VERSION='head' -ENV LIBPOINTMATCHER_VERSION=${LIBPOINTMATCHER_VERSION} -LABEL libpointmatcher.version="${LIBPOINTMATCHER_VERSION}" +ARG REPOSITORY_VERSION='latest' +ENV REPOSITORY_VERSION=${REPOSITORY_VERSION} +LABEL libpointmatcher.version="${REPOSITORY_VERSION}" -ARG LPM_INSTALLED_LIBRARIES_PATH -ARG LPM_LIBPOINTMATCHER_SRC_REPO_NAME -ENV LPM_INSTALLED_LIBRARIES_PATH=${LPM_INSTALLED_LIBRARIES_PATH:?'Build argument needs to be set and non-empty.'} -ENV LPM_LIBPOINTMATCHER_SRC_REPO_NAME=${LPM_LIBPOINTMATCHER_SRC_REPO_NAME:?'Build argument needs to be set and non-empty.'} +ARG NBS_LIB_INSTALL_PATH +ARG NBS_REPOSITORY_NAME +ENV NBS_LIB_INSTALL_PATH=${NBS_LIB_INSTALL_PATH:?'Build argument needs to be set and non-empty.'} +ENV NBS_REPOSITORY_NAME=${NBS_REPOSITORY_NAME:?'Build argument needs to be set and non-empty.'} ARG LIBPOINTMATCHER_CMAKE_BUILD_TYPE=RelWithDebInfo ARG LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG='--build-system-CI-install --compile-test' @@ -29,18 +29,18 @@ ARG DEBIAN_FRONTEND=noninteractive # ToDo: validate ENV TERM=${TERM:-"xterm-256color"} -# ====Checkout libpointmatcher repository=========================================================================== -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" +# ====Checkout libpointmatcher repository========================================================== +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" # Copy all files from the checkout branch in the repository (except those in the .dockerignore) COPY . . -# ====Check Libpointmatcher dependencies installed versions======================================================== -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" +# ====Check Libpointmatcher dependencies installed versions======================================== +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" RUN chmod +x ./utest/listVersionsUbuntu.sh RUN utest/listVersionsUbuntu.sh -# ==== Build libpointmatcher checkout branch ====================================================================== +# ==== Build libpointmatcher checkout branch ====================================================== WORKDIR ./build_system/ubuntu RUN chmod +x lpm_install_libpointmatcher_ubuntu.bash @@ -49,20 +49,20 @@ RUN chmod +x entrypoint.bash RUN source lpm_install_libpointmatcher_ubuntu.bash \ - --libpointmatcher-version ${LIBPOINTMATCHER_VERSION} \ + --repository-version ${REPOSITORY_VERSION} \ --cmake-build-type ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} \ ${LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG} -# ==== Execute libpointmatcher unit-test=========================================================================== +# ==== Execute libpointmatcher unit-test=========================================================== RUN source lpm_execute_libpointmatcher_unittest.bash -# ................................................................................................................ +# ................................................................................................. ## Alternate version #RUN chmod +x entrypoint_build_and_test_libpointmatcher_checkout_branch.bash #RUN chmod +x entrypoint_build_libpointmatcher_checkout_branch.bash #RUN source entrypoint_build_and_test_libpointmatcher_checkout_branch.bash #RUN source entrypoint_build_libpointmatcher_checkout_branch.bash -# ====End========================================================================================================== +# ====End========================================================================================== ENTRYPOINT [ "./entrypoint.bash" ] CMD [ "bash" ] diff --git a/build_system/ubuntu/Dockerfile.libpointmatcher_ci_SITREP_matrix b/build_system/ubuntu/Dockerfile.libpointmatcher_ci_SITREP_matrix index 7df986c5..fd9c5a30 100644 --- a/build_system/ubuntu/Dockerfile.libpointmatcher_ci_SITREP_matrix +++ b/build_system/ubuntu/Dockerfile.libpointmatcher_ci_SITREP_matrix @@ -5,14 +5,14 @@ FROM ${PROJECT_HUB}/${BASE_IMAGE}:${BASE_IMAGE_TAG:?err} AS libpointmatcher-depe LABEL org.opencontainers.image.authors="luc.coupal.1@ulaval.ca" -ARG LIBPOINTMATCHER_VERSION='head' -ENV LIBPOINTMATCHER_VERSION=${LIBPOINTMATCHER_VERSION} -LABEL libpointmatcher.version="${LIBPOINTMATCHER_VERSION}" +ARG REPOSITORY_VERSION='latest' +ENV REPOSITORY_VERSION=${REPOSITORY_VERSION} +LABEL libpointmatcher.version="${REPOSITORY_VERSION}" -ARG LPM_INSTALLED_LIBRARIES_PATH -ARG LPM_LIBPOINTMATCHER_SRC_REPO_NAME -ENV LPM_INSTALLED_LIBRARIES_PATH=${LPM_INSTALLED_LIBRARIES_PATH:?'Build argument needs to be set and non-empty.'} -ENV LPM_LIBPOINTMATCHER_SRC_REPO_NAME=${LPM_LIBPOINTMATCHER_SRC_REPO_NAME:?'Build argument needs to be set and non-empty.'} +ARG NBS_LIB_INSTALL_PATH +ARG NBS_REPOSITORY_NAME +ENV NBS_LIB_INSTALL_PATH=${NBS_LIB_INSTALL_PATH:?'Build argument needs to be set and non-empty.'} +ENV NBS_REPOSITORY_NAME=${NBS_REPOSITORY_NAME:?'Build argument needs to be set and non-empty.'} ARG LIBPOINTMATCHER_CMAKE_BUILD_TYPE ARG LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG='--compile-test' @@ -28,14 +28,14 @@ ARG DEBIAN_FRONTEND=noninteractive ENV TERM=${TERM:-"xterm-256color"} -# ====Checkout libpointmatcher repository=========================================================================== -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}-CICD/" +# ====Checkout libpointmatcher repository========================================================== +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}-CICD/" # Copy only the build system file for running the install and test scripts # Note: Logic to copy files from the checkout branch is handle by 'lpm_install_libpointmatcher_ubuntu.bash' script COPY ./build_system/ ./build_system/ -# ==== Build libpointmatcher checkout branch ====================================================================== +# ==== Build libpointmatcher checkout branch ====================================================== WORKDIR ./build_system/ubuntu RUN chmod +x lpm_install_libpointmatcher_ubuntu.bash @@ -43,27 +43,27 @@ RUN chmod +x lpm_execute_libpointmatcher_unittest.bash RUN chmod +x entrypoint.bash -# Note: Logic for cd into ${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME} is the responsablitiy of lpm_install_libpointmatcher_ubuntu.bash +# Note: Logic for cd into ${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME} is the responsablitiy of lpm_install_libpointmatcher_ubuntu.bash RUN source lpm_install_libpointmatcher_ubuntu.bash \ - --libpointmatcher-version ${LIBPOINTMATCHER_VERSION} \ + --repository-version ${REPOSITORY_VERSION} \ --cmake-build-type ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} \ ${LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG} -# ==== Execute libpointmatcher unit-test=========================================================================== +# ==== Execute libpointmatcher unit-test=========================================================== RUN source lpm_execute_libpointmatcher_unittest.bash -# ====Check Libpointmatcher dependencies installed versions======================================================== -WORKDIR "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" +# ====Check Libpointmatcher dependencies installed versions======================================== +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" RUN chmod +x ./utest/listVersionsUbuntu.sh RUN utest/listVersionsUbuntu.sh -# ................................................................................................................ +# ................................................................................................. ## Alternate version #RUN chmod +x entrypoint_build_and_test_libpointmatcher_checkout_branch.bash #RUN chmod +x entrypoint_build_libpointmatcher_checkout_branch.bash #RUN source entrypoint_build_and_test_libpointmatcher_checkout_branch.bash #RUN source entrypoint_build_libpointmatcher_checkout_branch.bash -# ====End========================================================================================================== +# ====End========================================================================================== ENTRYPOINT [ "./entrypoint.bash" ] CMD [ "bash" ] diff --git a/build_system/ubuntu/Dockerfile.libpointmatcher_test_compilation b/build_system/ubuntu/Dockerfile.libpointmatcher_test_compilation new file mode 100644 index 00000000..b43464a4 --- /dev/null +++ b/build_system/ubuntu/Dockerfile.libpointmatcher_test_compilation @@ -0,0 +1,120 @@ +ARG PROJECT_HUB=norlabulaval +ARG BASE_IMAGE=libpointmatcher-dependencies-general +ARG BASE_IMAGE_TAG +FROM ${PROJECT_HUB}/${BASE_IMAGE}:${BASE_IMAGE_TAG:?err} AS libpointmatcher-dependencies-general + +LABEL org.opencontainers.image.authors="luc.coupal.1@ulaval.ca" + +ARG REPOSITORY_VERSION='latest' +ENV REPOSITORY_VERSION=${REPOSITORY_VERSION} +LABEL libpointmatcher.version="${REPOSITORY_VERSION}" + +ARG NBS_LIB_INSTALL_PATH +ARG NBS_REPOSITORY_NAME +ENV NBS_LIB_INSTALL_PATH=${NBS_LIB_INSTALL_PATH:?'Build argument needs to be set and non-empty.'} +ENV NBS_REPOSITORY_NAME=${NBS_REPOSITORY_NAME:?'Build argument needs to be set and non-empty.'} + +ARG LIBPOINTMATCHER_CMAKE_BUILD_TYPE=RelWithDebInfo +ARG LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG='--build-system-CI-install' +# Note: Those env variable are used in the entrypoint build version +ENV LIBPOINTMATCHER_CMAKE_BUILD_TYPE=${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} +ENV LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG=${LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG} + +ARG IS_TEAMCITY_RUN +ENV IS_TEAMCITY_RUN=${IS_TEAMCITY_RUN:-false} + +SHELL ["/bin/bash", "-c"] +ARG DEBIAN_FRONTEND=noninteractive + +# ToDo: validate +ENV TERM=${TERM:-"xterm-256color"} + +# ====Checkout libpointmatcher repository========================================================== +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" + +# Copy all files from the checkout branch in the repository (except those in the .dockerignore) +COPY . . + +#WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system/ubuntu" + +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" +RUN chmod +x ./utest/listVersionsUbuntu.sh + +WORKDIR ./build_system/ubuntu +RUN chmod +x lpm_install_dependencies_libnabo_ubuntu.bash +RUN chmod +x lpm_install_libpointmatcher_ubuntu.bash +RUN chmod +x lpm_execute_libpointmatcher_unittest.bash +RUN chmod +x entrypoint.bash + +# ====Test compilation with automatic path resolution============================================== +FROM libpointmatcher-dependencies-general AS test-compilation-auto-path-resolution +ENV OVERRIDE_LIBNABO_CMAKE_INSTALL_PREFIX=() +ENV OVERRIDE_NBS_CMAKE_INSTALL_PREFIX=() + +RUN echo && echo ">> nproc=$(nproc)" && echo # ToDo: on task end >> delete this line + +# ....Install libnabo.............................................................................. +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system/ubuntu" +RUN source ./lpm_install_dependencies_libnabo_ubuntu.bash + +# ....Check Libpointmatcher dependencies installed versions........................................ +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" +RUN utest/listVersionsUbuntu.sh + +# .... Build libpointmatcher checkout branch ...................................................... +WORKDIR ./build_system/ubuntu +RUN source lpm_install_libpointmatcher_ubuntu.bash \ + --repository-version ${REPOSITORY_VERSION} \ + --cmake-build-type ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} \ + ${LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG} + +# .... Compile package dependent on libpointmatcher ............................................... +WORKDIR "${NBS_LIB_INSTALL_PATH}" +RUN git clone https://github.com/norlab-ulaval/norlab_icp_mapper.git \ + && mkdir -p norlab_icp_mapper/build && cd norlab_icp_mapper/build \ + && cmake -DCMAKE_BUILD_TYPE=Release .. \ + && make -j $(nproc) \ + && make install + +ENTRYPOINT [ "./entrypoint.bash" ] +CMD [ "bash" ] + +# ====Test compilation with explicit path resolution=============================================== +FROM libpointmatcher-dependencies-general AS test-compilation-prefixed-path +ENV OVERRIDE_LIBNABO_CMAKE_INSTALL_PREFIX=("-D CMAKE_INSTALL_PREFIX=${NBS_LIB_INSTALL_PATH:?err}") +ENV OVERRIDE_NBS_CMAKE_INSTALL_PREFIX=("-D CMAKE_INSTALL_PREFIX=${NBS_LIB_INSTALL_PATH:?err}") + +RUN echo && echo ">> nproc=$(nproc)" && echo # ToDo: on task end >> delete this line + +# ....Install libnabo.............................................................................. +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system/ubuntu" +RUN source ./lpm_install_dependencies_libnabo_ubuntu.bash + +# ....Check Libpointmatcher dependencies installed versions........................................ +WORKDIR "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" +RUN utest/listVersionsUbuntu.sh + +# .... Build libpointmatcher checkout branch ...................................................... +WORKDIR ./build_system/ubuntu +RUN source lpm_install_libpointmatcher_ubuntu.bash \ + --repository-version ${REPOSITORY_VERSION} \ + --cmake-build-type ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} \ + ${LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG} + +# .... Compile package dependent on libpointmatcher ............................................... +WORKDIR "${NBS_LIB_INSTALL_PATH}" +RUN git clone https://github.com/norlab-ulaval/norlab_icp_mapper.git \ + && mkdir -p norlab_icp_mapper/build && cd norlab_icp_mapper/build \ + && cmake -DCMAKE_BUILD_TYPE=Release .. \ + && make -j $(nproc) \ + && make install + +ENTRYPOINT [ "./entrypoint.bash" ] +CMD [ "bash" ] + +# ................................................................................................. +## Alternate version +#RUN chmod +x entrypoint_build_and_test_libpointmatcher_checkout_branch.bash +#RUN chmod +x entrypoint_build_libpointmatcher_checkout_branch.bash +#RUN source entrypoint_build_and_test_libpointmatcher_checkout_branch.bash +#RUN source entrypoint_build_libpointmatcher_checkout_branch.bash diff --git a/build_system/ubuntu/entrypoint.bash b/build_system/ubuntu/entrypoint.bash index 1553396c..60086ac0 100644 --- a/build_system/ubuntu/entrypoint.bash +++ b/build_system/ubuntu/entrypoint.bash @@ -11,7 +11,7 @@ ifconfig -cd "${LPM_INSTALLED_LIBRARIES_PATH}" +cd "${NBS_LIB_INSTALL_PATH}" pwd tree -L 1 diff --git a/build_system/ubuntu/entrypoint_build_and_test_libpointmatcher_checkout_branch.bash b/build_system/ubuntu/entrypoint_build_and_test_libpointmatcher_checkout_branch.bash index 7636b1c7..8515dcc3 100644 --- a/build_system/ubuntu/entrypoint_build_and_test_libpointmatcher_checkout_branch.bash +++ b/build_system/ubuntu/entrypoint_build_and_test_libpointmatcher_checkout_branch.bash @@ -16,13 +16,13 @@ set +o allexport # ==== Build libpointmatcher checkout branch ====================================================================== source lpm_install_libpointmatcher_ubuntu.bash \ - --libpointmatcher-version ${LIBPOINTMATCHER_VERSION:?'err variable not set'} \ + --repository-version ${REPOSITORY_VERSION:?'err variable not set'} \ --cmake-build-type ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} \ ${LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG} # ==== Execute libpointmatcher unit-test=========================================================================== -cd "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/build" -utest/utest --path "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/examples/data/" +cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build" +utest/utest --path "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/examples/data/" # ====Continue===================================================================================================== exec "$@" diff --git a/build_system/ubuntu/entrypoint_build_libpointmatcher_checkout_branch.bash b/build_system/ubuntu/entrypoint_build_libpointmatcher_checkout_branch.bash index c10a49ce..087397ac 100644 --- a/build_system/ubuntu/entrypoint_build_libpointmatcher_checkout_branch.bash +++ b/build_system/ubuntu/entrypoint_build_libpointmatcher_checkout_branch.bash @@ -16,7 +16,7 @@ set +o allexport # ==== Build libpointmatcher checkout branch ====================================================================== source lpm_install_libpointmatcher_ubuntu.bash \ - --libpointmatcher-version ${LIBPOINTMATCHER_VERSION:?'err variable not set'} \ + --repository-version ${REPOSITORY_VERSION:?'err variable not set'} \ --cmake-build-type ${LIBPOINTMATCHER_CMAKE_BUILD_TYPE} \ ${LIBPOINTMATCHER_INSTALL_SCRIPT_FLAG} diff --git a/build_system/ubuntu/entrypoint_execute_lpm_unittest.bash b/build_system/ubuntu/entrypoint_execute_lpm_unittest.bash index d9af1da0..a446dd4e 100644 --- a/build_system/ubuntu/entrypoint_execute_lpm_unittest.bash +++ b/build_system/ubuntu/entrypoint_execute_lpm_unittest.bash @@ -11,7 +11,7 @@ #set -e # ====Build system tools=========================================================================================== -cd "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/build_system" +cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system" # ....Load environment variables from file......................................................................... set -o allexport @@ -19,20 +19,20 @@ source .env set +o allexport # ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library +# import shell functions from utilities library source ./function_library/prompt_utilities.bash # ==== Check libopintmatcher dependencies versions================================================================= -cd "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" +cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" sudo chmod +x ./utest/listVersionsUbuntu.sh utest/listVersionsUbuntu.sh # ==== Execute libpointmatcher unit-test=========================================================================== # ................................................................................................................. -cd "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/build" +cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build" if [[ -d ./utest ]]; then - cd "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/build_system" + cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system" source entrypoint_execute_lpm_unittest.bash else print_msg_warning "Directory ${MSG_DIMMED_FORMAT}utest/${MSG_END_FORMAT} was not created during compilation. diff --git a/build_system/ubuntu/lpm_execute_libpointmatcher_unittest.bash b/build_system/ubuntu/lpm_execute_libpointmatcher_unittest.bash index 279bf5fc..098e8440 100644 --- a/build_system/ubuntu/lpm_execute_libpointmatcher_unittest.bash +++ b/build_system/ubuntu/lpm_execute_libpointmatcher_unittest.bash @@ -28,7 +28,7 @@ source ./function_library/prompt_utilities.bash # ====Begin======================================================================================================== print_formated_script_header 'lpm_execute_libpointmatcher_unittest.bash' ':' -cd "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/build" +cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build" if [[ ${IS_TEAMCITY_RUN} == true ]] || [[ ${TEAMCITY_VERSION} ]]; then echo -e "##teamcity[testSuiteStarted name='gtest']" @@ -39,7 +39,7 @@ fi # ................................................................................................................. sudo chmod +x utest/utest -utest/utest --path "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/examples/data/" +utest/utest --path "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/examples/data/" UTEST_EXIT_CODE=$? # ................................................................................................................. diff --git a/build_system/ubuntu/lpm_install_dependencies_general_ubuntu.bash b/build_system/ubuntu/lpm_install_dependencies_general_ubuntu.bash new file mode 100644 index 00000000..7e6d2786 --- /dev/null +++ b/build_system/ubuntu/lpm_install_dependencies_general_ubuntu.bash @@ -0,0 +1,108 @@ +#!/bin/bash -i +# +# Libpointmatcher dependencies installer +# +# Usage: +# $ source lpm_install_dependencies_general_ubuntu.bash +# +set -e # Note: we want the installer to always fail-fast (it wont affect the build system policy) + +# ....Project root logic........................................................................... +TMP_CWD=$(pwd) + +if [[ "$(basename $(pwd))" != "build_system" ]]; then + cd ../ +fi + +# ....Load environment variables from file......................................................... +set -o allexport +source ./.env +source ./.env.prompt +set +o allexport + +# skip GUI dialog by setting everything to default +export DEBIAN_FRONTEND=noninteractive + +# ....Helper function.............................................................................. +# import shell functions from utilities library +source ./function_library/prompt_utilities.bash +source ./function_library/terminal_splash.bash +source ./function_library/general_utilities.bash + +# Set environment variable NBS_IMAGE_ARCHITECTURE +source ./lpm_utility_script/lpm_export_which_architecture.bash + +# ====Begin======================================================================================== +SHOW_SPLASH_IDU="${SHOW_SPLASH_IDU:-true}" + +if [[ "${SHOW_SPLASH_IDU}" == 'true' ]]; then + norlab_splash "${NBS_SPLASH_NAME}" "https://github.com/${NBS_REPOSITORY_DOMAIN}/${NBS_REPOSITORY_NAME}" +fi + +print_formated_script_header "lpm_install_dependencies_general_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" + +# ................................................................................................. +teamcity_service_msg_blockOpened "Install development utilities" + +sudo apt-get update && + sudo apt-get install --assume-yes \ + lsb-release \ + build-essential \ + ca-certificates \ + curl \ + wget \ + git \ + g++ \ + gcc \ + catch \ + make \ + cmake \ + cmake-gui && + sudo rm -rf /var/lib/apt/lists/* + +cmake --version + +teamcity_service_msg_blockClosed +# ................................................................................................. + +if [[ ${IS_TEAMCITY_RUN} == true ]]; then + print_msg "The install script is run in teamCity >> the python install step was executed earlier in the Dockerfile.dependencies" +else + print_msg "The install script is executed in stand alone mode" + source ./ubuntu/lpm_install_python_dev_tools.bash +fi + +# ................................................................................................. +teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Boost" +# https://www.boost.org/doc/libs/1_79_0/more/getting_started/unix-variants.html + +sudo apt-get update && + sudo apt-get install --assume-yes \ + libboost-all-dev && + sudo rm -rf /var/lib/apt/lists/* + +teamcity_service_msg_blockClosed +# ................................................................................................. +teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Eigen" +# https://eigen.tuxfamily.org/index.php + +sudo apt-get update && + sudo apt-get install --assume-yes \ + libeigen3-dev && + sudo rm -rf /var/lib/apt/lists/* + +teamcity_service_msg_blockClosed +# ................................................................................................. +teamcity_service_msg_blockOpened "Install Libpointmatcher dev tools" + +sudo apt-get update && + sudo apt-get install --assume-yes \ + libyaml-cpp-dev && + sudo rm -rf /var/lib/apt/lists/* + +teamcity_service_msg_blockClosed + +#echo " " && print_msg_done "Libpointmatcher general dependencies installed" +print_formated_script_footer "lpm_install_dependencies_general_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" +# ====Teardown===================================================================================== +cd "${TMP_CWD}" diff --git a/build_system/ubuntu/lpm_install_dependencies_libnabo_ubuntu.bash b/build_system/ubuntu/lpm_install_dependencies_libnabo_ubuntu.bash new file mode 100644 index 00000000..2376dc56 --- /dev/null +++ b/build_system/ubuntu/lpm_install_dependencies_libnabo_ubuntu.bash @@ -0,0 +1,125 @@ +#!/bin/bash -i +# +# Libpointmatcher dependencies installer +# +# Usage: +# $ source lpm_install_dependencies_libnabo_ubuntu.bash +# +# $ export OVERRIDE_LIBNABO_CMAKE_INSTALL_PREFIX=( "-D CMAKE_INSTALL_PREFIX=/opt" ) && source lpm_install_dependencies_libnabo_ubuntu.bash +# +# Global: +# - Read "OVERRIDE_LIBNABO_CMAKE_INSTALL_PREFIX" +# +set -e # Note: we want the installer to always fail-fast (it wont affect the build system policy) + +# ....Project root logic........................................................................... +TMP_CWD=$(pwd) + +if [[ "$(basename $(pwd))" != "build_system" ]]; then + cd ../ +fi + +# ....Load environment variables from file......................................................... +set -o allexport +source ./.env +source ./.env.prompt +set +o allexport + +# skip GUI dialog by setting everything to default +export DEBIAN_FRONTEND=noninteractive + +# ....Helper function.............................................................................. +# import shell functions from utilities library +source ./function_library/prompt_utilities.bash +source ./function_library/terminal_splash.bash +source ./function_library/general_utilities.bash + +# Set environment variable NBS_IMAGE_ARCHITECTURE +source ./lpm_utility_script/lpm_export_which_architecture.bash + +# ....Override..................................................................................... +declare -a DEFAULT_LIBNABO_CMAKE_INSTALL_PREFIX=( "-D CMAKE_INSTALL_PREFIX=${NBS_LIB_INSTALL_PATH:?err}" ) +declare -a OVERRIDE_LIBNABO_CMAKE_INSTALL_PREFIX +declare -a LIBNABO_CMAKE_INSTALL_PREFIX=( "${OVERRIDE_LIBNABO_CMAKE_INSTALL_PREFIX[@]:-${DEFAULT_LIBNABO_CMAKE_INSTALL_PREFIX[@]}}" ) + + +# ====Begin======================================================================================== +SHOW_SPLASH_IDU="${SHOW_SPLASH_IDU:-true}" + +if [[ "${SHOW_SPLASH_IDU}" == 'true' ]]; then + norlab_splash "${NBS_SPLASH_NAME}" "https://github.com/${NBS_REPOSITORY_DOMAIN}/${NBS_REPOSITORY_NAME}" +fi + +print_formated_script_header "lpm_install_dependencies_libnabo_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" + +# ................................................................................................. +teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Libnabo" +# https://github.com/ethz-asl/libnabo + +print_msg "Create required dir structure" +mkdir -p "${NBS_LIB_INSTALL_PATH}" + +## Note: +# - ANN is not mentioned in doc because it's only required for `make test` benchmarks +# - Leave it commented in code for future references +## ANN is a library written in C++, which supports data structures and algorithms for both exact and approximate nearest neighbor searching in arbitrarily high dimensions. +## https://www.cs.umd.edu/~mount/ANN/ +#cd "${NBS_LIB_INSTALL_PATH}" +#wget https://www.cs.umd.edu/~mount/ANN/Files/1.1.2/ann_1.1.2.tar.gz +#tar xzf ann_1.1.2.tar.gz +#cd ann_1.1.2/ +#make linux-g++ +#sudo cp lib/libANN.a /usr/local/lib/ +#sudo cp include/ANN/ANN.h /usr/local/include/ +## shellcheck disable=SC2103 +#cd .. +# +# +## Note: +# - FLANN is not mentioned in doc because it's only required for `make test` benchmarks +# - Leave it commented in code for future references +## Fast Library for Approximate Nearest Neighbors - development +## FLANN is a library for performing fast approximate nearest neighbor searches in high dimensional spaces. +## https://github.com/flann-lib/flann +#sudo apt-get update \ +# && sudo apt-get install --assume-yes \ +# libflann-dev \ +# && sudo rm -rf /var/lib/apt/lists/* + +cd "${NBS_LIB_INSTALL_PATH}" +git clone https://github.com/ethz-asl/libnabo.git && + cd libnabo && + mkdir build && cd build + +# git checkout 1.0.7 + + +teamcity_service_msg_compilationStarted "cmake" + +## (Priority) inprogress: investigate?? (ref task NMO-402 fix: unstable compilation issue) +## ToDo: Add mention about 'CMAKE_INSTALL_PREFIX' in the doc install step as a fix +#cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo \ +# -D CMAKE_INSTALL_PREFIX=${NBS_LIB_INSTALL_PATH} \ +# "${NBS_LIB_INSTALL_PATH}/libnabo" && +# make -j $(nproc) && +# make test && +# sudo make install + + +cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo ${LIBNABO_CMAKE_INSTALL_PREFIX[@]} \ + "${NBS_LIB_INSTALL_PATH}/libnabo" && + make -j $(nproc) && + sudo make install + +# (NICE TO HAVE) ToDo: refactor (ref task NMO-428 refactor: drop libnabo `make test` step after libnabo-build-system deployment) +# make test && + +teamcity_service_msg_compilationFinished + +teamcity_service_msg_blockClosed + +echo " " && print_msg_done "Libpointmatcher dependencies installed" +print_formated_script_footer "lpm_install_dependencies_libnabo_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" + +# ====Teardown===================================================================================== +cd "${TMP_CWD}" diff --git a/build_system/ubuntu/lpm_install_dependencies_ubuntu.bash b/build_system/ubuntu/lpm_install_dependencies_ubuntu.bash deleted file mode 100644 index b2f62d66..00000000 --- a/build_system/ubuntu/lpm_install_dependencies_ubuntu.bash +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/bash -i -# -# Libpointmatcher dependencies installer -# -# Usage: -# $ bash lpm_install_dependencies_ubuntu.bash -# -set -e # Note: we want the installer to always fail-fast (it wont affect the build system policy) - -# ....Project root logic........................................................................................... -TMP_CWD=$(pwd) - -if [[ "$(basename $(pwd))" != "build_system" ]]; then - cd ../ -fi - -# ....Load environment variables from file......................................................................... -set -o allexport -source ./.env -source ./.env.prompt -set +o allexport - -# skip GUI dialog by setting everything to default -export DEBIAN_FRONTEND=noninteractive - -# ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library -source ./function_library/prompt_utilities.bash -source ./function_library/terminal_splash.bash -source ./function_library/general_utilities.bash - -# Set environment variable LPM_IMAGE_ARCHITECTURE -source ./lpm_utility_script/lpm_export_which_architecture.bash - -# ====Begin======================================================================================================== -SHOW_SPLASH_IDU="${SHOW_SPLASH_IDU:-true}" - -if [[ "${SHOW_SPLASH_IDU}" == 'true' ]]; then - norlab_splash "${LPM_SPLASH_NAME}" "https://github.com/${LPM_LIBPOINTMATCHER_SRC_DOMAIN}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" -fi - -print_formated_script_header "lpm_install_dependencies_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" - -# ................................................................................................................ -teamcity_service_msg_blockOpened "Install development utilities" - -sudo apt-get update && - sudo apt-get install --assume-yes \ - lsb-release \ - build-essential \ - ca-certificates \ - curl \ - wget \ - git \ - g++ \ - gcc \ - catch \ - make \ - cmake \ - cmake-gui && - sudo rm -rf /var/lib/apt/lists/* - -cmake --version - -teamcity_service_msg_blockClosed -# ................................................................................................................ - -if [[ ${IS_TEAMCITY_RUN} == true ]]; then - print_msg "The install script is run in teamCity >> the python install step was executed earlier in the Dockerfile.dependencies" -else - print_msg "The install script is executed in stand alone mode" - source ./ubuntu/lpm_install_python_dev_tools.bash -fi - -# ................................................................................................................ -teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Boost" -# https://www.boost.org/doc/libs/1_79_0/more/getting_started/unix-variants.html - -sudo apt-get update && - sudo apt-get install --assume-yes \ - libboost-all-dev && - sudo rm -rf /var/lib/apt/lists/* - -teamcity_service_msg_blockClosed -# ................................................................................................................ -teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Eigen" -# https://eigen.tuxfamily.org/index.php - -sudo apt-get update && - sudo apt-get install --assume-yes \ - libeigen3-dev && - sudo rm -rf /var/lib/apt/lists/* - -teamcity_service_msg_blockClosed -# ................................................................................................................ -teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Libnabo" -# https://github.com/ethz-asl/libnabo - -print_msg "Create required dir structure" -mkdir -p "${LPM_INSTALLED_LIBRARIES_PATH}" - -## Note: -# - ANN is not mentioned in doc because it's only required for `make test` benchmarks -# - Leave it commented in code for future references -## ANN is a library written in C++, which supports data structures and algorithms for both exact and approximate nearest neighbor searching in arbitrarily high dimensions. -## https://www.cs.umd.edu/~mount/ANN/ -#cd "${LPM_INSTALLED_LIBRARIES_PATH}" -#wget https://www.cs.umd.edu/~mount/ANN/Files/1.1.2/ann_1.1.2.tar.gz -#tar xzf ann_1.1.2.tar.gz -#cd ann_1.1.2/ -#make linux-g++ -#sudo cp lib/libANN.a /usr/local/lib/ -#sudo cp include/ANN/ANN.h /usr/local/include/ -## shellcheck disable=SC2103 -#cd .. -# -# -## Note: -# - FLANN is not mentioned in doc because it's only required for `make test` benchmarks -# - Leave it commented in code for future references -## Fast Library for Approximate Nearest Neighbors - development -## FLANN is a library for performing fast approximate nearest neighbor searches in high dimensional spaces. -## https://github.com/flann-lib/flann -#sudo apt-get update \ -# && sudo apt-get install --assume-yes \ -# libflann-dev \ -# && sudo rm -rf /var/lib/apt/lists/* - -cd "${LPM_INSTALLED_LIBRARIES_PATH}" -git clone https://github.com/ethz-asl/libnabo.git && - cd libnabo && - mkdir build && cd build - -# git checkout 1.0.7 - - -teamcity_service_msg_compilationStarted "cmake" - -cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo \ - -D CMAKE_INSTALL_PREFIX=${LPM_INSTALLED_LIBRARIES_PATH} \ - "${LPM_INSTALLED_LIBRARIES_PATH}/libnabo" && - make -j $(nproc) && - make test && - sudo make install - -teamcity_service_msg_compilationFinished - -teamcity_service_msg_blockClosed -# ................................................................................................................ -teamcity_service_msg_blockOpened "Install Libpointmatcher dev tools" - -sudo apt-get update && - sudo apt-get install --assume-yes \ - libyaml-cpp-dev && - sudo rm -rf /var/lib/apt/lists/* - -teamcity_service_msg_blockClosed - -echo " " && print_msg_done "Libpointmatcher dependencies installed" -print_formated_script_footer "lpm_install_dependencies_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" -# ====Teardown===================================================================================================== -cd "${TMP_CWD}" diff --git a/build_system/ubuntu/lpm_install_doc_dependencies_ubuntu.bash b/build_system/ubuntu/lpm_install_doc_dependencies_ubuntu.bash index 663dbede..dae8bf9f 100644 --- a/build_system/ubuntu/lpm_install_doc_dependencies_ubuntu.bash +++ b/build_system/ubuntu/lpm_install_doc_dependencies_ubuntu.bash @@ -7,7 +7,7 @@ # set -e # Note: we want the installer to always fail-fast (it wont affect the build system policy) -# ....Project root logic........................................................................................... +# ....Project root logic........................................................................... TMP_CWD=$(pwd) if [[ "$(basename $(pwd))" != "build_system" ]]; then @@ -15,7 +15,7 @@ if [[ "$(basename $(pwd))" != "build_system" ]]; then fi -# ....Load environment variables from file......................................................................... +# ....Load environment variables from file......................................................... set -o allexport source ./.env source ./.env.prompt @@ -24,26 +24,26 @@ set +o allexport ## skip GUI dialog by setting everything to default export DEBIAN_FRONTEND=noninteractive -# ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library +# ....Helper function.............................................................................. +# import shell functions from utilities library source ./function_library/prompt_utilities.bash source ./function_library/terminal_splash.bash source ./function_library/general_utilities.bash -## Set environment variable 'LPM_IMAGE_ARCHITECTURE' +## Set environment variable 'NBS_IMAGE_ARCHITECTURE' source ./lpm_utility_script/lpm_export_which_architecture.bash -# ====Begin======================================================================================================== +# ====Begin======================================================================================== SHOW_SPLASH_IDDU="${SHOW_SPLASH_IDDU:-true}" if [[ "${SHOW_SPLASH_IDDU}" == 'true' ]]; then - norlab_splash "${LPM_SPLASH_NAME}" "https://github.com/${LPM_LIBPOINTMATCHER_SRC_DOMAIN}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" + norlab_splash "${NBS_SPLASH_NAME}" "https://github.com/${NBS_REPOSITORY_DOMAIN}/${NBS_REPOSITORY_NAME}" fi -print_formated_script_header "lpm_install_doc_dependencies_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" +print_formated_script_header "lpm_install_doc_dependencies_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" -# ................................................................................................................ +# ................................................................................................. teamcity_service_msg_blockOpened "Install libpointmatcher documentation related dependencies" ## Package required when GENERATE_API_DOC flag is set to true @@ -57,7 +57,7 @@ sudo apt-get update && teamcity_service_msg_blockClosed echo " " && print_msg_done "Libpointmatcher documentation related dependencies installed" -print_formated_script_footer "lpm_install_doc_dependencies_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" -# ====Teardown===================================================================================================== +print_formated_script_footer "lpm_install_doc_dependencies_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" +# ====Teardown===================================================================================== cd "${TMP_CWD}" diff --git a/build_system/ubuntu/lpm_install_libpointmatcher_ubuntu.bash b/build_system/ubuntu/lpm_install_libpointmatcher_ubuntu.bash index cba0cf48..a039f70d 100644 --- a/build_system/ubuntu/lpm_install_libpointmatcher_ubuntu.bash +++ b/build_system/ubuntu/lpm_install_libpointmatcher_ubuntu.bash @@ -8,7 +8,7 @@ # Arguments: # [--install-path ] The directory where to install libpointmatcher (absolute path) # (default location defined in the .env) -# [--libpointmatcher-version v1.3.1] Install libpointmatcher release tag version (default to master branch head) +# [--repository-version v1.3.1] Install libpointmatcher release tag version (default to master branch latest) # [--compile-test] Compile the libpointmatcher unit-test # [--generate-doc] Generate the libpointmatcher doxygen documentation # in /usr/local/share/doc/libpointmatcher/api/html/index.html @@ -19,27 +19,34 @@ # (default to RelWithDebInfo) # [-h, --help] Get help # +# Global +# - Read OVERRIDE_NBS_CMAKE_INSTALL_PREFIX +# Usage: +# export OVERRIDE_NBS_CMAKE_INSTALL_PREFIX=( "-D CMAKE_INSTALL_PREFIX=/opt" ) \ +# && source lpm_install_libpointmatcher_ubuntu.bash +# # Note: # - this script required package: g++, make, cmake, build-essential, git and all libpointmatcher dependencies -# - execute `lpm_install_dependencies_ubuntu.bash` first +# - execute `lpm_install_dependencies_general_ubuntu.bash` first # set -e # Note: we want the installer to always fail-fast (it wont affect the build system policy) -# ....Default...................................................................................................... -LIBPOINTMATCHER_VERSION='head' +# ....Default...................................................................................... +REPOSITORY_VERSION='latest' BUILD_TESTS_FLAG=FALSE GENERATE_API_DOC_FLAG=FALSE BUILD_SYSTEM_CI_INSTALL=FALSE CMAKE_BUILD_TYPE=RelWithDebInfo -# ....Project root logic........................................................................................... + +# ....Project root logic........................................................................... TMP_CWD=$(pwd) if [[ "$(basename $(pwd))" != "build_system" ]]; then cd ../ fi -# ....Load environment variables from file......................................................................... +# ....Load environment variables from file......................................................... set -o allexport source ./.env source ./.env.prompt @@ -48,26 +55,26 @@ set +o allexport ## skip GUI dialog by setting everything to default export DEBIAN_FRONTEND=noninteractive -# ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library +# ....Helper function.............................................................................. +## import shell functions from norlab-build-system utilities library source ./function_library/prompt_utilities.bash source ./function_library/terminal_splash.bash source ./function_library/general_utilities.bash -## Set environment variable LPM_IMAGE_ARCHITECTURE +## Set environment variable NBS_IMAGE_ARCHITECTURE source ./lpm_utility_script/lpm_export_which_architecture.bash function print_help_in_terminal() { echo -e "\$ ${0} [] \033[1m:\033[0m - --install-path The directory where to install libpointmatcher (absolute path) - (default location ${MSG_DIMMED_FORMAT}${LPM_INSTALLED_LIBRARIES_PATH:?'err LPM_INSTALLED_LIBRARIES_PATH env variable was not fetched from the .env'}${MSG_END_FORMAT}) - --libpointmatcher-version v1.3.1 Install libpointmatcher release tag version (default to master branch head) - --compile-test Compile the libpointmatcher unit-test - in ${MSG_DIMMED_FORMAT}${LPM_INSTALLED_LIBRARIES_PATH}/libpointmatcher/build${MSG_END_FORMAT} + --install-path The directory where to install (absolute path) + (default location ${MSG_DIMMED_FORMAT}${NBS_LIB_INSTALL_PATH:?'err NBS_LIB_INSTALL_PATH env variable was not fetched from the .env'}${MSG_END_FORMAT}) + --repository-version v1.3.1 Install release tag version (default to master branch latest) + --compile-test Compile the unit-test + in ${MSG_DIMMED_FORMAT}${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build${MSG_END_FORMAT} --generate-doc Generate the libpointmatcher doxygen documentation - in ${MSG_DIMMED_FORMAT}/usr/local/share/doc/libpointmatcher/api/html/index.html${MSG_END_FORMAT} + in ${MSG_DIMMED_FORMAT}/usr/local/share/doc/${NBS_REPOSITORY_NAME}/api/html/index.html${MSG_END_FORMAT} --build-system-CI-install Set special configuration for CI/CD build system: skip the git clone install step and assume the repository is already pulled and checkout on the desired branch @@ -77,30 +84,30 @@ function print_help_in_terminal() { " } -# ====Begin======================================================================================================== +# ====Begin======================================================================================== SHOW_SPLASH_ILU="${SHOW_SPLASH_ILU:-true}" if [[ "${SHOW_SPLASH_ILU}" == 'true' ]]; then - norlab_splash "${LPM_SPLASH_NAME}" "https://github.com/${LPM_LIBPOINTMATCHER_SRC_DOMAIN}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" + norlab_splash "${NBS_SPLASH_NAME}" "https://github.com/${NBS_REPOSITORY_DOMAIN}/${NBS_REPOSITORY_NAME}" fi -print_formated_script_header "lpm_install_libpointmatcher_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" +print_formated_script_header "lpm_install_libpointmatcher_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" -# ....Script command line flags.................................................................................... +# ....Script command line flags.................................................................... while [ $# -gt 0 ]; do case $1 in --install-path) - unset LPM_INSTALLED_LIBRARIES_PATH - LPM_INSTALLED_LIBRARIES_PATH="${2}" + unset NBS_LIB_INSTALL_PATH + NBS_LIB_INSTALL_PATH="${2}" shift # Remove argument (--install-path) shift # Remove argument value ;; - --libpointmatcher-version) - LIBPOINTMATCHER_VERSION="${2}" - shift # Remove argument (--libpointmatcher-version) + --repository-version) + REPOSITORY_VERSION="${2}" + shift # Remove argument (--repository-version) shift # Remove argument value ;; --cmake-build-type) @@ -139,51 +146,59 @@ while [ $# -gt 0 ]; do done -# ................................................................................................................ -teamcity_service_msg_blockOpened "Install Libpointmatcher" -# https://github.com/ethz-asl/libpointmatcher/tree/master -print_msg "Directories (pre libpointmatcher install)$(tree -L 2 ${LPM_INSTALLED_LIBRARIES_PATH})" +# ....Override..................................................................................... +declare -a DEFAULT_CMAKE_INSTALL_PREFIX=( "-D CMAKE_INSTALL_PREFIX=${NBS_LIB_INSTALL_PATH:?err}" ) +declare -a OVERRIDE_NBS_CMAKE_INSTALL_PREFIX +declare -a NBS_CMAKE_INSTALL_PREFIX=( "${OVERRIDE_NBS_CMAKE_INSTALL_PREFIX[@]:-${DEFAULT_CMAKE_INSTALL_PREFIX[@]}}" ) + + +# ................................................................................................. +teamcity_service_msg_blockOpened "Install ${NBS_REPOSITORY_NAME}" + +print_msg "Directories (pre libpointmatcher install)$(tree -L 2 ${NBS_LIB_INSTALL_PATH})" -mkdir -p "${LPM_INSTALLED_LIBRARIES_PATH}" -cd "${LPM_INSTALLED_LIBRARIES_PATH}" +mkdir -p "${NBS_LIB_INSTALL_PATH}" +cd "${NBS_LIB_INSTALL_PATH}" if [[ ${BUILD_SYSTEM_CI_INSTALL} == FALSE ]]; then - if [[ -d ${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}/pointmatcher ]]; then - print_msg_error_and_exit "${MSG_DIMMED_FORMAT}${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}${MSG_END_FORMAT} source code was already checkout in the specified install directory ${MSG_DIMMED_FORMAT}${LPM_INSTALLED_LIBRARIES_PATH}/${MSG_END_FORMAT}, specify an other one using ${MSG_DIMMED_FORMAT}--install-path ${MSG_END_FORMAT}." + if [[ -d ${NBS_REPOSITORY_NAME}/.git ]]; then + print_msg_error_and_exit "${MSG_DIMMED_FORMAT}${NBS_REPOSITORY_NAME}${MSG_END_FORMAT} source code was already checkout in the specified install directory ${MSG_DIMMED_FORMAT}${NBS_LIB_INSTALL_PATH}/${MSG_END_FORMAT}, specify an other one using ${MSG_DIMMED_FORMAT}--install-path ${MSG_END_FORMAT}." fi - git clone https://github.com/"${LPM_LIBPOINTMATCHER_SRC_DOMAIN}"/"${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}".git + git clone https://github.com/"${NBS_REPOSITORY_DOMAIN}"/"${NBS_REPOSITORY_NAME}".git - if [[ "${LIBPOINTMATCHER_VERSION}" != 'head' ]]; then - cd "${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}"/ + if [[ "${REPOSITORY_VERSION}" != 'latest' ]]; then + cd "${NBS_REPOSITORY_NAME}"/ git fetch --tags git tag --list # Remove prefix 'v' from version tag - GITHUB_TAG="${LIBPOINTMATCHER_VERSION/v/}" + GITHUB_TAG="${REPOSITORY_VERSION/v/}" print_msg "GITHUB_TAG=${GITHUB_TAG}" git checkout tags/"${GITHUB_TAG}" fi fi -cd "${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}"/ +cd "${NBS_REPOSITORY_NAME}"/ mkdir -p build && cd build teamcity_service_msg_compilationStarted "cmake" # (CRITICAL) ToDo: validate >> GENERATE_API_DOC install dir - - cmake -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ -D BUILD_TESTS=${BUILD_TESTS_FLAG} \ -D GENERATE_API_DOC=${GENERATE_API_DOC_FLAG} \ - -D LIBNABO_INSTALL_DIR="${LPM_INSTALLED_LIBRARIES_PATH}/libnabo" \ - -D CMAKE_INSTALL_PREFIX="${LPM_INSTALLED_LIBRARIES_PATH}" \ - "${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}" + "${NBS_CMAKE_INSTALL_PREFIX[@]}" \ + "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" + +# Note: +# - Previously use intall flag quick-hack to work around the install issue. +# - Keep it here as futur reference +# -D LIBNABO_INSTALL_DIR="${NBS_LIB_INSTALL_PATH}/libnabo" \ BUILD_EXIT_CODE=$? @@ -196,13 +211,13 @@ INSTALL_EXIT_CODE=$? ### ref: https://stackoverflow.com/questions/16851084/how-to-list-all-cmake-build-options-and-their-default-values #cmake -LAH -print_msg "Directories (post libpointmatcher install)$(tree -L 2 ${LPM_INSTALLED_LIBRARIES_PATH})" +print_msg "Directories (post ${NBS_REPOSITORY_NAME} install)$(tree -L 2 ${NBS_LIB_INSTALL_PATH})" teamcity_service_msg_compilationFinished teamcity_service_msg_blockClosed -SUCCESS_MSG="Libpointmatcher installed successfully at ${MSG_DIMMED_FORMAT}${LPM_INSTALLED_LIBRARIES_PATH}/${LPM_LIBPOINTMATCHER_SRC_REPO_NAME}${MSG_END_FORMAT}" -FAILURE_MSG="Libpointmatcher installer exited with error" +SUCCESS_MSG="${NBS_REPOSITORY_NAME} installed successfully at ${MSG_DIMMED_FORMAT}${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}${MSG_END_FORMAT}" +FAILURE_MSG="${NBS_REPOSITORY_NAME} installer exited with error" if [[ ${IS_TEAMCITY_RUN} == true ]]; then # Report message to build log @@ -211,11 +226,11 @@ if [[ ${IS_TEAMCITY_RUN} == true ]]; then else if [[ ${BUILD_EXIT_CODE} != 0 ]]; then echo -e "##teamcity[message text='${MSG_BASE_TEAMCITY} ${FAILURE_MSG}' errorDetails='$BUILD_EXIT_CODE' status='ERROR']" - print_formated_script_footer "lpm_install_libpointmatcher_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" + print_formated_script_footer "lpm_install_libpointmatcher_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" exit $BUILD_EXIT_CODE else echo -e "##teamcity[message text='${MSG_BASE_TEAMCITY} ${FAILURE_MSG}' errorDetails='$INSTALL_EXIT_CODE' status='ERROR']" - print_formated_script_footer "lpm_install_libpointmatcher_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" + print_formated_script_footer "lpm_install_libpointmatcher_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" exit $INSTALL_EXIT_CODE fi fi @@ -224,7 +239,7 @@ else echo " " && print_msg_done "${SUCCESS_MSG}" else print_msg_error "${FAILURE_MSG}" - print_formated_script_footer "lpm_install_libpointmatcher_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" + print_formated_script_footer "lpm_install_libpointmatcher_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" if [[ ${BUILD_EXIT_CODE} != 0 ]]; then exit $BUILD_EXIT_CODE else @@ -233,6 +248,7 @@ else fi fi -print_formated_script_footer "lpm_install_libpointmatcher_ubuntu.bash (${LPM_IMAGE_ARCHITECTURE})" "${LPM_LINE_CHAR_INSTALLER}" -# ====Teardown===================================================================================================== +print_formated_script_footer "lpm_install_libpointmatcher_ubuntu.bash (${NBS_IMAGE_ARCHITECTURE})" "${NBS_LINE_CHAR_INSTALLER}" + +# ====Teardown===================================================================================== cd "${TMP_CWD}" diff --git a/build_system/ubuntu/lpm_install_python_dev_tools.bash b/build_system/ubuntu/lpm_install_python_dev_tools.bash index cf663321..3d5de719 100644 --- a/build_system/ubuntu/lpm_install_python_dev_tools.bash +++ b/build_system/ubuntu/lpm_install_python_dev_tools.bash @@ -15,7 +15,7 @@ if [[ "$(basename $(pwd))" != "build_system" ]]; then fi # ....Helper function.............................................................................................. -## import shell functions from Libpointmatcher-build-system utilities library +# import shell functions from utilities library source ./function_library/prompt_utilities.bash source ./function_library/general_utilities.bash diff --git a/build_system/version.norlab_build_system.txt b/build_system/version.norlab_build_system.txt new file mode 100644 index 00000000..6e8bf73a --- /dev/null +++ b/build_system/version.norlab_build_system.txt @@ -0,0 +1 @@ +0.1.0