Merge pull request #127 from theislab/dependabot/github_actions/actio… #254
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
## This is a simplified action for building and testing a Bioconductor package | |
## based on: | |
## * https://github.com/lcolladotor/biocthis/blob/master/actions/check-bioc.yml | |
## * https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml | |
## * https://github.com/seandavi/BuildABiocWorkshop2020/blob/master/.github/workflows/basic_checks.yaml | |
name: R-CMD-check-bioc | |
## Specify which branches to run on | |
## The "devel" branch corresponds to Bioc-devel and "RELEASE_X" branches are | |
## Bioconductor releases. See http://bioconductor.org/developers/how-to/git/. | |
on: | |
push: | |
branches: | |
- devel | |
- 'RELEASE_*' | |
- actions | |
pull_request: | |
branches: | |
- devel | |
- 'RELEASE_*' | |
- actions | |
jobs: | |
get-bioc-release: | |
# Identify the Bioconductor release from the git branch. Also specifies a | |
# Bioconductor Docker image to use. | |
runs-on: ubuntu-latest | |
outputs: | |
biocimage: ${{ steps.get-release.outputs.biocimage }} | |
biocrelease: ${{ steps.get-release.outputs.biocrelease }} | |
steps: | |
- id: get-release | |
name: Get Bioconductor release | |
run: | | |
if echo "$GITHUB_REF" | grep -q "RELEASE_"; then | |
biocrelease="$(basename -- $GITHUB_REF | tr '[:upper:]' '[:lower:]')" | |
else | |
biocrelease="devel" | |
fi | |
biocimage="bioconductor/bioconductor_docker:${biocrelease}" | |
echo "Bioc release: ${biocrelease}" | |
echo "Bioc docker image: {$biocimage}" | |
## Store the information | |
echo "biocimage=${biocimage}" >> $GITHUB_OUTPUT | |
echo "biocrelease=${biocrelease}" >> $GITHUB_OUTPUT | |
get-bioc-version: | |
# Identify the Bioconductor version number and R version to use. This is | |
# done by checking the versions in the Bioconductor Docker container | |
# selected by get-bioc-release. | |
runs-on: ubuntu-latest | |
needs: get-bioc-release | |
container: | |
image: ${{ needs.get-bioc-release.outputs.biocimage }} | |
outputs: | |
Rversion: ${{ steps.set-versions.outputs.rversion }} | |
biocversion: ${{ steps.set-versions.outputs.biocversion }} | |
steps: | |
- id: get-versions | |
name: Get Bioconductor/R versions | |
run: | | |
biocconfig <- "https://bioconductor.org/config.yaml" | |
biocrelease <- "${{ needs.get-bioc-release.outputs.biocrelease }}" | |
cat("Bioc release RAW:", biocrelease, "\n") | |
biocrelease <- ifelse( | |
grepl(biocrelease, "release"), | |
"release", "devel" | |
) | |
biocmap <- BiocManager:::.version_map_get_online(biocconfig) | |
biocversion <- subset(biocmap, BiocStatus == biocrelease)[, 'Bioc'] | |
biocversion_str <- as.character(biocversion) | |
rversion <- subset(biocmap, BiocStatus == biocrelease)[, 'R'] | |
rversion_str <- as.character(rversion) | |
# Use R devel for BioC devel between November and May | |
if (biocrelease == "devel") { | |
current_month <- as.numeric(format(Sys.Date(), "%m")) | |
if (current_month >= 11 || current_month <= 5) { | |
cat("Setting R version to devel") | |
rversion <- "devel" | |
rversion_str <- "devel" | |
} | |
} | |
writeLines(c(biocversion_str, rversion_str), "versions.txt") | |
cat("GET VERSIONS", "\n") | |
cat("Bioc release: ", biocrelease, "\n") | |
cat("Bioc version: ", biocversion_str, "\n") | |
cat("R version: ", rversion_str, "\n") | |
shell: Rscript {0} | |
- id: set-versions | |
name: Set Bioconductor/R versions | |
run: | | |
biocversion=$(head -n 1 versions.txt) | |
rversion=$(tail -n 1 versions.txt) | |
echo "SET VERSIONS" | |
echo "Bioc version: ${biocversion}" | |
echo "R version: ${rversion}" | |
## Store the information | |
echo "biocversion=${biocversion}" >> $GITHUB_OUTPUT | |
echo "rversion=${rversion}" >> $GITHUB_OUTPUT | |
R-CMD-check-docker: | |
## Run checks in the Bioconductor Docker container | |
name: ubuntu-latest (r-biocdocker bioc-${{ needs.get-bioc-version.outputs.biocversion }}) | |
needs: [get-bioc-release, get-bioc-version] | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ needs.get-bioc-release.outputs.biocimage }} | |
volumes: | |
- /home/runner/work/_temp/Library:/usr/local/lib/R/host-site-library | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_BIOC_VERSION: ${{ needs.get-bioc-version.outputs.biocversion }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install extra linux dependencies | |
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev devscripts qpdf | |
- name: Setup R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 3 | |
extra-packages: any::rcmdcheck | |
needs: check | |
- name: Show session info | |
run: | | |
options(width = 100) | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
shell: Rscript {0} | |
- name: Check R package | |
uses: r-lib/actions/check-r-package@v2 | |
with: | |
upload-snapshots: true | |
upload-results: true | |
- name: BiocCheck | |
run: | | |
BiocManager::install("BiocCheck") | |
BiocCheck::BiocCheck( | |
dir('check', 'tar.gz$', full.names = TRUE), | |
`no-check-R-ver` = TRUE, | |
`no-check-bioc-help` = TRUE | |
) | |
shell: Rscript {0} | |
R-CMD-check: | |
## Run checks on other platforms. | |
name: ${{ matrix.config.os }} (r-${{ needs.get-bioc-version.outputs.rversion }} bioc-${{ needs.get-bioc-version.outputs.biocversion }}) | |
needs: [get-bioc-release, get-bioc-version] | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
experimental: [true] | |
config: | |
- {os: windows-latest} | |
- {os: macOS-latest} | |
- {os: ubuntu-20.04, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: ${{ matrix.config.rspm }} | |
R_BIOC_VERSION: ${{ needs.get-bioc-version.outputs.biocversion }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Linux system dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt update | |
sudo apt-get update | |
sudo apt-get upgrade libstdc++6 | |
- name: Setup Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ needs.get-bioc-version.outputs.rversion }} | |
use-public-rspm: true | |
- name: Setup R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 3 | |
extra-packages: any::rcmdcheck | |
needs: check | |
- name: Session info | |
run: | | |
options(width = 100) | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
shell: Rscript {0} | |
- name: Check R package | |
uses: r-lib/actions/check-r-package@v2 | |
with: | |
upload-snapshots: true | |
upload-results: true | |
test-coverage: | |
## Calculate package test coverage. Only runs if R-CMD-check-docker has | |
## completed successfully. Uses the Bioconductor Docker image. | |
if: github.ref == 'refs/heads/devel' | |
needs: [get-bioc-release, get-bioc-version, R-CMD-check-docker] | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ needs.get-bioc-release.outputs.biocimage }} | |
volumes: | |
- /home/runner/work/_temp/Library:/usr/local/lib/R/host-site-library | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_BIOC_VERSION: ${{ needs.get-bioc-version.outputs.biocversion }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install extra linux dependencies | |
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev devscripts qpdf | |
- name: Setup R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 3 | |
extra-packages: any::covr | |
needs: coverage | |
- name: Test coverage | |
run: covr::codecov(quiet = FALSE) | |
shell: Rscript {0} | |
pkgdown: | |
## Build pkgdown site and push to gh-pages branch. Only runs if on the | |
## devel branch and R-CMD-check-docker has completed successfully. Uses | |
## the Bioconductor Docker image. | |
if: github.ref == 'refs/heads/devel' | |
needs: [get-bioc-release, get-bioc-version, R-CMD-check-docker] | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ needs.get-bioc-release.outputs.biocimage }} | |
volumes: | |
- /home/runner/work/_temp/Library:/usr/local/lib/R/host-site-library | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_BIOC_VERSION: ${{ needs.get-bioc-version.outputs.biocversion }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set git credentials | |
## Assign commits to the GitHub Action user. This should happen | |
## automatically but doesn't (maybe because of Docker). | |
- run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
- name: Install extra linux dependencies | |
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev devscripts qpdf | |
- name: Setup R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 3 | |
extra-packages: any::pkgdown, local::. | |
needs: website | |
- name: Build pkgdown site | |
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | |
shell: Rscript {0} | |
- name: Deploy to GitHub pages 🚀 | |
if: github.event_name != 'pull_request' | |
uses: JamesIves/github-pages-deploy-action@4.1.4 | |
with: | |
clean: false | |
branch: gh-pages | |
folder: docs |