Fix CI runners #260
This file contains hidden or 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
| # Based on workflows from https://github.com/Huber-group-EMBL/rhdf5 | |
| # Uses steps from https://github.com/grimbough/bioc-actions | |
| on: | |
| push: | |
| branches: | |
| - devel | |
| pull_request: | |
| name: R-CMD-check-bioc | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
| jobs: | |
| R-CMD-check-bioc: | |
| runs-on: ${{ matrix.config.os }} | |
| name: ${{ matrix.config.os }} (${{ matrix.config.bioc-version }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { os: windows-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', cache: 1 } | |
| - { os: macOS-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', cache: 1 } | |
| - { os: macOS-15-intel, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', cache: 2 } | |
| - { os: ubuntu-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', cache: 1 } | |
| - { os: ubuntu-latest, bioc-version: 'release', bioc-mirror: 'https://bioconductor.org/', cache: 1 } | |
| steps: | |
| ## R CMD check complains about Windows line endings without this | |
| - name: Configure git | |
| run: | | |
| git config --global core.autocrlf false | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install hdf5-tools libsz2 libaec-dev | |
| ## Workaround: | |
| ## * data.table (indirect dep via Seurat) fails to compile on macOS ARM because libintl.h is missing. | |
| ## * rhdf5 also fails to link because libssl/libcrypto are not on the default library search path. | |
| - name: Install macOS dependencies | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install gettext openssl | |
| mkdir -p ~/.R | |
| echo "CPPFLAGS += -I$(brew --prefix gettext)/include -I$(brew --prefix openssl)/include" >> ~/.R/Makevars | |
| echo "LDFLAGS += -L$(brew --prefix gettext)/lib -L$(brew --prefix openssl)/lib" >> ~/.R/Makevars | |
| - name: Setup R and Bioconductor | |
| # todo: remove this workaround line once it is working for windows and/or mac os x | |
| if: matrix.config.os != 'windows-latest' && matrix.config.os != 'macOS-latest' | |
| uses: grimbough/bioc-actions/setup-bioc@v1 | |
| with: | |
| bioc-version: ${{ matrix.config.bioc-version }} | |
| bioc-mirror: ${{ matrix.config.bioc-mirror }} | |
| ## windows-latest and macOS-latest (ARM) hit a bug in R-devel (commit | |
| ## dd03406, 2026-04-09) where BiocManager::install() crashes via | |
| ## old.packages(type="both") -> .available.both() -> subscript out of | |
| ## bounds. Work around by setting up R manually and calling | |
| ## BiocManager::install(update=FALSE) to skip the old.packages() call. | |
| - name: Setup R (Windows/macOS-ARM devel) | |
| if: matrix.config.os == 'windows-latest' || matrix.config.os == 'macOS-latest' | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: devel | |
| rtools-version: 45 | |
| use-public-rspm: true | |
| - name: Setup Bioconductor (Windows/macOS-ARM devel) | |
| if: matrix.config.os == 'windows-latest' || matrix.config.os == 'macOS-latest' | |
| shell: Rscript {0} | |
| run: | | |
| download.file( | |
| 'https://bioconductor.org/checkResults/devel/bioc-LATEST/Renviron.bioc', | |
| destfile = '~/.Renviron', mode = 'wb') | |
| write( | |
| 'options(BioC_mirror = "${{ matrix.config.bioc-mirror }}")', | |
| file = '~/.Rprofile', append = TRUE) | |
| install.packages(c("BiocManager", "remotes"), quiet = TRUE) | |
| ## update=FALSE avoids calling old.packages(type="both") which | |
| ## triggers the R-devel bug in .available.both() (commit dd03406) | |
| BiocManager::install(version = "3.23", ask = FALSE, update = FALSE) | |
| cat("R_BIOC_VERSION=3.23\n", file = Sys.getenv("GITHUB_ENV"), append = TRUE) | |
| - name: Install pandoc | |
| uses: r-lib/actions/setup-pandoc@v2 | |
| - name: Install R dependencies | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| cache-version: ${{ matrix.config.cache }} | |
| extra-packages: any::rcmdcheck | |
| needs: check | |
| ## Workaround: llvmlite has no pre-built pip wheel on macOS x86_64, | |
| ## but conda-forge does have a build. Use reticulate + conda to install. | |
| ## See https://github.com/numba/numba/issues/10187#issuecomment-3800638403 | |
| - name: Cache conda packages (macOS Intel) | |
| if: matrix.config.os == 'macOS-15-intel' | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.local/share/r-miniconda | |
| key: ${{ runner.os }}-conda-${{ hashFiles('DESCRIPTION') }} | |
| restore-keys: | | |
| ${{ runner.os }}-conda- | |
| - name: Install Python packages via conda (macOS Intel) | |
| id: install-conda | |
| if: matrix.config.os == 'macOS-15-intel' | |
| shell: Rscript {0} | |
| run: | | |
| reticulate::install_miniconda() | |
| reticulate::py_install( | |
| c("scanpy", "mudata"), | |
| method = "conda", | |
| channel = "conda-forge" | |
| ) | |
| # need to store this in Renviron because there's no easy way of | |
| # passing env vars to bioc-actions/build-install-check | |
| writeLines( | |
| paste0("RETICULATE_PYTHON=", reticulate::conda_python("r-reticulate")), | |
| "~/.Renviron" | |
| ) | |
| - name: Verify conda installation (macOS Intel) | |
| if: matrix.config.os == 'macOS-15-intel' | |
| shell: Rscript {0} | |
| run: | | |
| stopifnot(reticulate::py_module_available("scanpy")) | |
| stopifnot(reticulate::py_module_available("mudata")) | |
| cat("Python packages verified successfully\n") | |
| - name: Bioc - Build, Install, Check | |
| id: bioc-check | |
| uses: grimbough/bioc-actions/build-install-check@v1 | |
| - name: Show testthat output | |
| if: always() | |
| run: find .. -name 'testthat.Rout*' -exec cat '{}' \; || true | |
| shell: bash | |
| - name: Upload check results | |
| if: failure() && steps.bioc-check.outputs.check-dir != '' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ format('{0}-{1}-bioc-{2}-results', runner.os, runner.arch, env.R_BIOC_VERSION) }} | |
| path: ${{ steps.bioc-check.outputs.check-dir }} | |
| - name: Run BiocCheck | |
| if: matrix.config.os == 'ubuntu-latest' && matrix.config.bioc-version == 'devel' | |
| uses: grimbough/bioc-actions/run-BiocCheck@v1 | |
| with: | |
| error-on: 'never' | |
| arguments: '--no-check-bioc-help' |