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 | |
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.
-rw-r--r-- | .gitlab-ci.yml | 62 | ||||
-rw-r--r-- | .gitlab/artifacts.yml | 29 | ||||
-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 | ||||
-rw-r--r-- | .gitlab/os-windows.yml | 12 | ||||
-rw-r--r-- | .gitlab/rules.yml | 2 | ||||
-rw-r--r-- | CMakeCPack.cmake | 4 |
13 files changed, 70 insertions, 95 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af1dc6c..768a902 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,6 @@ stages: - build - test - test-ext - - package - upload ################################################################################ @@ -37,7 +36,6 @@ stages: # Job prefixes: # - `b:` build -# - `k:` package # - `l:` lint # - `p:` prep # - `t:` test @@ -1239,7 +1237,7 @@ b:windows-x86_64-package: extends: - .windows_x86_64_package - .cmake_build_windows - - .cmake_build_package_artifacts + - .cmake_release_artifacts - .windows_x86_64_tags_nonconcurrent_vs2022 - .run_only_for_package dependencies: @@ -1247,20 +1245,6 @@ b:windows-x86_64-package: needs: - p:doc-package variables: - CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-x86_64-build" - -k:windows-x86_64-package: - extends: - - .windows_x86_64_package - - .cmake_package_windows - - .cmake_release_artifacts - - .windows_x86_64_tags_nonconcurrent_vs2022 - - .run_only_for_package - dependencies: - - b:windows-x86_64-package - needs: - - b:windows-x86_64-package - variables: CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-x86_64" u:windows-x86_64-package: @@ -1268,15 +1252,15 @@ u:windows-x86_64-package: - .rsync_upload_package - .run_only_for_package dependencies: - - k:windows-x86_64-package + - b:windows-x86_64-package needs: - - k:windows-x86_64-package + - b:windows-x86_64-package b:windows-i386-package: extends: - .windows_i386_package - .cmake_build_windows - - .cmake_build_package_artifacts + - .cmake_release_artifacts - .windows_x86_64_tags_nonconcurrent_vs2022 - .run_only_for_package dependencies: @@ -1284,20 +1268,6 @@ b:windows-i386-package: needs: - p:doc-package variables: - CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-i386-build" - -k:windows-i386-package: - extends: - - .windows_i386_package - - .cmake_package_windows - - .cmake_release_artifacts - - .windows_x86_64_tags_nonconcurrent_vs2022 - - .run_only_for_package - dependencies: - - b:windows-i386-package - needs: - - b:windows-i386-package - variables: CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-i386" u:windows-i386-package: @@ -1305,15 +1275,15 @@ u:windows-i386-package: - .rsync_upload_package - .run_only_for_package dependencies: - - k:windows-i386-package + - b:windows-i386-package needs: - - k:windows-i386-package + - b:windows-i386-package b:windows-arm64-package: extends: - .windows_arm64_package - .cmake_build_windows - - .cmake_build_package_artifacts + - .cmake_release_artifacts - .windows_x86_64_tags_nonconcurrent_vs2022_arm64 - .run_only_for_package dependencies: @@ -1321,20 +1291,6 @@ b:windows-arm64-package: needs: - p:doc-package variables: - CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-arm64-build" - -k:windows-arm64-package: - extends: - - .windows_arm64_package - - .cmake_package_windows - - .cmake_release_artifacts - - .windows_x86_64_tags_nonconcurrent_vs2022_arm64 - - .run_only_for_package - dependencies: - - b:windows-arm64-package - needs: - - b:windows-arm64-package - variables: CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-arm64" u:windows-arm64-package: @@ -1342,6 +1298,6 @@ u:windows-arm64-package: - .rsync_upload_package - .run_only_for_package dependencies: - - k:windows-arm64-package + - b:windows-arm64-package needs: - - k:windows-arm64-package + - b:windows-arm64-package diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml index 1b5384f..3557596 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 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 diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index ca5af43..ded3e65 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 8fc40a7f..8efa304 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 diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 38fec3f..798affd 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -264,5 +264,9 @@ set(CPACK_SOURCE_IGNORE_FILES "~$" ) +if(CMake_CPACK_CUSTOM_SCRIPT) + include(${CMake_CPACK_CUSTOM_SCRIPT}) +endif() + # include CPack model once all variables are set include(CPack) |