diff --git a/.github/workflows/bioccheck.yml b/.github/workflows/bioccheck.yml index 16cdde8..65b5c93 100644 --- a/.github/workflows/bioccheck.yml +++ b/.github/workflows/bioccheck.yml @@ -119,11 +119,23 @@ jobs: id: get-deps shell: Rscript {0} run: | - options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/noble/latest", BiocManager::repositories())) + # CRAN binaries must be built for the container's Ubuntu release, or + # their shared objects can need system libraries the image lacks. + # Read the codename from the container rather than hardcoding it. + os_release <- readLines("/etc/os-release") + codename <- sub("^VERSION_CODENAME=", "", grep("^VERSION_CODENAME=", os_release, value = TRUE)) + codename <- gsub("\"", "", codename) + if (length(codename) != 1L || !nzchar(codename)) + stop("Could not read VERSION_CODENAME from /etc/os-release") + cran_repo <- sprintf("https://packagemanager.posit.co/cran/__linux__/%s/latest", codename) + cat(sprintf("CRAN_REPO=%s\n", cran_repo), file = Sys.getenv("GITHUB_ENV"), append = TRUE) + options(repos = c(CRAN = cran_repo, BiocManager::repositories())) if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes") deps <- remotes::dev_package_deps(".", dependencies = TRUE) saveRDS(deps, ".github/depends.Rds") - writeLines(sprintf("R-%s.%i", R.version$major, floor(as.numeric(R.version$minor))), ".github/R-version") + # The codename is part of the cache key so that a library of binaries + # built for another Ubuntu release is never restored. + writeLines(sprintf("R-%s.%i-%s", R.version$major, floor(as.numeric(R.version$minor)), codename), ".github/R-version") - name: Cache R Packages uses: actions/cache@v6 @@ -142,7 +154,7 @@ jobs: ENABLE_COVERAGE_REPORT: ${{ inputs.enable_coverage_report }} shell: Rscript {0} run: | - options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/noble/latest", BiocManager::repositories())) + options(repos = c(CRAN = Sys.getenv("CRAN_REPO"), BiocManager::repositories())) remotes::install_local(".", dependencies = TRUE, Ncpus = parallel::detectCores()) # Only install the tools for features that are used in this run. pkgs <- "rcmdcheck"