|
| 1 | +function Check-Output { |
| 2 | + param( [int]$ExitCode ) |
| 3 | + if ($ExitCode -ne 0) { |
| 4 | + $host.SetShouldExit($ExitCode) |
| 5 | + Exit -1 |
| 6 | + } |
| 7 | +} |
| 8 | + |
| 9 | + |
| 10 | +Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } |
| 11 | +tzutil /s "GMT Standard Time" |
| 12 | +cd $env:APPVEYOR_BUILD_FOLDER |
| 13 | + |
| 14 | +[Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) |
| 15 | + |
| 16 | +$env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin;" + $env:PATH |
| 17 | + |
| 18 | +if (!(Get-Command R.exe -errorAction SilentlyContinue)) { |
| 19 | + appveyor DownloadFile https://cloud.r-project.org/bin/windows/base/R-3.5.1-win.exe -FileName ./R-win.exe |
| 20 | + Start-Process -FilePath .\R-win.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\R" |
| 21 | + |
| 22 | + appveyor DownloadFile https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe -FileName ./Rtools.exe |
| 23 | + Start-Process -FilePath .\Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" |
| 24 | + |
| 25 | + appveyor DownloadFile https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable.exe -FileName ./miktex-portable.exe |
| 26 | + 7z x .\miktex-portable.exe -o"$env:R_LIB_PATH\miktex" -y > $nul |
| 27 | +} |
| 28 | + |
| 29 | +initexmf --set-config-value [MPM]AutoInstall=1 |
| 30 | +conda install -y --no-deps pandoc |
| 31 | + |
| 32 | +cd .\R-package |
| 33 | +Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH" |
| 34 | +Add-Content .Rprofile "options(repos = 'https://cran.rstudio.com')" |
| 35 | + |
| 36 | +Rscript -e "if(!'devtools' %in% rownames(installed.packages())) { install.packages('devtools', dependencies = TRUE) }" |
| 37 | +Rscript -e "if(!'roxygen2' %in% rownames(installed.packages())) { install.packages('roxygen2', dependencies = TRUE) }" |
| 38 | +Rscript -e "if(!'testthat' %in% rownames(installed.packages())) { install.packages('testthat', dependencies = TRUE) }" |
| 39 | +Rscript -e "if(!'knitr' %in% rownames(installed.packages())) { install.packages('knitr', dependencies = TRUE) }" |
| 40 | +Rscript -e "if(!'covr' %in% rownames(installed.packages())) { install.packages('covr', dependencies = TRUE) }" |
| 41 | +Rscript -e "if(!'rmarkdown' %in% rownames(installed.packages())) { install.packages('rmarkdown', dependencies = TRUE) }" |
| 42 | +Rscript -e "if(!'reticulate' %in% rownames(installed.packages())) { install.packages('reticulate', dependencies = TRUE) }" |
| 43 | +Rscript -e "if(!'R6' %in% rownames(installed.packages())) { install.packages('R6', dependencies = TRUE) }" |
| 44 | +Rscript -e "if(!'Matrix' %in% rownames(installed.packages())) { install.packages('Matrix', dependencies = TRUE) }" |
| 45 | + |
| 46 | +Rscript -e "update.packages(ask = FALSE, instlib = Sys.getenv('R_LIB_PATH'))" |
| 47 | + |
| 48 | +Rscript -e "devtools::install_deps(pkg = '.', dependencies = TRUE)" |
| 49 | + |
| 50 | +R.exe CMD build . ; Check-Output $LastExitCode |
| 51 | + |
| 52 | +$PKG_FILE_NAME = Get-Item *.tar.gz |
| 53 | +$PKG_NAME = $PKG_FILE_NAME.BaseName.split("_")[0] |
| 54 | +$LOG_FILE_NAME = "$PKG_NAME.Rcheck/00check.log" |
| 55 | + |
| 56 | +R.exe CMD check "${PKG_FILE_NAME}" --as-cran ; Check-Output $LastExitCode |
| 57 | +if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING") { |
| 58 | + echo "WARNINGS have been found in the build log!" |
| 59 | + Check-Output -1 |
| 60 | +} |
| 61 | + |
| 62 | +Rscript -e "covr::codecov(quiet = FALSE)" |
0 commit comments