Skip to content

Commit 6b468c0

Browse files
More fixes for occasional CI test based on new failures (#6131)
* Need utf8 in locale-gen to get that encoding by default * Run R CMD check manually if 'rcmdcheck' unavailable' * smaller diff * if/else, not ifelse * Exclude old macOS versions * Install packages required for other.Rraw * need to install curl manually?
1 parent eaf869e commit 6b468c0

File tree

1 file changed

+51
-5
lines changed

1 file changed

+51
-5
lines changed

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

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
os: [macOS-latest, windows-latest, ubuntu-latest]
1818
r: ['devel', 'release', '3.2', '3.3', '3.4', '3.5', '3.6', '4.0', '4.1', '4.2', '4.3']
1919
locale: ['en_US.utf8', 'zh_CN.utf8', 'lv_LV.utf8'] # Chinese for translations, Latvian for collate order (#3502)
20-
exclude: # only run non-English locale CI on Ubuntu
20+
exclude:
21+
# only run non-English locale CI on Ubuntu
2122
- os: macOS-latest
2223
locale: 'zh_CN.utf8'
2324
- os: macOS-latest
@@ -26,6 +27,21 @@ jobs:
2627
locale: 'zh_CN.utf8'
2728
- os: windows-latest
2829
locale: 'lv_LV.utf8'
30+
# macOS/arm64 only available for R>=4.1.0
31+
- os: macOS-latest
32+
r: '3.2'
33+
- os: macOS-latest
34+
r: '3.3'
35+
- os: macOS-latest
36+
r: '3.4'
37+
- os: macOS-latest
38+
r: '3.5'
39+
- os: macOS-latest
40+
r: '3.6'
41+
- os: macOS-latest
42+
r: '4.0'
43+
- os: macOS-latest
44+
r: '4.1'
2945

3046
env:
3147
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
@@ -42,14 +58,14 @@ jobs:
4258
- name: Set locale
4359
if: matrix.locale == 'zh_CN.utf8'
4460
run: |
45-
sudo locale-gen zh_CN
61+
sudo locale-gen 'zh_CN.utf8'
4662
echo "LC_ALL=zh_CN.utf8" >> $GITHUB_ENV
4763
echo "LANGUAGE=zh_CN" >> $GITHUB_ENV
4864
4965
- name: Set locale
5066
if: matrix.locale == 'lv_LV.utf8'
5167
run: |
52-
sudo locale-gen lv_LV
68+
sudo locale-gen 'lv_LV.utf8'
5369
echo "LC_ALL=lv_LV.utf8" >> $GITHUB_ENV
5470
echo "LANGUAGE=lv_LV" >> $GITHUB_ENV
5571
@@ -59,6 +75,11 @@ jobs:
5975
with:
6076
r-version: ${{ matrix.r }}
6177

78+
- name: Install check dependencies
79+
if: matrix.os != 'windows-latest' && matrix.os != 'macOS-latest'
80+
run: |
81+
sudo apt-get update
82+
sudo apt-get install -y libcurl4-openssl-dev
6283
6384
- name: Query dependencies
6485
run: |
@@ -85,15 +106,40 @@ jobs:
85106
- name: Install dependencies
86107
run: |
87108
remotes::install_deps(dependencies = TRUE)
88-
remotes::install_cran("rcmdcheck")
109+
other_deps_expr = parse('inst/tests/other.Rraw', n=1L)
110+
eval(other_deps_expr)
111+
pkgs <- get(as.character(other_deps_expr[[1L]][[2L]]))
112+
# May not install on oldest R versions
113+
try(remotes::install_cran(c(pkgs, "rcmdcheck")))
89114
shell: Rscript {0}
90115

91116
- name: Check
92117
env:
93118
_R_CHECK_CRAN_INCOMING_REMOTE_: false
94119
run: |
95120
options(crayon.enabled = TRUE)
96-
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
121+
122+
other_deps_expr = parse('inst/tests/other.Rraw', n=1L)
123+
eval(other_deps_expr)
124+
pkgs <- get(as.character(other_deps_expr[[1L]][[2L]]))
125+
has_pkg <- sapply(pkgs, requireNamespace, quietly=TRUE)
126+
if (!all(has_pkg)) {
127+
cat(sprintf("Skipping other.Rraw since some required packages are not available: %s\n", toString(pkgs[!has_pkg])))
128+
Sys.unsetenv("TEST_DATA_TABLE_WITH_OTHER_PACKAGES")
129+
}
130+
131+
args <- c("--no-manual", "--as-cran")
132+
if (requireNamespace("rcmdcheck", quietly=TRUE)) {
133+
rcmdcheck::rcmdcheck(args = args, error_on = "warning", check_dir = "check")
134+
} else {
135+
Rbin = if (.Platform$OS.type == "windows") "R.exe" else "R"
136+
system2(Rbin, c("CMD", "build", "."))
137+
res = system2(Rbin, c("CMD", "check", "data.table_*.tar.gz", args), stdout=TRUE)
138+
if (!is.null(attr(res, "status")) || grep("^Status:.*(ERROR|WARNING)", res)) {
139+
writeLines(res)
140+
stop("R CMD check failed")
141+
}
142+
}
97143
shell: Rscript {0}
98144

99145
- name: Upload check results

0 commit comments

Comments
 (0)