# If don't know how gitlab-ci is working, please refer to the official documentation # see https://docs.gitlab.com/ee/ci/quick_start/ # If you need information about some keyword, please refer to the official documentation # see https://docs.gitlab.com/ee/ci/yaml/ # If you need to modify or understand this CI script don't hesitate to use gitlab ci-lint tool # see https://gitlab.kitware.com/LidarView/lidarview-core/-/ci/lint variables: GIT_SUBMODULE_STRATEGY: recursive # see https://docs.gitlab.com/ee/ci/git_submodules.html#using-git-submodules-in-your-ci-jobs GIT_LFS_SKIP_SMUDGE: 1 # do not doawnload test data, see https://github.com/git-lfs/git-lfs/blob/master/docs/man/git-lfs-config.5.ronn#other-settings # user defined variable rel_path_to_lidarview_build_dir: lidarview-superbuild/common-superbuild/lidarview/build/ # - gitlab only evaluate variable at depth 1, so it's not possible to reuse # superbuild_build_dir to construct lidarview_build_dir # see https://gitlab.com/gitlab-org/gitlab-runner/issues/1280 superbuild_build_dir: $CI_BUILDS_DIR/SB/$SB_BUILD_PREFIX/$CI_PROJECT_NAME lidarview_build_dir: $CI_BUILDS_DIR/SB/$SB_BUILD_PREFIX/$CI_PROJECT_NAME/$rel_path_to_lidarview_build_dir # This variable should set only if the script is trigger from a LidarView submodule # This will enable to run the pipeline with the updated module TRIGGER_MODULE_PATH: '' # path of the module that trigger the pipeline relative to LidarView TRIGGER_MODULE_SHA: '' # commit sha of the module that trigger the pipeline SB_BUILD_PREFIX: '' # use a unique value to have a custom SB dir for some branches and not rely on the generic one # this may be usefull, when you make changes to the superbuild, and want to check # that this change pass the CI pipeline, but in the mean time you don't want to # replace the common on. stages: - superbuild - configure - build - test - package # default parameters for all jobs, see https://docs.gitlab.com/ee/ci/yaml/#setting-default-parameters default: before_script: &default_before_script_anchor # TRIGGER_MODULE_PATH and TRIGGER_MODULE_SHA, should be empty if the CI is triggered from LidarView # so the next fetching and checkout will basically do nothing. # "$git checkout " is a glorified no-op (no operation), see https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt-emgitcheckoutemltbranchgt - cd $CI_PROJECT_DIR/$TRIGGER_MODULE_PATH - git fetch --all - git checkout $TRIGGER_MODULE_SHA retry: max: 2 when: runner_system_failure interruptible: true # create a pipeline only in some cases : merge_request, tag, master branch # see https://docs.gitlab.com/ee/ci/yaml/#workflowrules workflow: rules: - if: $CI_MERGE_REQUEST_ID - if: $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH == "master" # job starting with a . are not run, see https://docs.gitlab.com/ee/ci/yaml/#hidden-keys-jobs # but they can be used as: # - anchor., which is yalm specific. # see https://docs.gitlab.com/ee/ci/yaml/#anchors # - base job class (via the extends keyword), which is gitlab specific. # See https://docs.gitlab.com/ee/ci/yaml/#extends .default_rules: rules: # Add option to disable the CI pipeline for a givent os. # To do so you must define some variable in the project CI settings, see https://docs.gitlab.com/ee/ci/variables/#via-the-ui # - DISABLE_OSX for osx # - DISABLE_WINDOWS for windows # - DISABLE_LINUX for linux - if: $DISABLE_OSX && $CI_JOB_NAME =~ /^osx*/ when: never - if: $DISABLE_WINDOWS && $CI_JOB_NAME =~ /^windows*/ when: never - if: $DISABLE_LINUX && $CI_JOB_NAME =~ /^linux*/ when: never # define the manual job - if: $CI_JOB_STAGE == "superbuild" || $CI_JOB_STAGE == "package" when: manual # need to allow_failure as otherwise, this manual jobs will caused the pipeline status to be marked as "Blocked" # see https://gitlab.com/gitlab-org/gitlab/-/issues/27095 allow_failure: true - when: on_success .superbuild: stage: superbuild timeout: 5h extends: .default_rules script: - cmake -E remove_directory $superbuild_build_dir - cmake -E make_directory $superbuild_build_dir - cd $superbuild_build_dir - > # must use | instead of > for multiline string here as some variable may be empty, otherwise gitlab doesn't manage to parse it correclty cmake -DCMAKE_BUILD_TYPE=Release $sb_cmake_option_GENERATOR $sb_cmake_option_USE_SYSTEM_qt5 $sb_cmake_option_QT5_DIR $sb_cmake_option_CMAKE_OSX_ARCHITECTURES $sb_cmake_option_CMAKE_OSX_DEPLOYMENT_TARGET $sb_cmake_option_CMAKE_OSX_SDK -DBUILD_TESTING=ON -Dsuperbuild_download_location="../downloads" $CI_PROJECT_DIR/Superbuild - cmake --build . --parallel 8 .configure: stage: configure extends: .default_rules script: - cd $lidarview_build_dir # create a compilation database for the analize stage (clang-tidy) - cmake -DBUILD_TESTING=True -DCMAKE_EXPORT_COMPILE_COMMANDS=True . .build: stage: build extends: .default_rules script: - cd $lidarview_build_dir - cmake --build . --target install --parallel 8 .test: variables: GIT_LFS_SKIP_SMUDGE: 0 # download the test data DISPLAY: ":0" # Enable UI Capabilities, may not interfere too much on win32 stage: test extends: .default_rules script: - cd $lidarview_build_dir # in some occasion, the machine on which the runner run can be under heavily load # this may caused some failure (ex: Stream tests), so rerun the failing test - ctest --repeat until-pass:3 .package: stage: package extends: .default_rules needs: [] script: - git fetch --tags # GIT_STRATEGY doesn't clone tags, see https://gitlab.com/gitlab-org/gitlab-runner/issues/11737 - git fetch --depth=10000 --tags # despite GIT_STRATEGY and git fetch --tags, git describe fail - git describe - cd $lidarview_build_dir - cmake -DBUILD_TESTING=False . - cd $superbuild_build_dir - cmake --build . --parallel 8 # rely on paraview superbuild packaging system # the packaging is launched via a test - ctest artifacts: name: $CI_JOB_NAME paths: - ./*.dmg - ./*.zip - ./*.exe - ./*.tar.gz - ./*.tar.xz expire_in: 1 day ######################## # System configuration # ######################## # Need to know: # - On powershell it's not possible to use $CI_BUILDS_DIR in GIT_CLONE_PATH # due to some incoherence with / and \\ in gitlab. So you need to garanty # manually that GIT_CLONE_PATH is inside the build_dir specify in the # runner configuration file (congif.toml) .linux_runner_config: tags: [unix] resource_group: linux_machine .osx_runner_config: variables: sb_cmake_option_CMAKE_OSX_ARCHITECTURES: -DCMAKE_OSX_ARCHITECTURES=x86_64 sb_cmake_option_CMAKE_OSX_DEPLOYMENT_TARGET: -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 sb_cmake_option_CMAKE_OSX_SDK: -DCMAKE_OSX_SDK=macosx10.12 sb_cmake_option_USE_SYSTEM_qt5: -DUSE_SYSTEM_qt5=True sb_cmake_option_QT5_DIR: -DQt5_DIR=/Users/veloviewci/Dev/Qt5.10.1/5.10.1/clang_64/lib/cmake/Qt5 tags: [osx] resource_group: osx_machine .windows_runner_config: before_script: - *default_before_script_anchor # to use the Microsoft C++ Toolset from the command line, some environment variable need to be set # To help with this, Microsoft provide the vcvarsall.bat script that set different environment see # https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=vs-2019 # However the script is made for the command shell and the job run in a powershell. # A powershell can run a command shell script by using the `cmd` executable, but this imply # that environment variable are only set in the child cmd.exe instance. The environment variables need to # be update in the powershell too. This is why the function Invoke-CmdScript is needed as it invokes # the script and update the powershell environment. # This is taken from https://stackoverflow.com/a/41399983 - | # pipe allow to use multiline command, see https://gitlab.com/gitlab-org/gitlab-runner/issues/166 function Invoke-CmdScript { param( [String] $scriptName ) $cmdLine = """$scriptName"" $args & set" & $Env:SystemRoot\system32\cmd.exe /c $cmdLine | Select-String '^([^=]*)=(.*)$' | ForEach-Object { $varName = $_.Matches[0].Groups[1].Value $varValue = $_.Matches[0].Groups[2].Value Set-Item Env:$varName $varValue } } - Invoke-CmdScript "${vcvarsall_script_location}/vcvarsall.bat" $architecture variables: # on windows due to the max command length, superbuild and project directory names should be short # this is why PROJECT_ID is used instead of PROJECT_NAME # Gitlab doesn't handle well all path notation on windows and force the clone path to start with C:\\ GIT_CLONE_PATH: C:\\S/$CI_PROJECT_ID superbuild_build_dir: C:/SB/$SB_BUILD_PREFIX/$CI_PROJECT_ID lidarview_build_dir: C:/SB/$SB_BUILD_PREFIX/$CI_PROJECT_ID/$rel_path_to_lidarview_build_dir vcvarsall_script_location: 'C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC' architecture: x86_amd64 sb_cmake_option_GENERATOR: -GNinja sb_cmake_option_USE_SYSTEM_qt5: -DUSE_SYSTEM_qt5=True sb_cmake_option_QT5_DIR: -DQt5_DIR="C:/Qt/Qt5.10.1/5.10.1/msvc2015_64/lib/cmake/Qt5" tags: [windows] resource_group: windows_machine ############## # Superbuild # ############## linux_superbuild: extends: - .linux_runner_config - .superbuild osx_superbuild: extends: - .osx_runner_config - .superbuild windows_superbuild: extends: - .windows_runner_config - .superbuild ############## # Analize # ############## linux_configure: extends: - .linux_runner_config - .configure osx_configure: extends: - .osx_runner_config - .configure windows_configure: extends: - .windows_runner_config - .configure ############## # Build # ############## linux_build: extends: - .linux_runner_config - .build needs: [linux_configure] osx_build: extends: - .osx_runner_config - .build needs: [osx_configure] windows_build: extends: - .windows_runner_config - .build needs: [windows_configure] ############## # Test # ############## linux_test: extends: - .linux_runner_config - .test needs: [linux_build] osx_test: extends: - .osx_runner_config - .test needs: [osx_build] windows_test: extends: - .windows_runner_config - .test needs: [windows_build] ############## # Package # ############## # Need to know: # - Artefact path must be inside CI_PROJECT_DIR # see https://docs.gitlab.com/ee/ci/yaml/README.html#artifactspaths linux_package: extends: - .linux_runner_config - .package after_script: - mv $superbuild_build_dir/*.tar.gz $CI_PROJECT_DIR - mv $superbuild_build_dir/*.tar.xz $CI_PROJECT_DIR osx_package: extends: - .osx_runner_config - .package after_script: - mv -f $superbuild_build_dir/*.dmg $CI_PROJECT_DIR windows_package: extends: - .windows_runner_config - .package after_script: - mv $superbuild_build_dir/*.exe $CI_PROJECT_DIR - mv $superbuild_build_dir/*.zip $CI_PROJECT_DIR