I put together a Github Actions Workflow that installs R and R packages to the runner and then runs unit tests on the Github Repository.
The process currently works, but it's relatively slow, the workflow taking anywhere between 4 and 8 minutes, and the majority of that time occupied by the installation of R packages. I'm wondering if I'm doing something sub-optimally with my Github Action that could be improved to speed up the overall workflow. In particular, I'm wondering if I can cache the R or R package installation to speed up the process, but I haven't seen a lot of information on how that would work -- most talk of caching using Github Actions relates to other languages, like with npm.
Does anyone have any ideas?
name: Run R Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: r-lib/actions/setup-r@v1
with:
r-version: '3.5.3' # The R version to download (if necessary) and use.
- name: Install Packages
run: Rscript -e 'install.packages(c("readr", "magrittr", "testthat", "here"))'
- name: Get current directory
run: pwd
- name: Run testthat
run: Rscript './run_tests.R'