Skip to content

Commit

Permalink
Merge pull request #4 from Swechhya/add-bioconductor-support
Browse files Browse the repository at this point in the history
Add bioconductor support
  • Loading branch information
Swechhya authored Jul 12, 2020
2 parents eeabe0f + 9f0db53 commit 772117e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
23 changes: 18 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down

0 comments on commit 772117e

Please sign in to comment.