Bump codecov/codecov-action from 5 to 6 #406
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
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main, master, develop, release, auto-update-test, update-gha-workflows] | |
| pull_request: | |
| branches: [main, master, develop, release] | |
| schedule: | |
| # (see https://crontab.guru) | |
| - cron: "5 3 * */2 WED" | |
| name: R-CMD-check | |
| jobs: | |
| R-CMD-check: | |
| runs-on: ${{ matrix.config.os }} | |
| name: ${{ matrix.config.os }} (R-${{ matrix.config.r }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {os: macOS-latest, r: 'release'} | |
| - {os: windows-latest, r: 'release'} | |
| # - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | |
| - {os: ubuntu-latest, r: 'release'} | |
| - {os: ubuntu-latest, r: 'oldrel'} | |
| permissions: | |
| contents: read | |
| env: | |
| R_KEEP_PKG_SOURCE: yes | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - 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 | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: any::rcmdcheck, any::devtools, any::remotes, local::. | |
| needs: check | |
| # roxygen2 7.3.x introduced a parser_setMethod bug: it calls | |
| # methods::getMethod(name, eval(call$signature), where = env) with no | |
| # error handling. In a clean Rscript session, S4 method tables for | |
| # primitives ([[, [, $, etc.) are not populated → crash with | |
| # "no method found for function '[[' and signature hyperSpec". | |
| # Pin to 7.2.3 on ALL platforms (including R-devel) to avoid this. | |
| # | |
| # If roxygen2 7.2.3 fails to load on some future R-devel (e.g. due to a | |
| # C-ABI break like the SET_GROWABLE_BIT removal in R 4.6.0-pre), the | |
| # tryCatch below catches the error and attempts a fallback. For the | |
| # git-restore fallback to work, NAMESPACE and man/ must be committed | |
| # (pre-built docs pattern used by Bioconductor / Matrix). | |
| - name: "Install roxygen2 7.2.3" | |
| run: | | |
| # 7.3.x has parser_setMethod bug (see comment above); 7.2.3 does not. | |
| remotes::install_version("roxygen2", "7.2.3") | |
| shell: Rscript {0} | |
| - name: Install dependencies (for R-devel) | |
| if: matrix.config.r == 'devel' | |
| run: | | |
| remotes::install_cran("vdiffr", type = "source", force = TRUE) | |
| shell: Rscript {0} | |
| - name: Install dependencies (for R-oldrel) | |
| if: matrix.config.r == '3.6' | |
| run: | | |
| remotes::install_version("rgl", "0.100.50") | |
| shell: Rscript {0} | |
| - name: Session info | |
| run: | | |
| cat( | |
| "NOTE: See full session info in Dependency Setup step logs. \n", | |
| "Not all dependencies are listed here.", | |
| sep = "" | |
| ) | |
| sessioninfo::session_info() | |
| shell: Rscript {0} | |
| - name: Roxygenize | |
| run: | | |
| # Attempt devtools::document(). roxygen2 7.2.3 (pinned above) avoids | |
| # the 7.3.x parser_setMethod crash on S4 primitives. However, if a | |
| # future R-devel C-ABI break prevents loading the roxygen2 shared | |
| # library, we catch the error and fall back to: | |
| # 1. git-restore of pre-committed NAMESPACE + man/ (preferred) | |
| # 2. source-compiled roxygen2 7.2.3 built against current R headers | |
| ok <- tryCatch({ | |
| devtools::document() | |
| TRUE | |
| }, error = function(e) { | |
| message("devtools::document() failed: ", conditionMessage(e)) | |
| # Fallback 1: restore from git (works when docs are pre-committed) | |
| message("Attempting git restore of NAMESPACE and man/...") | |
| ret <- system2("git", c("checkout", "HEAD", "--", "NAMESPACE", "man/"), | |
| stdout = TRUE, stderr = TRUE) | |
| if (file.exists("NAMESPACE")) { | |
| message("NAMESPACE restored from git.") | |
| return(FALSE) | |
| } | |
| message("Git restore failed (NAMESPACE not tracked). ", | |
| "Trying source-compiled roxygen2 7.2.3...") | |
| # Fallback 2: compile roxygen2 7.2.3 from source against current R | |
| tryCatch({ | |
| remotes::install_version("roxygen2", "7.2.3", type = "source", | |
| quiet = TRUE) | |
| devtools::document() | |
| message("devtools::document() succeeded with source-compiled 7.2.3.") | |
| TRUE | |
| }, error = function(e2) { | |
| message("Source-compiled 7.2.3 also failed: ", conditionMessage(e2)) | |
| message("R CMD check will fail: NAMESPACE is required.") | |
| FALSE | |
| }) | |
| }) | |
| if (!ok) message("Using pre-built documentation (if available).") | |
| shell: Rscript {0} | |
| - uses: r-lib/actions/check-r-package@v2 | |
| with: | |
| upload-snapshots: true | |
| - name: Show R-CMD-check log as step summary | |
| if: always() | |
| shell: bash | |
| run: | | |
| find check -name '00check.log' -exec sh -c 'echo "### $1"; cat "$1"' _ {} \; >> $GITHUB_STEP_SUMMARY || true | |