WIP: support for Sirius annotations #102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Acronyms: | |
## * GHA: GitHub Action | |
## * OS: operating system | |
on: | |
push: | |
pull_request: | |
# Define the GitHub Actions workflow for R CMD check of the MetFamily package | |
name: R-CMD-check-MetFamily | |
# Define environment variables for the workflow | |
env: | |
has_testthat: 'true' | |
# run_covr: 'true' # Disabled until later | |
run_covr: 'false' | |
# run_pkgdown: 'true' # Disabled until later | |
run_pkgdown: 'false' | |
has_RUnit: 'false' | |
has_BiocCheck: 'false' | |
cache-version: 'cache-v1' | |
# Define the jobs for different operating systems | |
jobs: | |
build-check: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
container: ${{ matrix.config.cont }} | |
# Define the matrix for different configurations | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { os: ubuntu-latest, r: '4.3', bioc: '3.18', cont: "bioconductor/bioconductor_docker:RELEASE_3_18", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } | |
# - { os: ubuntu-latest, r: 'devel', bioc: 'devel', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } | |
# Disabling additional architectures until later | |
# - { os: macOS-latest, r: 'next', bioc: '3.18'} | |
# - { os: windows-latest, r: 'next', bioc: '3.18'} | |
# Define environment variables for the job | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: ${{ matrix.config.rspm }} | |
NOT_CRAN: true | |
TZ: UTC | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
# Define the steps to be executed | |
steps: | |
# Step 1: Set R Library home on Linux | |
- name: Set R Library home on Linux | |
if: runner.os == 'Linux' | |
run: | | |
mkdir /__w/_temp/Library | |
echo ".libPaths('/__w/_temp/Library')" > ~/.Rprofile | |
# Step 2: Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
# Step 3: Setup R from r-lib | |
- name: Setup R from r-lib | |
if: runner.os != 'Linux' | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
extra-repositories: https://janmarvin.r-universe.dev | |
# Step 4: Setup pandoc from r-lib | |
- name: Setup pandoc from r-lib | |
if: runner.os != 'Linux' | |
uses: r-lib/actions/setup-pandoc@v2 | |
# Step 5: Query dependencies and save RDS file | |
- name: Query dependencies | |
run: | | |
install.packages('remotes') | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
shell: Rscript {0} | |
# Step 6: Cache R packages based on configuration | |
- name: Cache R packages | |
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'" | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel- | |
# Step 7: Cache R packages on Linux | |
- name: Cache R packages on Linux | |
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' " | |
uses: actions/cache@v2 | |
with: | |
path: /home/runner/work/_temp/Library | |
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel- | |
# Step 8: Install Linux system dependencies | |
- name: Install Linux system dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sysreqs=$(Rscript -e 'cat("apt-get update -y && ", paste(remotes::system_requirements("ubuntu", "20.04"), collapse = " && "))') | |
echo $sysreqs | |
sudo -s eval "$sysreqs" | |
# Steps 9 and 10 (macOS and Windows dependencies) removed | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::rcmdcheck, testthat, openxlsx2 | |
needs: check | |
dependencies: '"hard"' | |
# Step 11: Install BiocManager | |
- name: Install BiocManager | |
run: | | |
message(paste('****', Sys.time(), 'installing BiocManager ****')) | |
remotes::install_cran("BiocManager") | |
shell: Rscript {0} | |
# Step 12: Set BiocVersion | |
- name: Set BiocVersion | |
run: | | |
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE) | |
shell: Rscript {0} | |
# Step 13: Install dependencies pass 1 | |
- name: Install dependencies pass 1 | |
run: | | |
## Try installing the package dependencies in steps. First the local | |
## dependencies, then any remaining dependencies to avoid the | |
## issues described at | |
## https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016675.html | |
## https://github.com/r-lib/remotes/issues/296 | |
## Ideally, all dependencies should get installed in the first pass. | |
## Pass #1 at installing dependencies | |
BiocManager::install(c( | |
"mzR", "htmltools", "shiny", "shinyBS", "shinyjs", "shinybusy", | |
"DT", "colourpicker", "Matrix", "squash", "FactoMineR", "mixOmics", | |
"pcaMethods", "cba", "tools", "stringr", "xcms", "matrixStats", | |
"plotrix" | |
)) | |
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****')) | |
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, upgrade = TRUE) | |
BiocManager::install(c("rmarkdown", "BiocStyle")) | |
continue-on-error: true | |
shell: Rscript {0} | |
# Step 14: Install dependencies pass 2 | |
- name: Install dependencies pass 2 | |
run: | | |
## Pass #2 at installing dependencies | |
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****')) | |
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, upgrade = TRUE) | |
## Manually install packages that seem to be skipped. | |
message(paste('****', Sys.time(), 'force installation of selected packages ****')) | |
BiocManager::install("mzR", type = "source", force = TRUE) | |
BiocManager::install("Spectra") | |
## For running the checks | |
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****')) | |
remotes::install_cran("rcmdcheck") | |
BiocManager::install(c("BiocCheck", "DBI")) | |
shell: Rscript {0} | |
# Step 15: Install BiocGenerics | |
- name: Install BiocGenerics | |
if: env.has_RUnit == 'true' | |
run: | | |
## Install BiocGenerics | |
BiocManager::install("BiocGenerics") | |
shell: Rscript {0} | |
# Skipping Step 16: Install covr | |
# Step 17: Install pkgdown | |
- name: Install pkgdown | |
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux' | |
run: | | |
remotes::install_github("r-lib/pkgdown") | |
shell: Rscript {0} | |
# Step 18: Session info | |
- name: Session info | |
run: | | |
options(width = 100) | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
shell: Rscript {0} | |
# Step 19: Run CMD check | |
- name: Run CMD check | |
env: | |
_R_CHECK_CRAN_INCOMING_: false | |
run: | | |
rcmdcheck::rcmdcheck( | |
args = c("--no-build-vignettes", "--no-manual", "--timings"), | |
build_args = c("--no-manual", "--no-resave-data"), | |
error_on = "error", | |
check_dir = "check" | |
) | |
shell: Rscript {0} | |
# Step 20: Reveal testthat details | |
- name: Reveal testthat details | |
if: env.has_testthat == 'true' && runner.os == 'Linux' | |
run: find . -name testthat.Rout -exec cat '{}' ';' | |
# Step 21: Run RUnit tests | |
- name: Run RUnit tests | |
if: env.has_RUnit == 'true' && runner.os == 'Linux' | |
run: | | |
BiocGenerics:::testPackage() | |
shell: Rscript {0} | |
# Step 22: Run BiocCheck | |
- name: Run BiocCheck | |
if: env.has_BiocCheck == 'true' && runner.os == 'Linux' | |
run: | | |
BiocCheck::BiocCheck( | |
dir('check', 'tar.gz$', full.names = TRUE), | |
`quit-with-status` = TRUE, | |
`no-check-R-ver` = TRUE, | |
`no-check-bioc-help` = TRUE | |
) | |
shell: Rscript {0} | |
# Step 23: Test coverage | |
- name: Test coverage | |
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux' | |
run: | | |
covr::codecov() | |
shell: Rscript {0} | |
# Step 24: Install package | |
- name: Install package | |
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux' | |
run: R CMD INSTALL . | |
# Step 25: Test Shiny App in package | |
- name: Test Shiny App | |
uses: rstudio/shinytest2/actions/test-app@actions/v1 | |
with: | |
app-dir: "inst/MetFamily" | |
# Step 26: Deploy package | |
- name: Deploy package | |
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux' | |
run: | | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
git config --global --add safe.directory /__w/your-package-name | |
Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE)" | |
shell: bash {0} | |
## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE) | |
## at least one locally before this will work. This creates the gh-pages | |
## branch (erasing anything you haven't version controlled!) and | |
## makes the git history recognizable by pkgdown. | |
# Step 27: Upload check results | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@master | |
with: | |
name: ${{ runner.os }}-biocversion-devel-r-devel-results | |
path: check |