From 469d57b415cfe20c797e295ba13fb9f791c522f7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Feb 2021 12:50:40 -0500 Subject: [PATCH] gitlab-ci: Use a specific MSVC version on Windows Teach jobs to load the environment for a specific MSVC version, and tag them accordingly. This allows runners to have multiple versions of MSVC installed without requiring us to compile on the newer ones right away. The runners provide the VS 2019 location in a `VS160COMNTOOLS` environment variable. Use it to avoid requiring a specific VS edition. Issue: #595 --- .gitlab/ci/config/setup_vs_powershell.ps1 | 14 -------------- .gitlab/ci/config/vcvarsall.ps1 | 9 +++++++++ .gitlab/ci/windows10.yml | 17 ++++++++++++++--- 3 files changed, 23 insertions(+), 17 deletions(-) delete mode 100644 .gitlab/ci/config/setup_vs_powershell.ps1 create mode 100755 .gitlab/ci/config/vcvarsall.ps1 diff --git a/.gitlab/ci/config/setup_vs_powershell.ps1 b/.gitlab/ci/config/setup_vs_powershell.ps1 deleted file mode 100644 index 2a4f69f29..000000000 --- a/.gitlab/ci/config/setup_vs_powershell.ps1 +++ /dev/null @@ -1,14 +0,0 @@ - -$tempFile = "$env:temp\vcvars.txt" - -if ($env:CI_JOB_NAME -eq "build:windows_vs2019") { - cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat`" && set > $tempFile" -} else { - cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat`" && set > $tempFile" -} - -Get-Content "$tempFile" | Foreach-Object { - if ($_ -match "^(.*?)=(.*)$") { - Set-Content "env:\$($matches[1])" $matches[2] - } -} diff --git a/.gitlab/ci/config/vcvarsall.ps1 b/.gitlab/ci/config/vcvarsall.ps1 new file mode 100755 index 000000000..57d338632 --- /dev/null +++ b/.gitlab/ci/config/vcvarsall.ps1 @@ -0,0 +1,9 @@ +$erroractionpreference = "stop" + +cmd /c "`"$env:VCVARSALL`" $VCVARSPLATFORM -vcvars_ver=$VCVARSVERSION & set" | +foreach { + if ($_ -match "=") { + $v = $_.split("=") + [Environment]::SetEnvironmentVariable($v[0], $v[1]) + } +} diff --git a/.gitlab/ci/windows10.yml b/.gitlab/ci/windows10.yml index 4f0b20827..90dea5a01 100644 --- a/.gitlab/ci/windows10.yml +++ b/.gitlab/ci/windows10.yml @@ -4,7 +4,7 @@ timeout: 2 hours interruptible: true before_script: - - .gitlab/ci/config/setup_vs_powershell.ps1 + - Invoke-Expression -Command .gitlab/ci/config/vcvarsall.ps1 - "cmake --version" - "cmake -V -P .gitlab/ci/config/gitlab_ci_setup.cmake" - "ctest -VV -S .gitlab/ci/ctest_configure.cmake" @@ -43,7 +43,7 @@ timeout: 50 minutes interruptible: true before_script: - - .gitlab/ci/config/setup_vs_powershell.ps1 + - Invoke-Expression -Command .gitlab/ci/config/vcvarsall.ps1 script: #Need to use our custom ctest-latest symlink #This will allow us to use 3.17+ which has support @@ -51,6 +51,12 @@ #due to system load are not reported - "ctest-latest -VV -S .gitlab/ci/ctest_test.cmake" +.windows_vs2019: + variables: + VCVARSALL: "${VS160COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" + VCVARSPLATFORM: "x64" + VCVARSVERSION: "14.25" + # Build on windows10 with Visual Studio # Will have CUDA 10.2 once build issues are resolved build:windows_vs2019: @@ -58,10 +64,12 @@ build:windows_vs2019: - vtkm # Since this is a bare runner, pin to a project. - build - windows - - vs2019 - shell + - vs2019 + - msvc-19.25 - large-memory extends: + - .windows_vs2019 - .cmake_build_windows - .only-default variables: @@ -77,9 +85,12 @@ test:windows_vs2019: - test - windows - shell + - vs2019 + - msvc-19.25 - cuda-rt - turing extends: + - .windows_vs2019 - .cmake_test_windows - .only-default dependencies: