-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (37 loc) · 1.79 KB
/
Copy pathclassroom.yml
File metadata and controls
40 lines (37 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: GitHub Classroom Workflow
on: [push]
jobs:
build:
name: Autograding
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Installing pak and building lockfile
id: install
shell: Rscript {0}
run: |
cat("::set-output name=os-version::", sessionInfo()$running, "\n", sep = "")
cat("::set-output name=r-version::", if (grepl("development", rv <- R.Version()$version.string)) as.character(getRversion()) else rv, "\n", sep = "")
cat("::set-output name=lib-dir::", Sys.getenv("R_LIBS_USER"))
dir.create(Sys.getenv("R_LIBS_USER"), showWarnings=FALSE, recursive=TRUE)
install.packages("pak", repos="https://r-lib.github.io/p/pak/devel/", lib=Sys.getenv("R_LIBS_USER"))
.libPaths(Sys.getenv("R_LIBS_USER"))
dir.create(".github", showWarnings=FALSE)
reqs <- tryCatch(readLines("PACKAGES"), error=function(e) character())
reqs <- grep("^[^#]", grep("\\S", trimws(reqs), value=TRUE), value=TRUE)
core <- c("any::sessioninfo", "any::testthat", "any::rmarkdown")
pak::lockfile_create(c(core, reqs), lockfile=".github/pkg.lock")
- name: cache R packages
uses: pat-s/always-upload-cache@v2.1.5
with:
path: |
${{ steps.install.outputs.lib-dir }}/*
!${{ steps.install.outputs.lib-dir }}/pak
key: ${{ steps.install.outputs.os-version }}-${{ steps.install.outputs.r-version }}-${{ hashFiles('.github/pkg.lock') }}-4
restore-keys: |
${{ steps.install.outputs.os-version }}-${{ steps.install.outputs.r-version }}-
- name: Install dependencies
shell: Rscript {0}
run: |
pak::lockfile_install(".github/pkg.lock")
- uses: education/autograding@v1