summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-10-20 13:13:03 -0400
committerBrad King <brad.king@kitware.com>2020-10-20 15:11:12 -0400
commit8f7fef629b37e38341bfb8b99a276df9355551ec (patch)
tree703838cff2074d6b59d4caee073276d971424917 /.gitlab
parent81c88bb26190da0d9f5a2ceda8239387c2fdcd73 (diff)
downloadcmake-8f7fef629b37e38341bfb8b99a276df9355551ec.tar.gz
ci: add Python to PATH on Windows
Our test suite searches for a Python interpreter to perform some extra checks. Our CI base images for Linux have Python available. Update our Windows jobs to provide a Python interpreter for our test suite to find consistently between the build and test steps.
Diffstat (limited to '.gitlab')
-rw-r--r--.gitlab/ci/download_python3.cmake41
-rw-r--r--.gitlab/os-windows.yml3
2 files changed, 44 insertions, 0 deletions
diff --git a/.gitlab/ci/download_python3.cmake b/.gitlab/ci/download_python3.cmake
new file mode 100644
index 0000000000..0f5b18b4ff
--- /dev/null
+++ b/.gitlab/ci/download_python3.cmake
@@ -0,0 +1,41 @@
+cmake_minimum_required(VERSION 3.17)
+
+set(version "3.8.6")
+set(sha256sum "376e18eef7e3ea467f0e3af041b01fc7e2f12855506c2ab2653ceb5e0951212e")
+set(dirname "python-${version}-embed-win-x86_64")
+set(tarball "${dirname}.tar.xz")
+
+# Download the file.
+file(DOWNLOAD
+ "https://cmake.org/files/dependencies/${tarball}"
+ ".gitlab/${tarball}"
+ STATUS download_status
+ EXPECTED_HASH "SHA256=${sha256sum}")
+
+# Check the download status.
+list(GET download_status 0 res)
+if (res)
+ list(GET download_status 1 err)
+ message(FATAL_ERROR
+ "Failed to download ${tarball}: ${err}")
+endif ()
+
+# Extract the file.
+execute_process(
+ COMMAND
+ "${CMAKE_COMMAND}"
+ -E tar
+ xzf "${tarball}"
+ WORKING_DIRECTORY ".gitlab"
+ RESULT_VARIABLE res
+ ERROR_VARIABLE err
+ ERROR_STRIP_TRAILING_WHITESPACE)
+if (res)
+ message(FATAL_ERROR
+ "Failed to extract ${tarball}: ${err}")
+endif ()
+
+# Move to a predictable directory.
+file(RENAME
+ ".gitlab/${dirname}"
+ ".gitlab/python3")
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index 61a201881b..6830b8a4d3 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -82,6 +82,9 @@
- ninja --version
- cmake -P .gitlab/ci/download_qt.cmake
- Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\qt\bin;$env:PATH"
+ - cmake -P .gitlab/ci/download_python3.cmake
+ - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\python3;$env:PATH"
+ - python --version
.cmake_build_windows:
stage: build