diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 75bbf8f634ba..72b9d0cb5ecb 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -28,6 +28,24 @@ function Run-R-Code-Redirect-Stderr { Rscript --vanilla -e $decorated_code } +# Remove all items matching some pattern from PATH environment variable +function Remove-From-Path { + param( + [string]$item_to_remove + ) + $env:path = ($env:path.Split(';') | Where-Object { $_ -notmatch "$item_to_remove" }) -join ';' +} + +# remove some details that exist in the GitHub Actions images which might +# cause conflicts with R and other components installed by this script +$env:RTOOLS40_HOME = "" +Remove-From-Path ".*chocolatey.*" +Remove-From-Path ".*Chocolatey.*" +Remove-From-Path ".*Git.*mingw64.*" +Remove-From-Path ".*msys64.*" +Remove-From-Path ".*rtools40.*" +Remove-From-Path ".*Strawberry.*" + # Get details needed for installing R components # # NOTES: @@ -95,6 +113,10 @@ Write-Output "Installing Rtools" ./Rtools.exe /VERYSILENT /SUPPRESSMSGBOXES /DIR=$RTOOLS_INSTALL_PATH ; Check-Output $? Write-Output "Done installing Rtools" +# wait for all Rtools files to be written +Write-Output "Sleeping to allow Rtools install to finish" +Start-Sleep -Seconds 60 + Write-Output "Installing dependencies" $packages = "c('data.table', 'jsonlite', 'Matrix', 'processx', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo')" Run-R-Code-Redirect-Stderr "options(install.packages.check.source = 'no'); install.packages($packages, repos = '$env:CRAN_MIRROR', type = 'binary', lib = '$env:R_LIB_PATH')" ; Check-Output $? diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index 54b2798fa40a..d8015f72b09d 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -60,6 +60,12 @@ jobs: compiler: clang r_version: 4.0 build_type: cmake + - os: windows-latest + task: r-package + compiler: MINGW + toolchain: MINGW + r_version: 3.6 + build_type: cmake - os: windows-latest task: r-package compiler: MINGW