From fe7f8fe6462ff45a9a942f474bc1b8aece7f2696 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 20 Sep 2023 10:31:43 -0500 Subject: [PATCH] [ci] ensure correct R version is used on GitHub Actions (fixes #5640) (#6107) --- .ci/test_r_package_windows.ps1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index e4d20de50b90..52d47effcad7 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -203,6 +203,19 @@ if ($env:COMPILER -ne "MSVC") { } } +# Checking that the correct R version was used +if ($env:TOOLCHAIN -ne "MSVC") { + $checks = Select-String -Path "${LOG_FILE_NAME}" -Pattern "using R version $env:R_WINDOWS_VERSION" + $checks_cnt = $checks.Matches.length +} else { + $checks = Select-String -Path "${INSTALL_LOG_FILE_NAME}" -Pattern "R version passed into FindLibR.* $env:R_WINDOWS_VERSION" + $checks_cnt = $checks.Matches.length +} +if ($checks_cnt -eq 0) { + Write-Output "Wrong R version was found (expected '$env:R_WINDOWS_VERSION'). Check the build logs." + Check-Output $False +} + # Checking that we actually got the expected compiler. The R package has some logic # to fail back to MinGW if MSVC fails, but for CI builds we need to check that the correct # compiler was used.