diff --git a/README.md b/README.md index eb67eac..d8fd0fd 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,14 @@ jobs: uses: Swechhya/R-actions@v1.1 with: action: 'all' + needsBioc: false ``` The action property can be any one of: - `build` Only builds the package - `all` Runs build and checks the built package +The needsBioc property can be any one of: +- `true` Installs bioconductor and dependencies +- `false` Only installs CRAN dependencies + diff --git a/action.yml b/action.yml index f2b3bc5..f0a15b0 100644 --- a/action.yml +++ b/action.yml @@ -4,11 +4,15 @@ branding: icon: 'check-square' color: 'blue' inputs: - action: # id of inpu + action: # id of input description: 'What should be run? One of: ["all", "build"]' default: 'all' + needsBioc: + description: 'Is Bioconductor package needed? One of [true, false]' + default: false runs: using: 'docker' image: 'Dockerfile' args: - ${{inputs.action}} + - ${{inputs.needsBioc}} diff --git a/entrypoint.sh b/entrypoint.sh index 2a4cd83..6b90f36 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -10,6 +10,9 @@ apt-get install -y xml2 default-jre default-jdk mesa-common-dev libglu1-mesa-dev apt-get install -y mesa-common-dev libx11-dev r-cran-rgl r-cran-rglpk r-cran-rsymphony r-cran-plyr apt-get install -y r-cran-reshape r-cran-reshape2 r-cran-rmysql +echo "\e[33m\e[1mR session information" +Rscript -e 'sessionInfo()' + # Check for build only if [ "$1" = "build" ]; then echo "\e[33m\e[1mRunning only build task" @@ -22,16 +25,26 @@ if [ "$1" = "all" ]; then echo "\e[33m\e[1mStart package build." R CMD build ./ echo "\e[33m\e[1mPackage build ended." - # Check if description file exi + # Check if description file exist if [ -f DESCRIPTION ]; then echo "\e[33m\e[1mDESCRIPTION exist." echo "\e[33m\e[1mInstall texlive for PDF manual check." apt-get -y install texlive - echo "\e[33m\e[1mInstall package dependencies." - Rscript -e 'install.packages(c("remotes"));if (!all(c("remotes") %in% installed.packages())) { q(status = 1, save = "no")}' - Rscript -e 'deps <- remotes::dev_package_deps(dependencies = NA);remotes::install_deps(dependencies = TRUE);if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages()), collapse=", ")); q(status = 1, save = "no")}' - + # Check for bioconductor dependencies + if [ "$2" = true ]; then + echo "\e[33m\e[1mInstall Bioconductor" + Rscript -e 'if (!requireNamespace("BiocManager", quietly=TRUE)) install.packages("BiocManager");if (FALSE) BiocManager::install(version = "devel", ask = FALSE);cat(append = TRUE, file = "~/.Rprofile.site", "options(repos = BiocManager::repositories());")' + + echo "\e[33m\e[1mInstall package dependencies." + Rscript -e 'if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes", repo = c(BiocManager::repositories()))' + Rscript -e 'deps <- remotes::dev_package_deps(dependencies = NA, repos = c(BiocManager::repositories()));remotes::install_deps(dependencies = TRUE, repos = c(BiocManager::repositories()));if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages(repo=)), collapse=", ")); q(status = 1, save = "no")}' + else + echo "\e[33m\e[1mInstall package dependencies." + Rscript -e 'if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")' + Rscript -e 'deps <- remotes::dev_package_deps(dependencies = NA);remotes::install_deps(dependencies = TRUE);if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages(repo=)), collapse=", ")); q(status = 1, save = "no")}' + fi + echo "\e[33m\e[1mGet package name and version from description file." package=$(grep -Po 'Package:(.*)' DESCRIPTION) version=$(grep -Po 'Version:(.*)' DESCRIPTION)