Skip to content

Package build & check #248

Package build & check

Package build & check #248

Workflow file for this run

# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
# This workflow tests if the package can be installed
# Trigger workflow on push to main or development, and on a daily schedule
on:
push:
branches:
- main
- devel
schedule:
- cron: '0 4 * * *'
# Name of the workflow as shown in GitHub Actions UI
name: 'Package build & check'
jobs:
build-check:
# Run the job on each OS in the matrix (macOS, Ubuntu, Windows)
runs-on: ${{ matrix.config.os }}
# Show OS and R version in job name
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
# Define the matrix for cross-platform testing
strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'} # macOS latest with R release
- {os: ubuntu-latest, r: 'release'} # Ubuntu latest with R release
- {os: windows-latest, r: 'release'} # Windows latest with R release
# Set environment variables for authentication and R package source retention
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
R_LIBS_USER: ${{ github.workspace }}/.Rlibrary
R_BIOC_VERSION: "3.22"
# Only run on push to main/development or scheduled run
if: |
(github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/devel')) ||
(github.event_name == 'schedule' && github.ref == 'refs/heads/devel')
steps:
# Checkout the repository code
- uses: actions/checkout@v4
# Setup Pandoc (required for vignette and markdown rendering)
- uses: r-lib/actions/setup-pandoc@v2
# Install system dependency for glpk (required by some R packages on Ubuntu)
- name: Install libglpk40
if: ${{ matrix.config.os == 'ubuntu-latest' }}
run: sudo apt-get install -y libglpk40
# Install XQuartz for graphics on macOS (required by some R packages)
- name: Install xquartz (Mac OS)
if: ${{ matrix.config.os == 'macos-latest' }}
run: brew install --cask xquartz
# Setup R with the specified version
- 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
# Set R version as environment variable (used for caching and package installation)
- name: Set R version
run: |
Rscript -e "cat('R_VERSION=', as.character(getRversion()), '\n', file = Sys.getenv('GITHUB_ENV'), append = TRUE)"
# Ensure user library directory exists (cross-platform)
- name: Create user library directory
run: |
mkdir -p "$R_LIBS_USER"
shell: bash
# Cache R package installations to speed up repeated builds
- name: Set up R dependency cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ env.R_VERSION }}
restore-keys: |
${{ runner.os }}-r-${{ env.R_VERSION }}
# Install knitr to user library (required for vignette building; fixes missing knitr error)
- name: Install knitr
run: Rscript -e 'install.packages("knitr", lib = Sys.getenv("R_LIBS_USER"))'
- name: Install remotes
run: |
Rscript -e 'install.packages("remotes")'
Rscript -e 'remotes::install_github("r-lib/remotes")' # see: https://github.com/r-lib/remotes/issues/798
# Install OmnipathR from Bioconductor devel
- name: Install OmnipathR from Bioconductor devel
run: |
Rscript -e 'if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")'
Rscript -e 'BiocManager::install()'
Rscript -e 'remotes::install_github("saezlab/OmnipathR@devel")'
- name: Install EnhancedVolcano (not yet in Bioc 3.22)
run: |
Rscript -e 'remotes::install_github("kevinblighe/EnhancedVolcano")'
# Set Bioconductor back to release and install other Bioconductor dependencies
- name: Install other Bioconductor dependencies from release
run: |
Rscript -e 'remotes::install_deps(dependencies = TRUE)'
# ComplexUpset should be installed after ggplot2 to ensure compatibility, especially on Linux/Ubuntu.
- name: Install latest ggplot2
run: Rscript -e 'install.packages("ggplot2", type="source")'
- name: Install ComplexUpset from source
run: Rscript -e 'install.packages("ComplexUpset", type="source")'
# Install MetaProViz
- name: Install MetaProViz from git by remotes
if: github.ref == 'refs/heads/main'
run: Rscript -e 'remotes::install_github("saezlab/MetaProViz", dependencies = TRUE)' #we install from GitHub as if we are a random user
# Build and check the package using bash shell (required for Windows compatibility)
- name: Build and check package
shell: bash
run: |
R CMD build .
R CMD check *.tar.gz --no-manual
- name: Run BiocCheck
run: |
Rscript -e 'if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")'
Rscript -e 'BiocManager::install("BiocCheck")'
Rscript -e 'BiocCheck::BiocCheck(list.files(pattern = "*.tar.gz"))'