combining #32
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: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| batch: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
| 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 R Package Build Dependencies | |
| # uses: r-hub/actions/setup-r-sysreqs@v1 | |
| # with: | |
| # type: full | |
| #- name: Install additional build dependencies | |
| # run: brew install jags | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: | |
| local::. rstanarm BH RcppEigen RcppParallel github::ecmerkle/blavsam | |
| bioc::DESeq2 github::stan-dev/cmdstanr github::CraigWangStat/eggCountsExtra | |
| - 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')) | |
| - 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), 15, labels = FALSE)) | |
| curr_revdeps <- revdeps[[${{ matrix.batch }}]] | |
| revdep_details <- available.packages()[available.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" | |
| ) | |
| pak::pak(revdep_details[,"Package"]) | |
| tools::check_packages_in_dir("./revdepchecks", Ncpus = 4) | |
| 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 all results | |
| 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 | |
| - name: Combine reverse dependency check results | |
| run: | | |
| files <- list.files("revdep-results", pattern = "*.rds") | |
| res <- do.call(rbind.data.frame, lapply(files, readRDS)) | |
| saveRDS(res, file = "revdep-status.rds") | |
| res_error <- res[res$Status == "ERROR", ] | |
| if (nrow(res_error) > 0) { | |
| stop("Error in: ", paste(res_error$Package, collapse=", ")) | |
| } | |
| shell: Rscript {0} | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: revdep-status | |
| path: revdep-status.rds |