Instantly share code, notes, and snippets.

Embed
What would you like to do?
codeship basic check
check_results <- devtools::check()
print(check_results)
if (length(check_results$errors) + length(check_results$warnings) + length(check_results$notes) >= 1) {
stop('error, warning or note found')
}
mkdir -p $HOME/cache/packrat/lib
mkdir -p $HOME/cache/packrat/lib-R
mkdir -p $HOME/cache/packrat/lib-ext
cp -r $HOME/cache/packrat/lib ./packrat/
cp -r $HOME/cache/packrat/lib-R ./packrat/
cp -r $HOME/cache/packrat/lib-ext ./packrat/
R -e "0" --args --bootstrap-packrat
R -e "packrat::restore(restart = FALSE)"
cp -r packrat/lib $HOME/cache/packrat
cp -r packrat/lib-R $HOME/cache/packrat
cp -r packrat/lib-ext $HOME/cache/packrat
R_VERSION=${R_VERSION:="3.4.1"}
R_PATH=${R_PATH:=$HOME/r}
CACHED_DOWNLOAD="${HOME}/cache/R-${R_VERSION}.tar.gz"
mkdir -p "${R_PATH}"
wget --continue --output-document "${CACHED_DOWNLOAD}" "https://cran.r-project.org/src/base/R-${R_VERSION%%.*}/R-${R_VERSION}.tar.gz";;;
tar -xaf "${CACHED_DOWNLOAD}" --strip-components=1 --directory "${R_PATH}"
export PATH="${R_PATH}/bin:${PATH}"
cd "${R_PATH}" || exit 1
./configure
make
# check the correct version is used
R --version | grep "${R_VERSION}"
cd ~/clone
chmod +x codeship/cs_packrat_setup.sh
codeship/cs_packrat_setup.sh
Rscript cs_check.R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment