-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRscript
39 lines (32 loc) · 1.16 KB
/
Rscript
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
#! /usr/bin/env bash
env_file=$(basename `mktemp`)
out_file=$(basename `mktemp`)
cch_dir=$(basename `mktemp`)
ssh -T freebsd <<EOF
touch "/tmp/${env_file}" "/tmp/${out_file}"
EOF
# copy files to VM
echo "::group::Copy workspace to VM"
bash /home/runner/work/_actions/vmactions/freebsd-vm/v1/run.sh rsyncToVM
echo "::endgroup::"
# GITHUB_* is automatically forwarded, as is LC_* (!)
ssh -T -o SendEnv=NOT_CRAN -o SendEnv=CI -o SendEnv=R_LIBS_USER freebsd \
"cd $GITHUB_WORKSPACE ; " \
GITHUB_ENV="/tmp/${env_file}" GITHUB_OUTPUT="/tmp/${out_file}" \
R_PKG_CACHE_DIR="/tmp/${cch_dir}" XDG_CACHE_HOME="/tmp/${cch_dir}" \
R_LIB_FOR_PAK=/usr/local/lib/R/site-library \
R --no-save -q < $1
status=$?
# copy files back from VM
echo "::group::Copy workspace from from VM"
bash /home/runner/work/_actions/vmactions/freebsd-vm/v1/run.sh rsyncBackFromVM
echo "::endgroup::"
scp freebsd:/tmp/${env_file} /tmp/${env_file} || true
scp freebsd:/tmp/${out_file} /tmp/${out_file} || true
touch /tmp/${env_file} /tmp/${out_file}
cat /tmp/${env_file} >> $GITHUB_ENV
cat /tmp/${out_file} >> $GITHUB_OUTPUT
if [ "$status" != "0" ]; then
echo "::error ::Command failed."
fi
exit $status