From a4e5715959057c0dd32d15c7a986d364d6b504e2 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Thu, 8 Feb 2024 09:28:47 -0500 Subject: Tests/SwiftOnly: Bump minimum required CMake to 3.5 This was missed by commit f53bd6f450 (Tests: Bump CMake minimum required in tests to 3.5, 2023-03-01, v3.27.0-rc1~401^2). --- Tests/SwiftOnly/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt index 2aa5710..3d2fe73 100644 --- a/Tests/SwiftOnly/CMakeLists.txt +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.5) if(POLICY CMP0126) cmake_policy(SET CMP0126 NEW) endif() -- cgit v0.12 From 0909fb9d4804b62ccf73bc99433a8d58740c6f0f Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Wed, 7 Feb 2024 16:46:07 -0500 Subject: ci: Enable Swift tests on Windows Issue: #25573 --- .gitlab/.gitignore | 1 + .../ci/configure_windows_vs2022_x64_ninja.cmake | 1 + .gitlab/ci/ctest_exclusions.cmake | 7 ++++ .gitlab/ci/env_windows_vs2022_x64_ninja.ps1 | 1 + .gitlab/ci/swift-env.ps1 | 6 ++++ .gitlab/ci/swift.ps1 | 38 ++++++++++++++++++++++ 6 files changed, 54 insertions(+) create mode 100755 .gitlab/ci/swift-env.ps1 create mode 100755 .gitlab/ci/swift.ps1 diff --git a/.gitlab/.gitignore b/.gitlab/.gitignore index b28fe32..0e34b1b 100644 --- a/.gitlab/.gitignore +++ b/.gitlab/.gitignore @@ -16,6 +16,7 @@ /python* /qt* /sccache* +/swift /unstable-jom* /watcom /wix* diff --git a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake index 54abf72..a41ec8b 100644 --- a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake +++ b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake @@ -1,6 +1,7 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "") set(CMake_TEST_CPACK_INNOSETUP "ON" CACHE STRING "") set(CMake_TEST_ISPC "ON" CACHE STRING "") + set(CMake_TEST_Swift "ON" CACHE STRING "") endif() set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "") diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake index a2789c3..ed5e1dd 100644 --- a/.gitlab/ci/ctest_exclusions.cmake +++ b/.gitlab/ci/ctest_exclusions.cmake @@ -34,6 +34,13 @@ if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "nvhpc_") ) endif() +if ("$ENV{CMAKE_CONFIGURATION}" STREQUAL "windows_vs2022_x64_ninja") + list(APPEND test_exclusions + # FIXME(#25573): This test failure needs further investigation. + "^SwiftMixLib$" + ) +endif() + string(REPLACE ";" "|" test_exclusions "${test_exclusions}") if (test_exclusions) set(test_exclusions "(${test_exclusions})") diff --git a/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1 b/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1 index 50a03ca..b512e37 100755 --- a/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1 +++ b/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1 @@ -1,4 +1,5 @@ if ("$env:CMAKE_CI_NIGHTLY" -eq "true") { . ".gitlab/ci/innosetup-env.ps1" . ".gitlab/ci/ispc-env.ps1" + . ".gitlab/ci/swift-env.ps1" } diff --git a/.gitlab/ci/swift-env.ps1 b/.gitlab/ci/swift-env.ps1 new file mode 100755 index 0000000..871b31c --- /dev/null +++ b/.gitlab/ci/swift-env.ps1 @@ -0,0 +1,6 @@ +$pwdpath = $pwd.Path +& "$pwsh" -File ".gitlab/ci/swift.ps1" +Set-Item -Force -Path "env:DEVELOPER_DIR" -Value "$pwdpath\.gitlab\swift" +Set-Item -Force -Path "env:SDKROOT" -Value "$pwdpath\.gitlab\swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk" +Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\swift\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;$env:PATH" +swiftc --version diff --git a/.gitlab/ci/swift.ps1 b/.gitlab/ci/swift.ps1 new file mode 100755 index 0000000..b970dce --- /dev/null +++ b/.gitlab/ci/swift.ps1 @@ -0,0 +1,38 @@ +$erroractionpreference = "stop" + +$version = "5.9.2" +$sha256sum = "8C053108528EB2DAD84C33D6F0834A3A1444D21BA1A89D591AB149304A62F6B5" +$filename = "swift-$version-win-x86_64-1" +$tarball = "$filename.zip" + +$outdir = $pwd.Path +$outdir = "$outdir\.gitlab" +$ProgressPreference = 'SilentlyContinue' +# This URL is only visible inside of Kitware's network. See above filename table. +Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/internal/$tarball" -OutFile "$outdir\$tarball" +$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256 +if ($hash.Hash -ne $sha256sum) { + exit 1 +} + +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir") +Move-Item -Path "$outdir\$filename" -Destination "$outdir\swift" +Remove-Item "$outdir\$tarball" + +$bin = "$outdir\swift\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin" +$null = New-Item -ItemType HardLink -Path "$bin\clang++.exe" -Target "$bin\clang.exe" +$null = New-Item -ItemType HardLink -Path "$bin\clang-cl.exe" -Target "$bin\clang.exe" +$null = New-Item -ItemType HardLink -Path "$bin\clang-cpp.exe" -Target "$bin\clang.exe" +$null = New-Item -ItemType HardLink -Path "$bin\ld.lld.exe" -Target "$bin\lld.exe" +$null = New-Item -ItemType HardLink -Path "$bin\ld64.lld.exe" -Target "$bin\lld.exe" +$null = New-Item -ItemType HardLink -Path "$bin\lld-link.exe" -Target "$bin\lld.exe" +$null = New-Item -ItemType HardLink -Path "$bin\llvm-dlltool.exe" -Target "$bin\llvm-ar.exe" +$null = New-Item -ItemType HardLink -Path "$bin\llvm-lib.exe" -Target "$bin\llvm-ar.exe" +$null = New-Item -ItemType HardLink -Path "$bin\llvm-ranlib.exe" -Target "$bin\llvm-ar.exe" +$null = New-Item -ItemType HardLink -Path "$bin\llvm-objcopy.exe" -Target "$bin\llvm-strip.exe" +$null = New-Item -ItemType HardLink -Path "$bin\swiftc.exe" -Target "$bin\swift.exe" +$null = New-Item -ItemType HardLink -Path "$bin\swift-api-digester.exe" -Target "$bin\swift-frontend.exe" +$null = New-Item -ItemType HardLink -Path "$bin\swift-autolink-extract.exe" -Target "$bin\swift-frontend.exe" +$null = New-Item -ItemType HardLink -Path "$bin\swift-symbolgraph-extract.exe" -Target "$bin\swift-frontend.exe" +Clear-Variable -Name bin -- cgit v0.12