summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-02-28 09:33:45 -0500
committerBrad King <brad.king@kitware.com>2023-02-28 13:39:44 -0500
commit0929221ca3641ed890b15fc9abd416a5311138cf (patch)
treee2e993f3238516f69888fcbee72edede8da5753c /.gitlab
parentce2e8253069fa1e5750b800a19f85c6e3b359bd8 (diff)
downloadcmake-0929221ca3641ed890b15fc9abd416a5311138cf.tar.gz
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')
-rw-r--r--.gitlab/artifacts.yml29
-rw-r--r--.gitlab/ci/CMakeCPack.cmake3
-rw-r--r--.gitlab/ci/configure_windows_package_common.cmake2
-rw-r--r--.gitlab/ci/package_info.cmake.in1
-rwxr-xr-x.gitlab/ci/package_windows.ps17
-rw-r--r--.gitlab/ci/package_windows_build.cmake40
-rwxr-xr-x.gitlab/ci/post_build_windows_arm64_package.ps11
-rwxr-xr-x.gitlab/ci/post_build_windows_i386_package.ps11
-rwxr-xr-x.gitlab/ci/post_build_windows_x86_64_package.ps11
-rw-r--r--.gitlab/os-windows.yml12
-rw-r--r--.gitlab/rules.yml2
11 files changed, 57 insertions, 42 deletions
diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml
index 1b5384f2d8..3557596e15 100644
--- a/.gitlab/artifacts.yml
+++ b/.gitlab/artifacts.yml
@@ -63,35 +63,6 @@
- build/DartConfiguation.tcl
- build/CTestCustom.cmake
-.cmake_build_package_artifacts:
- artifacts:
- expire_in: 1d
- name: "$CMAKE_CI_ARTIFACTS_NAME"
- paths:
- # Allow CPack to find CMAKE_ROOT.
- - build/CMakeFiles/CMakeSourceDir.txt
-
- # Install rules.
- - build/**/cmake_install.cmake
-
- # 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.*
-
.cmake_release_artifacts:
artifacts:
expire_in: 5d
diff --git a/.gitlab/ci/CMakeCPack.cmake b/.gitlab/ci/CMakeCPack.cmake
new file mode 100644
index 0000000000..971fe54dc4
--- /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 46c0a3e75a..b3929a472a 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 0000000000..f9a5bb778b
--- /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 0000000000..9ec2942eaf
--- /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 0000000000..e6ff0a6f4e
--- /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 0000000000..f98d99597d
--- /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 0000000000..f98d99597d
--- /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 0000000000..f98d99597d
--- /dev/null
+++ b/.gitlab/ci/post_build_windows_x86_64_package.ps1
@@ -0,0 +1 @@
+. .gitlab/ci/package_windows.ps1
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index ca5af43fb9..ded3e659ff 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -367,18 +367,6 @@
interruptible: true
-.cmake_package_windows:
- stage: package
-
- script:
- - *before_script_windows
- - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
- - cd build
- - cpack -G ZIP
- - cpack -G WIX
-
- interruptible: true
-
.cmake_test_windows:
stage: test
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index 8fc40a7f02..8efa3040f7 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -70,7 +70,7 @@
when: on_success
- if: '$CMAKE_CI_PACKAGE != null && $CI_JOB_STAGE == "prep"'
when: manual
- - if: '$CMAKE_CI_PACKAGE != null && $CI_JOB_STAGE != "package" && $CI_JOB_STAGE != "upload"'
+ - if: '$CMAKE_CI_PACKAGE != null && $CI_JOB_STAGE != "upload"'
when: on_success
- when: never