Skip to content

Commit 73bf6a7

Browse files
GHA: fix R CMD check
1 parent 7001cb2 commit 73bf6a7

File tree

1 file changed

+53
-105
lines changed

1 file changed

+53
-105
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 53 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
on: [push, pull_request]
2-
2+
33
name: R-CMD-check
44

55
jobs:
@@ -28,158 +28,106 @@ jobs:
2828
- {os: ubuntu-latest, r: 'oldrel-1' }
2929
- {os: ubuntu-latest, r: 'oldrel-2' }
3030
- {os: ubuntu-latest, r: '4.0' }
31-
- {os: windows-latest, r: 'release' , prune_functions: true, label: 'prune' }
32-
- {os: macOS-latest, r: 'release' , prune_functions: true, label: 'prune' }
33-
- {os: ubuntu-latest, r: 'devel' , prune_functions: true, label: 'prune' }
34-
- {os: ubuntu-latest, r: 'release' , prune_functions: true, label: 'prune' }
35-
- {os: ubuntu-latest, r: 'oldrel' , prune_functions: true, label: 'prune' }
36-
31+
- {os: ubuntu-latest, r: 'release' , availablecores: 1, label: 'availableCores.system=1' }
32+
- {os: ubuntu-latest, r: 'release' , availablecores: 2, label: 'availableCores.system=2' }
33+
- {os: ubuntu-latest, r: 'release' , language: ko, label: ko }
34+
- {os: ubuntu-latest, r: 'release' , language: zh_CN, label: zh_CN }
35+
- {os: ubuntu-latest, r: 'release' , language: zh_TW, label: zh_TW }
36+
3737
env:
3838
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3939
R_KEEP_PKG_SOURCE: yes
4040
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
41+
## Test in other locale (optional)
42+
LANGUAGE: ${{ matrix.config.language }}
43+
## R (>= 4.4.0) Note, no trailing underscore (sic!)
44+
_R_COMPARE_LANG_OBJECTS: eqonly
4145
## R CMD check
42-
RCMDCHECK_ERROR_ON: note
4346
_R_CHECK_CRAN_INCOMING_: false
44-
_R_CHECK_LENGTH_1_CONDITION_: true
45-
_R_CHECK_LENGTH_1_LOGIC2_: true
4647
_R_CHECK_MATRIX_DATA_: true
4748
_R_CHECK_SUGGESTS_ONLY_: true
48-
## Specific to futures
49-
R_FUTURE_PRUNE_FUNCTIONS: ${{ matrix.config.prune_functions }}
50-
R_FUTURE_GLOBALS_KEEPWHERE: ${{ matrix.config.globals_keepWhere }}
51-
52-
steps:
53-
- uses: actions/checkout@v4
54-
55-
- uses: r-lib/actions/setup-pandoc@v2
56-
57-
- uses: r-lib/actions/setup-tinytex@v2
58-
59-
- name: Install system dependencies (Linux)
60-
if: runner.os == 'Linux'
61-
run: sudo apt-get install -y tidy
62-
63-
- uses: r-lib/actions/setup-r@v2
64-
with:
65-
r-version: ${{ matrix.config.r }}
66-
67-
- uses: r-lib/actions/setup-r-dependencies@v2
68-
with:
69-
extra-packages: any::rcmdcheck, any::remotes
70-
needs: check
71-
72-
- name: Install R package dependencies (part 2)
73-
run: |
74-
install.packages(".", repos = NULL, type = "source") ## self vignette engine
75-
if (isTRUE(as.logical("${{ matrix.config.prune_functions }}"))) remotes::install_github("HenrikBengtsson/future", ref="feature/environments")
76-
shell: Rscript {0}
77-
78-
- name: Session info
79-
run: |
80-
options(width = 100)
81-
capabilities()
82-
pkgs <- installed.packages()[, "Package"]
83-
sessioninfo::session_info(pkgs, include_base = TRUE)
84-
shell: Rscript {0}
85-
86-
- name: Check (!Windows)
87-
if: runner.os != 'Windows'
88-
run: |
89-
rcmdcheck::rcmdcheck(
90-
args = "--as-cran",
91-
check_dir = "check"
92-
)
93-
shell: Rscript {0}
94-
95-
- name: Check (Windows)
96-
if: runner.os == 'Windows'
97-
run: |
98-
remotes::install_github("HenrikBengtsson/future", ref = "develop")
99-
rcmdcheck::rcmdcheck(
100-
- {os: ubuntu-latest, r: 'devel' , prune_functions: true, label: 'prune' }
101-
- {os: ubuntu-latest, r: 'release' , prune_functions: true, label: 'prune' }
102-
- {os: ubuntu-latest, r: 'oldrel' , prune_functions: true, label: 'prune' }
103-
104-
env:
105-
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
106-
R_KEEP_PKG_SOURCE: yes
107-
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
108-
## R CMD check
49+
_R_CHECK_THINGS_IN_TEMP_DIR_: true
50+
_R_CHECK_TESTS_NLINES_: 300
10951
RCMDCHECK_ERROR_ON: note
110-
_R_CHECK_CRAN_INCOMING_: false
111-
_R_CHECK_LENGTH_1_CONDITION_: true
112-
_R_CHECK_LENGTH_1_LOGIC2_: true
113-
_R_CHECK_MATRIX_DATA_: true
114-
_R_CHECK_SUGGESTS_ONLY_: true
11552
## Specific to futures
116-
R_FUTURE_PRUNE_FUNCTIONS: ${{ matrix.config.prune_functions }}
53+
R_PARALLELLY_AVAILABLECORES_SYSTEM: ${{ matrix.config.availablecores }}
54+
R_FUTURE_RNG_ONMISUSE: error
11755
R_FUTURE_GLOBALS_KEEPWHERE: ${{ matrix.config.globals_keepWhere }}
118-
56+
R_PARALLELLY_BRANCH: ${{ matrix.config.parallelly }}
57+
11958
steps:
12059
- uses: actions/checkout@v4
12160

12261
- uses: r-lib/actions/setup-pandoc@v2
12362

124-
- uses: r-lib/actions/setup-tinytex@v2
125-
126-
- name: Install system dependencies (Linux)
127-
if: runner.os == 'Linux'
128-
run: sudo apt-get install -y tidy
129-
13063
- uses: r-lib/actions/setup-r@v2
13164
with:
13265
r-version: ${{ matrix.config.r }}
133-
66+
http-user-agent: ${{ matrix.config.http-user-agent }}
67+
use-public-rspm: true
68+
13469
- uses: r-lib/actions/setup-r-dependencies@v2
13570
with:
136-
extra-packages: any::rcmdcheck, any::remotes
71+
extra-packages: |
72+
any::rcmdcheck
73+
any::remotes
13774
needs: check
13875

139-
- name: Install R package dependencies (part 2)
76+
- name: Install package itself (special case)
14077
run: |
141-
install.packages(".", repos = NULL, type = "source") ## self vignette engine
142-
if (isTRUE(as.logical("${{ matrix.config.prune_functions }}"))) remotes::install_github("HenrikBengtsson/future", ref="feature/environments")
78+
install.packages(".", repos = NULL, type = "source") ## needed by parallel workers
79+
pver <- Sys.getenv("R_PARALLELLY_BRANCH")
80+
if (nzchar(pver)) {
81+
remotes::install_github("futureverse/parallelly", ref = pver)
82+
}
83+
14384
shell: Rscript {0}
14485

14586
- name: Session info
14687
run: |
14788
options(width = 100)
89+
parallelly::availableCores(which = "all")
90+
sapply(c(physical_cores = FALSE, logical_cores = TRUE), parallel::detectCores)
91+
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())
14892
capabilities()
14993
pkgs <- installed.packages()[, "Package"]
15094
sessioninfo::session_info(pkgs, include_base = TRUE)
95+
## Verify LANGUAGE settings by generating a translatable error
96+
cat(sprintf("LANGUAGE=%s\n", sQuote(Sys.getenv("LANGUAGE"))))
97+
cat(sprintf("locales: %s\n", sQuote(Sys.getlocale())))
98+
tryCatch(log("a"), error = conditionMessage)
15199
shell: Rscript {0}
152100

153-
- name: Check (!Windows)
101+
- name: Check
154102
if: runner.os != 'Windows'
103+
env:
104+
## FIXME: Eventually update to 'R_FUTURE_GLOBALS_ONREFERENCE=error'
105+
R_FUTURE_GLOBALS_ONREFERENCE: "warning"
106+
R_FUTURE_PLAN: ${{ matrix.config.plan }}
107+
R_FUTURE_FORK_ENABLE: ${{ matrix.config.fork_enable }}
108+
R_FUTURE_FORK_MULTITHREADING_ENABLE: ${{ matrix.config.fork_multithreading_enable }}
109+
R_FUTURE_PSOCK_RELAY_IMMEDIATE: ${{ matrix.config.psock_relay_immediate }}
155110
run: |
111+
if (nzchar(Sys.getenv("R_FUTURE_PLAN")) || getRversion() < "3.5.0") Sys.setenv(RCMDCHECK_ERROR_ON = "error")
156112
rcmdcheck::rcmdcheck(
157-
args = "--as-cran",
113+
build_args = if (getRversion() < "3.5.0") "--no-build-vignettes",
114+
args = c("--no-manual", "--as-cran", if (getRversion() < "3.5.0") c("--no-vignettes", "--no-build-vignettes", "--ignore-vignettes")),
158115
check_dir = "check"
159116
)
160117
shell: Rscript {0}
161-
118+
162119
- name: Check (Windows)
163120
if: runner.os == 'Windows'
164121
run: |
165-
remotes::install_github("HenrikBengtsson/future", ref = "develop")
166122
rcmdcheck::rcmdcheck(
167-
args = c("--no-manual", "--as-cran"),
168-
check_dir = "check"
169-
)
170-
shell: Rscript {0}
171-
172-
- name: Upload check results
173-
if: failure()
174-
uses: actions/upload-artifact@v4
175-
with:
176-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
177-
path: check
178123
args = c(
179124
"--as-cran",
180125
if (.Platform[["OS.type"]] == "windows" ||
181126
grepl("darwin", R.version[["os"]], ignore.case = TRUE))
182-
"--no-manual"
127+
"--no-manual",
128+
if (.Platform[["OS.type"]] == "windows" &&
129+
getRversion() >= "4.2.0")
130+
"--no-multiarch"
183131
),
184132
check_dir = "check"
185133
)

0 commit comments

Comments
 (0)