From ac37e99453f21b57fcd09cc037a7925a7bc017f3 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Wed, 2 Mar 2022 08:56:33 -0500 Subject: ci: Rename variable CMake_SKIP_INSTALL to CMAKE_CI_NO_INSTALL The latter follows our convention for other variable names. --- .gitlab/ci/ctest_build.cmake | 2 +- .gitlab/os-linux.yml | 8 ++++---- .gitlab/os-macos.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab/ci/ctest_build.cmake b/.gitlab/ci/ctest_build.cmake index e7a0985..4bb2924 100644 --- a/.gitlab/ci/ctest_build.cmake +++ b/.gitlab/ci/ctest_build.cmake @@ -37,7 +37,7 @@ if ("$ENV{CTEST_NO_WARNINGS_ALLOWED}" AND num_warnings GREATER 0) "Found ${num_warnings} warnings (treating as fatal).") endif () -if (NOT "$ENV{CMake_SKIP_INSTALL}") +if (NOT "$ENV{CMAKE_CI_NO_INSTALL}") ctest_build(APPEND TARGET install RETURN_VALUE install_result) diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index f53f6f9..07aa624 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -57,7 +57,7 @@ variables: CMAKE_CONFIGURATION: debian10_iwyu CTEST_NO_WARNINGS_ALLOWED: 1 - CMake_SKIP_INSTALL: 1 + CMAKE_CI_NO_INSTALL: 1 .debian10_aarch64: image: "kitware/cmake:ci-debian10-aarch64-2022-02-21" @@ -83,7 +83,7 @@ variables: CMAKE_CONFIGURATION: fedora35_tidy CTEST_NO_WARNINGS_ALLOWED: 1 - CMake_SKIP_INSTALL: 1 + CMAKE_CI_NO_INSTALL: 1 .fedora35_clang_analyzer: extends: .fedora35 @@ -92,7 +92,7 @@ CMAKE_CONFIGURATION: fedora35_clang_analyzer CMAKE_CI_BUILD_TYPE: Debug CTEST_NO_WARNINGS_ALLOWED: 1 - CMake_SKIP_INSTALL: 1 + CMAKE_CI_NO_INSTALL: 1 .fedora35_sphinx: extends: .fedora35 @@ -101,7 +101,7 @@ CMAKE_CONFIGURATION: fedora35_sphinx CTEST_NO_WARNINGS_ALLOWED: 1 CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx" - CMake_SKIP_INSTALL: 1 + CMAKE_CI_NO_INSTALL: 1 .fedora35_sphinx_package: extends: .fedora35 diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index b0844cb..79e2e25 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -52,7 +52,7 @@ variables: CMAKE_CONFIGURATION: macos_package CTEST_NO_WARNINGS_ALLOWED: 1 - CMake_SKIP_INSTALL: 1 + CMAKE_CI_NO_INSTALL: 1 .macos10.10_package: extends: .macos_build @@ -60,7 +60,7 @@ variables: CMAKE_CONFIGURATION: macos10.10_package CTEST_NO_WARNINGS_ALLOWED: 1 - CMake_SKIP_INSTALL: 1 + CMAKE_CI_NO_INSTALL: 1 ### External testing -- cgit v0.12 From 1613d87dee2a6779a5c4b70bd1b06019e77e469d Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Wed, 2 Mar 2022 09:29:13 -0500 Subject: ci: Rename ctest_test_external.cmake to ctest_standalone.cmake The script is a standalone ctest script that runs all steps. It can be used for more than just external tests. --- .gitlab/ci/ctest_standalone.cmake | 89 ++++++++++++++++++++++++++++++++++++ .gitlab/ci/ctest_test_external.cmake | 89 ------------------------------------ .gitlab/os-linux.yml | 4 +- .gitlab/os-macos.yml | 2 +- .gitlab/os-windows.yml | 14 +++--- 5 files changed, 99 insertions(+), 99 deletions(-) create mode 100644 .gitlab/ci/ctest_standalone.cmake delete mode 100644 .gitlab/ci/ctest_test_external.cmake diff --git a/.gitlab/ci/ctest_standalone.cmake b/.gitlab/ci/ctest_standalone.cmake new file mode 100644 index 0000000..48e910b --- /dev/null +++ b/.gitlab/ci/ctest_standalone.cmake @@ -0,0 +1,89 @@ +cmake_minimum_required(VERSION 3.8) + +include("${CMAKE_CURRENT_LIST_DIR}/gitlab_ci.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/env_$ENV{CMAKE_CONFIGURATION}.cmake" OPTIONAL) + +set(cmake_args + -C "${CMAKE_CURRENT_LIST_DIR}/configure_$ENV{CMAKE_CONFIGURATION}.cmake") + +# Create an entry in CDash. +ctest_start("${ctest_model}" GROUP "${ctest_group}") + +# Gather update information. +find_package(Git) +set(CTEST_UPDATE_VERSION_ONLY ON) +set(CTEST_UPDATE_COMMAND "${GIT_EXECUTABLE}") +ctest_update() + +# Configure the project. +ctest_configure( + OPTIONS "${cmake_args}" + RETURN_VALUE configure_result) + +# Read the files from the build directory. +ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}") + +# We can now submit because we've configured. This is a cmb-superbuild-ism. +ctest_submit(PARTS Update) +ctest_submit(PARTS Configure) + +if (configure_result) + ctest_submit(PARTS Done) + message(FATAL_ERROR + "Failed to configure") +endif () + +include(ProcessorCount) +ProcessorCount(nproc) +if (NOT "$ENV{CTEST_MAX_PARALLELISM}" STREQUAL "") + if (nproc GREATER "$ENV{CTEST_MAX_PARALLELISM}") + set(nproc "$ENV{CTEST_MAX_PARALLELISM}") + endif () +endif () + +if (CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles") + set(CTEST_BUILD_FLAGS "-j${nproc} -l${nproc}") +elseif (CTEST_CMAKE_GENERATOR MATCHES "Ninja") + set(CTEST_BUILD_FLAGS "-l${nproc}") +endif () + +ctest_build( + NUMBER_WARNINGS num_warnings + RETURN_VALUE build_result) +ctest_submit(PARTS Build) + +if (build_result) + ctest_submit(PARTS Done) + message(FATAL_ERROR + "Failed to build") +endif () + +if ("$ENV{CTEST_NO_WARNINGS_ALLOWED}" AND num_warnings GREATER 0) + ctest_submit(PARTS Done) + message(FATAL_ERROR + "Found ${num_warnings} warnings (treating as fatal).") +endif () + +set(ctest_label_args) +if (NOT "$ENV{CTEST_LABELS}" STREQUAL "") + list(APPEND ctest_label_args + INCLUDE_LABEL "$ENV{CTEST_LABELS}") +endif () + +include("${CMAKE_CURRENT_LIST_DIR}/ctest_exclusions.cmake") +ctest_test( + PARALLEL_LEVEL "${nproc}" + TEST_LOAD "${nproc}" + OUTPUT_JUNIT "${CTEST_BINARY_DIRECTORY}/junit.xml" + RETURN_VALUE test_result + ${ctest_label_args} + EXCLUDE "${test_exclusions}") +ctest_submit(PARTS Test) + +if (test_result) + ctest_submit(PARTS Done) + message(FATAL_ERROR + "Failed to test") +endif () + +ctest_submit(PARTS Done) diff --git a/.gitlab/ci/ctest_test_external.cmake b/.gitlab/ci/ctest_test_external.cmake deleted file mode 100644 index 48e910b..0000000 --- a/.gitlab/ci/ctest_test_external.cmake +++ /dev/null @@ -1,89 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -include("${CMAKE_CURRENT_LIST_DIR}/gitlab_ci.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/env_$ENV{CMAKE_CONFIGURATION}.cmake" OPTIONAL) - -set(cmake_args - -C "${CMAKE_CURRENT_LIST_DIR}/configure_$ENV{CMAKE_CONFIGURATION}.cmake") - -# Create an entry in CDash. -ctest_start("${ctest_model}" GROUP "${ctest_group}") - -# Gather update information. -find_package(Git) -set(CTEST_UPDATE_VERSION_ONLY ON) -set(CTEST_UPDATE_COMMAND "${GIT_EXECUTABLE}") -ctest_update() - -# Configure the project. -ctest_configure( - OPTIONS "${cmake_args}" - RETURN_VALUE configure_result) - -# Read the files from the build directory. -ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}") - -# We can now submit because we've configured. This is a cmb-superbuild-ism. -ctest_submit(PARTS Update) -ctest_submit(PARTS Configure) - -if (configure_result) - ctest_submit(PARTS Done) - message(FATAL_ERROR - "Failed to configure") -endif () - -include(ProcessorCount) -ProcessorCount(nproc) -if (NOT "$ENV{CTEST_MAX_PARALLELISM}" STREQUAL "") - if (nproc GREATER "$ENV{CTEST_MAX_PARALLELISM}") - set(nproc "$ENV{CTEST_MAX_PARALLELISM}") - endif () -endif () - -if (CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles") - set(CTEST_BUILD_FLAGS "-j${nproc} -l${nproc}") -elseif (CTEST_CMAKE_GENERATOR MATCHES "Ninja") - set(CTEST_BUILD_FLAGS "-l${nproc}") -endif () - -ctest_build( - NUMBER_WARNINGS num_warnings - RETURN_VALUE build_result) -ctest_submit(PARTS Build) - -if (build_result) - ctest_submit(PARTS Done) - message(FATAL_ERROR - "Failed to build") -endif () - -if ("$ENV{CTEST_NO_WARNINGS_ALLOWED}" AND num_warnings GREATER 0) - ctest_submit(PARTS Done) - message(FATAL_ERROR - "Found ${num_warnings} warnings (treating as fatal).") -endif () - -set(ctest_label_args) -if (NOT "$ENV{CTEST_LABELS}" STREQUAL "") - list(APPEND ctest_label_args - INCLUDE_LABEL "$ENV{CTEST_LABELS}") -endif () - -include("${CMAKE_CURRENT_LIST_DIR}/ctest_exclusions.cmake") -ctest_test( - PARALLEL_LEVEL "${nproc}" - TEST_LOAD "${nproc}" - OUTPUT_JUNIT "${CTEST_BINARY_DIRECTORY}/junit.xml" - RETURN_VALUE test_result - ${ctest_label_args} - EXCLUDE "${test_exclusions}") -ctest_submit(PARTS Test) - -if (test_result) - ctest_submit(PARTS Done) - message(FATAL_ERROR - "Failed to test") -endif () - -ctest_submit(PARTS Done) diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 07aa624..482ca7d 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -440,7 +440,7 @@ - .gitlab/ci/sccache.sh - sccache --start-server - sccache --show-stats - - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake" + - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake" - sccache --show-stats interruptible: true @@ -453,7 +453,7 @@ - .gitlab/ci/sccache.sh - sccache --start-server - sccache --show-stats - - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake" + - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake" - sccache --show-stats interruptible: true diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 79e2e25..e89dba8 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -182,7 +182,7 @@ # Allow the server to already be running. - "sccache --start-server || :" - sccache --show-stats - - "$LAUNCHER build/install/CMake.app/Contents/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake" + - "$LAUNCHER build/install/CMake.app/Contents/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake" - sccache --show-stats interruptible: true diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index d01c828..411baa5 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -250,7 +250,7 @@ stage: test-ext script: - - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake + - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake interruptible: true @@ -259,7 +259,7 @@ script: - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1 - - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake + - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake interruptible: true @@ -271,7 +271,7 @@ - $pwdpath = $pwd.Path - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\jom;$env:PATH" - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1 - - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake + - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake interruptible: true @@ -282,7 +282,7 @@ - Invoke-Expression -Command .gitlab/ci/borland.ps1 - $pwdpath = $pwd.Path - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\bcc\bin;$env:PATH" - - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake + - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake interruptible: true @@ -296,7 +296,7 @@ - Invoke-Expression -Command .gitlab/ci/clang.ps1 - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1 - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\llvm\bin;$env:PATH" - - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake + - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake interruptible: true @@ -306,7 +306,7 @@ script: - Invoke-Expression -Command .gitlab/ci/msvc.ps1 - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1 - - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake + - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake interruptible: true @@ -321,6 +321,6 @@ - Set-Item -Force -Path "env:EDPATH" -Value "$pwdpath\.gitlab\watcom\eddat" - Set-Item -Force -Path "env:WATCOM" -Value "$pwdpath\.gitlab\watcom" - Set-Item -Force -Path "env:WLINKTMP" -Value "." - - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake + - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake interruptible: true -- cgit v0.12 From 2a7ac62c04f2c4417306a505123a675baef82c8e Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Wed, 2 Mar 2022 09:11:41 -0500 Subject: ci: Compute processor count earlier in ctest_standalone.cmake Compute it early enough to use in the configure step. --- .gitlab/ci/ctest_standalone.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab/ci/ctest_standalone.cmake b/.gitlab/ci/ctest_standalone.cmake index 48e910b..cec2de2 100644 --- a/.gitlab/ci/ctest_standalone.cmake +++ b/.gitlab/ci/ctest_standalone.cmake @@ -6,6 +6,14 @@ include("${CMAKE_CURRENT_LIST_DIR}/env_$ENV{CMAKE_CONFIGURATION}.cmake" OPTIONAL set(cmake_args -C "${CMAKE_CURRENT_LIST_DIR}/configure_$ENV{CMAKE_CONFIGURATION}.cmake") +include(ProcessorCount) +ProcessorCount(nproc) +if (NOT "$ENV{CTEST_MAX_PARALLELISM}" STREQUAL "") + if (nproc GREATER "$ENV{CTEST_MAX_PARALLELISM}") + set(nproc "$ENV{CTEST_MAX_PARALLELISM}") + endif () +endif () + # Create an entry in CDash. ctest_start("${ctest_model}" GROUP "${ctest_group}") @@ -33,14 +41,6 @@ if (configure_result) "Failed to configure") endif () -include(ProcessorCount) -ProcessorCount(nproc) -if (NOT "$ENV{CTEST_MAX_PARALLELISM}" STREQUAL "") - if (nproc GREATER "$ENV{CTEST_MAX_PARALLELISM}") - set(nproc "$ENV{CTEST_MAX_PARALLELISM}") - endif () -endif () - if (CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles") set(CTEST_BUILD_FLAGS "-j${nproc} -l${nproc}") elseif (CTEST_CMAKE_GENERATOR MATCHES "Ninja") -- cgit v0.12 From b88f7aad639a46ea43bfe2ac9246d1c9bdbb9c0a Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Wed, 2 Mar 2022 09:16:18 -0500 Subject: ci: add nightly CI job to build CMake in-place --- .gitlab-ci.yml | 9 ++++++++ .gitlab/ci/configure_common.cmake | 9 +++++++- .../ci/configure_debian10_makefiles_inplace.cmake | 1 + .gitlab/ci/ctest_standalone.cmake | 4 ++++ .gitlab/ci/gitlab_ci.cmake | 6 +++++- .gitlab/os-linux.yml | 24 ++++++++++++++++++++++ 6 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .gitlab/ci/configure_debian10_makefiles_inplace.cmake diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c811092..3071055 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -275,6 +275,15 @@ b:fedora35-ninja: - .linux_builder_tags_qt - .run_manually +b:debian10-makefiles-inplace: + extends: + - .debian10_makefiles_inplace + - .cmake_build_linux_standalone + - .linux_builder_tags + - .run_manually + variables: + CMAKE_CI_JOB_NIGHTLY: "true" + t:fedora35-ninja: extends: - .fedora35_ninja diff --git a/.gitlab/ci/configure_common.cmake b/.gitlab/ci/configure_common.cmake index a711f3b..ed3d18d 100644 --- a/.gitlab/ci/configure_common.cmake +++ b/.gitlab/ci/configure_common.cmake @@ -1,4 +1,11 @@ -set(CTEST_USE_LAUNCHERS "ON" CACHE BOOL "") +if("$ENV{CMAKE_CI_BOOTSTRAP}") + # Launchers do not work during bootstrap: no ctest available. + set(CTEST_USE_LAUNCHERS "OFF" CACHE BOOL "") + # We configure by bootstrapping, so skip the BootstrapTest. + set(CMAKE_SKIP_BOOTSTRAP_TEST ON CACHE BOOL "") +else() + set(CTEST_USE_LAUNCHERS "ON" CACHE BOOL "") +endif() # We run the install right after the build. Avoid rerunning it when installing. set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_makefiles_inplace.cmake b/.gitlab/ci/configure_debian10_makefiles_inplace.cmake new file mode 100644 index 0000000..33f0db0 --- /dev/null +++ b/.gitlab/ci/configure_debian10_makefiles_inplace.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/ctest_standalone.cmake b/.gitlab/ci/ctest_standalone.cmake index cec2de2..9199693 100644 --- a/.gitlab/ci/ctest_standalone.cmake +++ b/.gitlab/ci/ctest_standalone.cmake @@ -23,6 +23,10 @@ set(CTEST_UPDATE_VERSION_ONLY ON) set(CTEST_UPDATE_COMMAND "${GIT_EXECUTABLE}") ctest_update() +if("$ENV{CMAKE_CI_BOOTSTRAP}") + set(CTEST_CONFIGURE_COMMAND "\"${CTEST_SOURCE_DIRECTORY}/bootstrap\" --parallel=${nproc}") +endif() + # Configure the project. ctest_configure( OPTIONS "${cmake_args}" diff --git a/.gitlab/ci/gitlab_ci.cmake b/.gitlab/ci/gitlab_ci.cmake index 697162c..080c93b 100644 --- a/.gitlab/ci/gitlab_ci.cmake +++ b/.gitlab/ci/gitlab_ci.cmake @@ -5,7 +5,11 @@ endif () # Set up the source and build paths. set(CTEST_SOURCE_DIRECTORY "$ENV{CI_PROJECT_DIR}") -set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build") +if("$ENV{CMAKE_CI_INPLACE}") + set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}") +else() + set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build") +endif() if (NOT "$ENV{CTEST_SOURCE_SUBDIRECTORY}" STREQUAL "") string(APPEND CTEST_SOURCE_DIRECTORY "/$ENV{CTEST_SOURCE_SUBDIRECTORY}") endif () diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 482ca7d..f6a8a19 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -126,6 +126,17 @@ CMAKE_CONFIGURATION: debian10_aarch64_ninja CTEST_NO_WARNINGS_ALLOWED: 1 +.debian10_makefiles_inplace: + extends: .debian10 + + variables: + CMAKE_CONFIGURATION: debian10_makefiles_inplace + CMAKE_GENERATOR: "Unix Makefiles" + CMAKE_CI_BOOTSTRAP: 1 + CMAKE_CI_INPLACE: 1 + CMAKE_CI_NO_INSTALL: 1 + CTEST_NO_WARNINGS_ALLOWED: 1 + .fedora35_ninja: extends: .fedora35 @@ -429,6 +440,19 @@ interruptible: true +.cmake_build_linux_standalone: + stage: build + + script: + - *before_script_linux + - .gitlab/ci/sccache.sh + - sccache --start-server + - sccache --show-stats + - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake" + - sccache --show-stats + + interruptible: true + .cmake_test_linux_release: stage: test-ext -- cgit v0.12