-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaction.yaml
77 lines (70 loc) · 2.48 KB
/
action.yaml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: 'r-hub/actions/setup-r-freebsd'
description: |
Setup a FreeBSD VM with R. Run this action on `ubuntu-latest`.
Based on https://github.com/vmactions/freebsd-vm.
author: 'Gábor Csárdi'
inputs:
release:
description: 'The release version of FreeBSD VM.'
required: false
default: '14.1'
runs:
using: "composite"
steps:
- name: Start FreeBSD VM. This might take 2-3 minutes.
uses: vmactions/freebsd-vm@v1
with:
release: ${{ inputs.release || '14.1' }}
envs: 'RUNNER_TEMP R_LIBS_USER NOT_CRAN'
run: |
freebsd-version
ln -s /usr/share/zoneinfo/Europe/Madrid /etc/localtime
chsh -s /bin/sh root
- name: Set up R library for caching, NOT_CRAN
run: |
R_LIBS_USER=${RUNNER_TEMP}/Library
echo "R_LIBS_USER=${R_LIBS_USER}" >> ${GITHUB_ENV}
if [[ -z "$NOT_CRAN" ]]; then echo "NOT_CRAN=true" >> ${GITHUB_ENV}; fi
mkdir -p "${R_LIBS_USER}"
shell: bash
- run: |
# Install R and pak
echo "::group::Install R"
# Install some system packages, so we can install tidyverse, devtools
pkg install -y R checkbashisms libxml2 pkgconf libgit2 qpdf
echo "::endgroup::"
echo "::group::Configure R"
ncpu=`(sysctl dev.cpu | grep location | wc -l) || echo 4`
echo "options(Ncpus=${ncpu})" >> ~/.Rprofile
R -q -e 'dir.create(Sys.getenv("R_LIBS_SITE"), showWarnings = FALSE, recursive = TRUE)'
echo 'export TZ=UTC' > /etc/profile.d/tz.sh
chmod +x /etc/profile.d/tz.sh
echo "::endgroup::"
echo "::group::Install pak"
R -q -e 'install.packages("pak", lib = Sys.getenv("R_LIBS_SITE"), repos = sprintf(
"https://r-lib.github.io/p/pak/devel/%s/%s/%s",
.Platform$pkgType,
R.Version()$os,
R.Version()$arch
))'
# if that fails, try to install the released version from source
R -q -e 'library(pak)' ||
R -q -e 'install.packages("pak", lib = Sys.getenv("R_LIBS_SITE"), repos = "https://cloud.r-project.org")'
echo "::endgroup::"
shell: freebsd {0}
- name: Set up remote shell
run: |
cp ${{ github.action_path }}/Rscript \
/usr/local/bin/Rscript
chmod 775 /usr/local/bin/Rscript
shell: bash
- name: Test R in FreeBSD VM
run: |
getRversion()
R.version[["platform"]]
.libPaths()
.Library
Sys.getenv("R_LIBS_SITE")
Sys.getenv("R_LIBS_USER")
find.package("pak")
shell: Rscript {0}