|
| 1 | +on: [push, pull_request] |
| 2 | + |
| 3 | +name: R-CMD-check |
| 4 | + |
| 5 | +jobs: |
| 6 | + R-CMD-check: |
| 7 | + if: "! contains(github.event.head_commit.message, '[ci skip]')" |
| 8 | + |
| 9 | + timeout-minutes: 30 |
| 10 | + |
| 11 | + runs-on: ${{ matrix.config.os }} |
| 12 | + |
| 13 | + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) ${{ matrix.config.label }} |
| 14 | + |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + config: |
| 19 | + - {os: windows-latest, r: 'release' } |
| 20 | + - {os: windows-latest, r: 'oldrel' } |
| 21 | + - {os: macOS-latest, r: 'release' } |
| 22 | + - {os: ubuntu-latest, r: 'devel' } |
| 23 | + - {os: ubuntu-latest, r: 'release' } |
| 24 | + - {os: ubuntu-latest, r: 'oldrel' } |
| 25 | + - {os: ubuntu-latest, r: '4.1' } |
| 26 | + |
| 27 | + env: |
| 28 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + R_KEEP_PKG_SOURCE: yes |
| 30 | + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true |
| 31 | + ## Test in other locale (optional) |
| 32 | + LANGUAGE: ${{ matrix.config.language }} |
| 33 | + ## R (>= 4.4.0) Note, no trailing underscore (sic!) |
| 34 | + _R_COMPARE_LANG_OBJECTS: eqonly |
| 35 | + ## R CMD check |
| 36 | + _R_CHECK_CRAN_INCOMING_: false |
| 37 | + _R_CHECK_MATRIX_DATA_: true |
| 38 | + _R_CHECK_SUGGESTS_ONLY_: true |
| 39 | + _R_CHECK_THINGS_IN_TEMP_DIR_: true |
| 40 | + _R_CHECK_TESTS_NLINES_: 300 |
| 41 | + RCMDCHECK_ERROR_ON: warning |
| 42 | + ## Specific to futures |
| 43 | + R_FUTURE_CONNECTIONS_ONMISUSE: "error[details=TRUE]" |
| 44 | + R_FUTURE_GLOBALENV_ONMISUSE: "error" |
| 45 | + R_FUTURE_GLOBALS_ONREFERENCE: "warning" |
| 46 | + R_FUTURE_RNG_ONMISUSE: error |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - uses: r-lib/actions/setup-pandoc@v2 |
| 52 | + |
| 53 | + - uses: r-lib/actions/setup-r@v2 |
| 54 | + with: |
| 55 | + r-version: ${{ matrix.config.r }} |
| 56 | + http-user-agent: ${{ matrix.config.http-user-agent }} |
| 57 | + use-public-rspm: true |
| 58 | + |
| 59 | + - uses: r-lib/actions/setup-r-dependencies@v2 |
| 60 | + with: |
| 61 | + extra-packages: | |
| 62 | + any::rcmdcheck |
| 63 | + any::remotes |
| 64 | + needs: check |
| 65 | + |
| 66 | + - name: Install package itself (special case) |
| 67 | + run: | |
| 68 | + install.packages(".", repos = NULL, type = "source") ## needed by parallel workers |
| 69 | + |
| 70 | + shell: Rscript {0} |
| 71 | + |
| 72 | + - name: Session info |
| 73 | + run: | |
| 74 | + options(width = 100) |
| 75 | + parallelly::availableCores(which = "all") |
| 76 | + sapply(c(physical_cores = FALSE, logical_cores = TRUE), parallel::detectCores) |
| 77 | + if (require(RhpcBLASctl, quietly=TRUE)) c(get_num_procs = get_num_procs(), get_num_cores = get_num_cores(), blas_get_num_procs = blas_get_num_procs(), omp_get_num_procs = omp_get_num_procs(), omp_get_max_threads = omp_get_max_threads()) |
| 78 | + capabilities() |
| 79 | + pkgs <- installed.packages()[, "Package"] |
| 80 | + sessioninfo::session_info(pkgs, include_base = TRUE) |
| 81 | + ## Verify LANGUAGE settings by generating a translatable error |
| 82 | + cat(sprintf("LANGUAGE=%s\n", sQuote(Sys.getenv("LANGUAGE")))) |
| 83 | + cat(sprintf("locales: %s\n", sQuote(Sys.getlocale()))) |
| 84 | + tryCatch(log("a"), error = conditionMessage) |
| 85 | + shell: Rscript {0} |
| 86 | + |
| 87 | + - name: Check |
| 88 | + if: runner.os != 'Windows' |
| 89 | + run: | |
| 90 | + rcmdcheck::rcmdcheck( |
| 91 | + args = c("--no-manual", "--as-cran"), |
| 92 | + check_dir = "check" |
| 93 | + ) |
| 94 | + shell: Rscript {0} |
| 95 | + |
| 96 | + - name: Check (Windows) |
| 97 | + if: runner.os == 'Windows' |
| 98 | + run: | |
| 99 | + rcmdcheck::rcmdcheck( |
| 100 | + args = c("--no-manual", "--as-cran", if (getRversion() >= "4.2.0") "--no-multiarch"), |
| 101 | + check_dir = "check" |
| 102 | + ) |
| 103 | + shell: Rscript {0} |
| 104 | + |
| 105 | + - name: Upload check results |
| 106 | + if: failure() |
| 107 | + uses: actions/upload-artifact@v4 |
| 108 | + with: |
| 109 | + name: ${{ runner.os }}-r${{ matrix.config.r }}-results |
| 110 | + path: check |
0 commit comments