diff options
author | Brad King <brad.king@kitware.com> | 2023-02-28 14:33:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-02-28 18:39:44 (GMT) |
commit | 0929221ca3641ed890b15fc9abd416a5311138cf (patch) | |
tree | e2e993f3238516f69888fcbee72edede8da5753c /.gitlab/ci | |
parent | ce2e8253069fa1e5750b800a19f85c6e3b359bd8 (diff) | |
download | CMake-0929221ca3641ed890b15fc9abd416a5311138cf.zip CMake-0929221ca3641ed890b15fc9abd416a5311138cf.tar.gz CMake-0929221ca3641ed890b15fc9abd416a5311138cf.tar.bz2 |
gitlab-ci: Simplify Windows packaging pipeline
In commit 4c7c66dcf5 (gitlab-ci: Add jobs to make Windows x86_64 and
i386 packages, 2022-05-19, v3.24.0-rc1~112^2) we used a separate Windows
packaging job in nightly packaging pipelines. It did not run in release
pipelines, where we need to run the final packaging step manually with
signing. Simplify nightly packaging pipelines by running `cpack` at the
end of the build job as we do for other platforms.
For release packaging pipelines, create an archive of the files needed
to build a package, and present this as the built "package" on Windows.
Diffstat (limited to '.gitlab/ci')
-rw-r--r-- | .gitlab/ci/CMakeCPack.cmake | 3 | ||||
-rw-r--r-- | .gitlab/ci/configure_windows_package_common.cmake | 2 | ||||
-rw-r--r-- | .gitlab/ci/package_info.cmake.in | 1 | ||||
-rwxr-xr-x | .gitlab/ci/package_windows.ps1 | 7 | ||||
-rw-r--r-- | .gitlab/ci/package_windows_build.cmake | 40 | ||||
-rwxr-xr-x | .gitlab/ci/post_build_windows_arm64_package.ps1 | 1 | ||||
-rwxr-xr-x | .gitlab/ci/post_build_windows_i386_package.ps1 | 1 | ||||
-rwxr-xr-x | .gitlab/ci/post_build_windows_x86_64_package.ps1 | 1 |
8 files changed, 56 insertions, 0 deletions
diff --git a/.gitlab/ci/CMakeCPack.cmake b/.gitlab/ci/CMakeCPack.cmake new file mode 100644 index 0000000..971fe54 --- /dev/null +++ b/.gitlab/ci/CMakeCPack.cmake @@ -0,0 +1,3 @@ +if(NOT "$ENV{CMAKE_CI_PACKAGE}" MATCHES "^(dev)?$") + configure_file(${CMAKE_CURRENT_LIST_DIR}/package_info.cmake.in ${CMake_BINARY_DIR}/ci_package_info.cmake @ONLY) +endif() diff --git a/.gitlab/ci/configure_windows_package_common.cmake b/.gitlab/ci/configure_windows_package_common.cmake index 46c0a3e..b3929a4 100644 --- a/.gitlab/ci/configure_windows_package_common.cmake +++ b/.gitlab/ci/configure_windows_package_common.cmake @@ -19,4 +19,6 @@ set(CMake_TEST_Qt5 OFF CACHE BOOL "") set(CMake_TEST_Qt6 OFF CACHE BOOL "") set(Python_FIND_REGISTRY NEVER CACHE STRING "") +set(CMake_CPACK_CUSTOM_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/CMakeCPack.cmake" CACHE FILEPATH "") + include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/package_info.cmake.in b/.gitlab/ci/package_info.cmake.in new file mode 100644 index 0000000..f9a5bb7 --- /dev/null +++ b/.gitlab/ci/package_info.cmake.in @@ -0,0 +1 @@ +set(CPACK_PACKAGE_FILE_NAME "@CPACK_PACKAGE_FILE_NAME@") diff --git a/.gitlab/ci/package_windows.ps1 b/.gitlab/ci/package_windows.ps1 new file mode 100755 index 0000000..9ec2942 --- /dev/null +++ b/.gitlab/ci/package_windows.ps1 @@ -0,0 +1,7 @@ +if (Test-Path -Path "build/ci_package_info.cmake" -PathType Leaf) { + cmake -P .gitlab/ci/package_windows_build.cmake +} else { + cd build + cpack -G ZIP + cpack -G WIX +} diff --git a/.gitlab/ci/package_windows_build.cmake b/.gitlab/ci/package_windows_build.cmake new file mode 100644 index 0000000..e6ff0a6 --- /dev/null +++ b/.gitlab/ci/package_windows_build.cmake @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.24) +include(build/ci_package_info.cmake) + +set(build "${CMAKE_CURRENT_BINARY_DIR}/build") + +file(GLOB paths RELATIVE "${CMAKE_CURRENT_BINARY_DIR}" + # Allow CPack to find CMAKE_ROOT. + "${build}/CMakeFiles/CMakeSourceDir.txt" + + # We need the main binaries. + "${build}/bin" + + # Pass through the documentation. + "${build}/install-doc" + + # CPack configuration. + "${build}/CPackConfig.cmake" + "${build}/CMakeCPackOptions.cmake" + "${build}/Source/QtDialog/QtDialogCPack.cmake" + + # CPack/IFW packaging files. + "${build}/CMake*.qs" + + # CPack/WIX packaging files. + "${build}/Utilities/Release/WiX/custom_action_dll*.wxs" + "${build}/Utilities/Release/WiX/CustomAction/CMakeWiXCustomActions.*" + ) + +file(GLOB_RECURSE paths_recurse RELATIVE "${CMAKE_CURRENT_BINARY_DIR}" + # Install rules. + "${build}/cmake_install.cmake" + "${build}/*/cmake_install.cmake" + ) + +# Create a "package" containing the build-tree files needed to build a package. +file(ARCHIVE_CREATE + OUTPUT build/${CPACK_PACKAGE_FILE_NAME}.build.zip + PATHS ${paths} ${paths_recurse} + FORMAT zip + ) diff --git a/.gitlab/ci/post_build_windows_arm64_package.ps1 b/.gitlab/ci/post_build_windows_arm64_package.ps1 new file mode 100755 index 0000000..f98d995 --- /dev/null +++ b/.gitlab/ci/post_build_windows_arm64_package.ps1 @@ -0,0 +1 @@ +. .gitlab/ci/package_windows.ps1 diff --git a/.gitlab/ci/post_build_windows_i386_package.ps1 b/.gitlab/ci/post_build_windows_i386_package.ps1 new file mode 100755 index 0000000..f98d995 --- /dev/null +++ b/.gitlab/ci/post_build_windows_i386_package.ps1 @@ -0,0 +1 @@ +. .gitlab/ci/package_windows.ps1 diff --git a/.gitlab/ci/post_build_windows_x86_64_package.ps1 b/.gitlab/ci/post_build_windows_x86_64_package.ps1 new file mode 100755 index 0000000..f98d995 --- /dev/null +++ b/.gitlab/ci/post_build_windows_x86_64_package.ps1 @@ -0,0 +1 @@ +. .gitlab/ci/package_windows.ps1 |