Update github action R and bioc versions #778
Workflow file for this run
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
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. | |
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master, dev ] | |
pull_request: | |
schedule: | |
- cron: "0 6 * * 3" | |
name: R Build and Checks | |
jobs: | |
R-CMD-check: | |
runs-on: ubuntu-${{ matrix.config.os }} | |
name: ubuntu-${{ matrix.config.os }} (${{ matrix.config.r }} / ${{ matrix.config.bioc }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
#- {os: 24.04, r: 'devel', bioc: 'devel'} | |
- {os: 24.04, r: '4.4', bioc: '3.20', pkgdown: "true"} | |
- {os: 22.04, r: '4.3', bioc: '3.18'} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
CELLHASHR_DEBUG: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
http-user-agent: ${{ matrix.config.http-user-agent }} | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Install packages | |
if: runner.os != 'Windows' | |
# NOTE: switch back to main GMM_demux repo when this is resolved: https://github.com/CHPGenetics/GMM-Demux/pull/8 | |
# NOTE: switch back to main demuxEM repo when this is resolved: https://github.com/lilab-bcb/demuxEM/pull/16 | |
# libglpk-dev added due to igraph | |
run: | | |
sudo apt-get update && sudo apt-get install -yq python3 python3-pip libglpk-dev | |
python3 -m pip install --upgrade pip | |
python3 -m pip install git+https://github.com/bbimber/demuxEM.git | |
python3 -m pip install git+https://github.com/bbimber/GMM-Demux.git | |
# The install_github() on remotes is to ensure system_requirements() supports 22.04 | |
- name: Setup Bioconductor | |
run: | | |
install.packages(c('remotes', 'devtools')) | |
remotes::install_github("r-lib/remotes") | |
if (!requireNamespace("BiocManager", quietly=TRUE)) install.packages("BiocManager"); | |
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE); | |
cat(append = TRUE, file = "~/.Rprofile", "local({"); | |
cat(append = TRUE, file = "~/.Rprofile", "repos <- append(getOption('repos'), BiocManager::repositories());"); | |
cat(append = TRUE, file = "~/.Rprofile", "repos <- repos[!duplicated(names(repos))];"); | |
cat(append = TRUE, file = "~/.Rprofile", "options(repos = repos);"); | |
cat(append = TRUE, file = "~/.Rprofile", "});"); | |
cat(append = TRUE, file = "~/.Rprofile", "Sys.setenv(R_BIOC_VERSION=as.character(BiocManager::version()));"); | |
cat(append = TRUE, file = "~/.Rprofile", "Sys.setenv(USE_GMMDEMUX_SEED=1);"); | |
# To avoid pthread_create() error. See: https://github.com/bmbolstad/preprocessCore/issues/1 and https://github.com/bmbolstad/preprocessCore/issues/12 | |
remotes::install_github("bmbolstad/preprocessCore", dependencies = T, upgrade = "always", force = TRUE, configure.args = "--disable-threading") | |
shell: Rscript {0} | |
- name: Query dependencies | |
run: | | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") | |
shell: Rscript {0} | |
- name: Cache R packages | |
if: runner.os != 'Windows' | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-${{ matrix.config.bioc }}-1-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-${{ matrix.config.bioc }}-${{ secrets.CACHE_VERSION || 1 }}- | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
run: | | |
while read -r cmd | |
do | |
eval sudo $cmd | |
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "${{ matrix.config.os }}"))') | |
- name: Install dependencies | |
run: | | |
remotes::install_deps(dependencies = TRUE, upgrade = "always") | |
install.packages("pkgdown") | |
remotes::install_cran("rcmdcheck") | |
shell: Rscript {0} | |
- name: Session info | |
run: | | |
options(width = 100) | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
shell: Rscript {0} | |
- name: Check | |
env: | |
_R_CHECK_CRAN_INCOMING_: false | |
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--no-build-vignettes"), error_on = "warning", check_dir = "check") | |
shell: Rscript {0} | |
- name: Show testthat output | |
if: always() | |
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@main | |
with: | |
name: ${{ runner.os }}-r${{ matrix.config.r }}-bioc${{ matrix.config.bioc }}-results | |
path: check | |
- name: Install package | |
if: github.ref == 'refs/heads/master' && matrix.config.pkgdown == 'true' | |
run: R CMD INSTALL . | |
- name: Deploy package | |
if: github.ref == 'refs/heads/master' && matrix.config.pkgdown == 'true' | |
run: | | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE)' |