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
| # Workflow derived from https://github.com/r-lib/actions/tree/master/examples | |
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
| on: | |
| push: | |
| branches: | |
| - revdep-workflow-testing | |
| workflow_dispatch: | |
| name: Reverse Dependency Checks | |
| jobs: | |
| revdep-checks: | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| batch: [ | |
| #1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, | |
| 12, | |
| #13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 | |
| ] | |
| name: Reverse dependency checks (batch ${{ matrix.batch }}) | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| R_KEEP_PKG_SOURCE: yes | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - uses: r-lib/actions/setup-r@v2 | |
| #- name: Install additional build dependencies | |
| # run: sudo apt-get install -y jags libmagick++-dev | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: local::. | |
| # local::. rstanarm BH RcppEigen RcppParallel github::ecmerkle/blavsam | |
| # bioc::DESeq2 github::stan-dev/cmdstanr github::CraigWangStat/eggCountsExtra | |
| # bioc::Rgraphviz rJava terra runjags magick geostan | |
| - name: Install additional R dependencies | |
| run: | | |
| install.packages("INLA",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE) | |
| install.packages('cmdstanr', repos = c('https://stan-dev.r-universe.dev', 'https://cloud.r-project.org')) | |
| shell: Rscript {0} | |
| - name: Check reverse dependencies (batch ${{ matrix.batch }}) | |
| run: | | |
| revdeps <- tools::package_dependencies("rstantools", reverse = TRUE, which = "all")$rstantools | |
| revdeps <- split(revdeps, cut(seq_along(revdeps), 30, labels = FALSE)) | |
| curr_revdeps <- revdeps[[${{ matrix.batch }}]] | |
| available_source_packages <- available.packages(type = "source") | |
| revdep_details <- available_source_packages[available_source_packages[,"Package"] %in% curr_revdeps,] | |
| pkg_tar_names <- paste0(revdep_details[,"Package"], "_", revdep_details[,"Version"], ".tar.gz") | |
| dir.create("./revdepchecks") | |
| download.file( | |
| url = paste0(revdep_details[,"Repository"], "/", pkg_tar_names), | |
| destfile = file.path(getwd(), "revdepchecks", pkg_tar_names), | |
| method = "libcurl", | |
| mode = "wb" | |
| ) | |
| tools::check_packages_in_dir("./revdepchecks", check_args=c("--no-manual")) | |
| res <- tools::check_packages_in_dir_details("revdepchecks/") | |
| saveRDS(res, file = "batch-${{ matrix.batch }}-status.rds") | |
| shell: Rscript {0} | |
| - name: Upload reverse dependency check results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: revdep-batch-${{ matrix.batch }} | |
| path: batch-${{ matrix.batch }}-status.rds | |
| combine-results: | |
| runs-on: ubuntu-latest | |
| needs: revdep-checks | |
| if: always() | |
| steps: | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: revdep-results | |
| pattern: revdep-batch-* | |
| merge-multiple: true | |
| - uses: r-lib/actions/setup-r@v2 | |
| - name: Combine reverse dependency check results | |
| run: | | |
| files <- list.files("revdep-results", pattern = "*.rds", full.names = TRUE) | |
| res <- do.call(rbind.data.frame, lapply(files, readRDS)) | |
| write.table(res, file = "revdep-results.csv", sep = ",", row.names = FALSE) | |
| res_error <- res[res$Status == "ERROR", ] | |
| if (nrow(res_error) > 0) { | |
| stop("The following packages had check errors: ", paste(res_error$Package, collapse=", "), | |
| call. = FALSE) | |
| } | |
| shell: Rscript {0} | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: revdep-status | |
| path: revdep-results.csv |