You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows, it would be useful to cache the R installation. I've been informed that the r-lib/actions/setup-r action doesn't just install R (and Rtools); it also sets up environment variables and PATH.
Another possible way to handle this might be making a Windows container with R + Rtools preinstalled, though that would require someone to maintain them, and who knows if it would actually be any faster to start up.
This is only tangentially related, but for package caching on Windows (or anything that uses actions/cache), I found that you have to fix the path so that actions/cache doesn't try to use C:/Rtools/bin/tar.exe when it saves the cache. (I've filed this at actions/cache#125)
Adding this to the end of a script will fix the problem, by pointing actions/cache to the tar.exe that it would normally use:
- name: Fix path for Windows cachingif: runner.os == 'Windows'run: echo "::add-path::C:/Program Files/Git/usr/bin"
That is a good way to fix it, #13 was the issue for that problem. It seems like partially a bug in the tar implementation shipped with RTools, it doesn't find the gzip executable also in RTools even though it is on the windows PATH.
Just re-confirmed that for "windows-latest + R 3.6" you really do need shell: bash if you want caching. I find this is not necessary for later versions of R (more specifically, the associated Rtools).
Activity
[-]Cache R installation[/-][+]Cache R installation on Windows[/+]jimhester commentedon Dec 12, 2019
Another possible way to handle this might be making a Windows container with R + Rtools preinstalled, though that would require someone to maintain them, and who knows if it would actually be any faster to start up.
wch commentedon Dec 12, 2019
This is only tangentially related, but for package caching on Windows (or anything that uses
actions/cache), I found that you have to fix the path so thatactions/cachedoesn't try to useC:/Rtools/bin/tar.exewhen it saves the cache. (I've filed this at actions/cache#125)Adding this to the end of a script will fix the problem, by pointing
actions/cacheto thetar.exethat it would normally use:https://github.com/wch/gha/blob/4c9a1a0b92c17c1af0d5c8a95418b979add88447/.github/workflows/hello.yml#L90-L96
UPDATE:
Github has made some changes for security reasons, so now you have to do the following:
Info here: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
jimhester commentedon Dec 12, 2019
That is a good way to fix it, #13 was the issue for that problem. It seems like partially a bug in the tar implementation shipped with RTools, it doesn't find the gzip executable also in RTools even though it is on the windows PATH.
Help GHA caching find the right tar and gzip, in the presence of olde…
jennybc commentedon Dec 22, 2020
In my hands, it seems to be very important to specify the
shellon Windows, which defaults to powershell. So here's the snippet I ended up using:jennybc commentedon Dec 22, 2020
Where this
echo "{path}" >> $GITHUB_PATHsyntax is documented:https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
benthecoder commentedon Feb 27, 2021
See if this helps with caching with older R versions on Windows
jennybc commentedon Feb 28, 2021
jennybc commentedon Feb 28, 2021
Just re-confirmed that for "windows-latest + R 3.6" you really do need
shell: bashif you want caching. I find this is not necessary for later versions of R (more specifically, the associated Rtools).florisvdh commentedon Mar 20, 2021
Same here, windows-latest + r-release (R 4.0.4) successfully used caching after dropping line 52 in:
actions/examples/check-standard.yaml
Lines 51 to 57 in 0363708
I tested it in a slightly modified version of the
check-standardworkflow, but I don't think those differences are relevant here.FWIW, this job took 9m 54s when the cache was not yet available (but created for the first time), and 3m 52s next time.
github-actions commentedon Nov 6, 2022
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue