Skip to content

Commit eb601fe

Browse files
Updates for R-CMD-check-occasional to pass with minimal CI noise (#7832)
* Gemini: handle _R_CHECK_DEPENDS_ONLY_ correctly for other.Rraw * remove extraneous " * not so extraneous after all... should be ` anyway * Gemini: --as-cran always does the sandbox thing, so edit DESCRIPTION instead * Gemini: resolve <libintl.h> absence on macOS * Use toString, unique * annotate job with locale * Gemini: Correct handling of error branch FALSE || integer() gives NA; grep() was never right to use. I'm not sure if res could ever have length()>1, but doesn't hurt * Include R 4.4, 4.5 * Tweaks to reduce Annotations noise * Gemini: More annotations help. - fix brew untap handling - suppress whitespace compiler warnings - workaround liminal repos' warnings about lacking binary packages etc. This was co-written with Gemini. * Tidy up, and stop running on every push
1 parent dcaa87c commit eb601fe

1 file changed

Lines changed: 34 additions & 7 deletions

File tree

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

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
R-CMD-check-occasional:
1111
runs-on: ${{ matrix.os }}
1212

13-
name: ${{ matrix.os }} (${{ matrix.r }})
13+
name: ${{ matrix.os }} (${{ matrix.r }}, ${{ matrix.locale }})
1414

1515
strategy:
1616
fail-fast: false
1717
matrix:
1818
os: [macOS-latest, windows-latest, ubuntu-latest]
19-
r: ['devel', 'release', '3.5', '3.6', '4.0', '4.1', '4.2', '4.3']
19+
r: ['devel', 'release', '3.5', '3.6', '4.0', '4.1', '4.2', '4.3', '4.4', '4.5']
2020
locale: ['en_US.utf8', 'zh_CN.utf8', 'lv_LV.utf8'] # Chinese for translations, Latvian for collate order (#3502)
2121
exclude:
2222
# only run non-English locale CI on Ubuntu
@@ -69,15 +69,31 @@ jobs:
6969
with:
7070
r-version: ${{ matrix.r }}
7171

72+
- name: Set script permissions
73+
run: chmod +x configure cleanup 2>/dev/null || true # Silence some GHA Annotations
74+
shell: bash
75+
7276
- name: Install check dependencies (Ubuntu)
7377
if: matrix.os == 'ubuntu-latest'
7478
run: |
7579
sudo apt-get update
7680
sudo apt-get install -y libcurl4-openssl-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev pandoc
7781
82+
- name: Pre-untap untrusted Homebrew taps on macOS
83+
if: matrix.os == 'macOS-latest'
84+
run: brew untap aws/tap 2>/dev/null || true
85+
86+
- name: Install R Package Build Dependencies on MacOS
87+
if: matrix.os == 'macOS-latest'
88+
uses: r-hub/actions/setup-r-sysreqs@v1
89+
with:
90+
type: 'minimal'
91+
7892
- name: Install check dependencies (macOS)
7993
if: matrix.os == 'macOS-latest'
80-
run: brew install gdal proj
94+
run: |
95+
brew install gdal proj gettext
96+
brew link --overwrite --force gettext 2>/dev/null || true
8197
8298
- name: Check
8399
env:
@@ -86,7 +102,14 @@ jobs:
86102
_R_CHECK_CRAN_INCOMING_REMOTE_: false
87103
_R_CHECK_TESTS_NLINES_: 0
88104
run: |
89-
options(crayon.enabled = TRUE)
105+
options(crayon.enabled=TRUE)
106+
dir.create("~/.R", showWarnings=FALSE)
107+
# suppress noisy Annotation for e.g. {hexbin} about tabs v. spaces
108+
cat("FCFLAGS += -Wno-tabs\nFFLAGS += -Wno-tabs\n", file="~/.R/Makevars", append=TRUE)
109+
# e.g. Annotation about lacking macosx binaries: bin/macosx/sonoma-arm64/contrib/4.7
110+
if (grepl("Under development", R.version$status)) options(pkgType="source")
111+
# to avoid Annotation about certain packages being unavailable, use this old snapshot repo
112+
if (getRversion() < "3.6") options(repos=c(CRAN="https://packagemanager.posit.co/cran/2020-04-24"))
90113
message("*** Using the following repos for installation ***")
91114
print(getOption("repos"))
92115
message("*** Installing Suggested packages ***")
@@ -102,10 +125,14 @@ jobs:
102125
103126
has_other_pkg = sapply(other_pkgs, requireNamespace, quietly=TRUE)
104127
run_other = all(has_other_pkg)
105-
if (!run_other) {
128+
if (run_other) {
129+
desc = read.dcf("DESCRIPTION")
130+
desc[1L, "Suggests"] = toString(unique(c(desc[1, "Suggests"], other_pkgs)))
131+
write.dcf(desc, "DESCRIPTION")
132+
message("Setting TEST_DATA_TABLE_WITH_OTHER_PACKAGES=TRUE to run other.Rraw")
133+
} else {
106134
message(sprintf("Skipping other.Rraw since some required packages are not available: %s\n", toString(other_pkgs[!has_other_pkg])))
107135
}
108-
message("Will try and set TEST_DATA_TABLE_WITH_OTHER_PACKAGES=", as.character(run_other), " in R CMD check.")
109136
# IINM rcmdcheck isolates its env from the calling process', besides what's passed to env=
110137
env = c(
111138
TEST_DATA_TABLE_WITH_OTHER_PACKAGES=as.character(run_other)
@@ -128,7 +155,7 @@ jobs:
128155
dt_tar = list.files(pattern = "^data[.]table_.*[.]tar[.]gz$")
129156
if (!length(dt_tar)) stop("Built tar.gz not found among: ", toString(list.files()))
130157
res = system2(Rbin, c("CMD", "check", dt_tar[1L], check_args), stdout=TRUE, stderr=TRUE, env=sprintf("%s=%s", names(env), env))
131-
if (!is.null(attr(res, "status")) || is.na(res) || grep("^Status:.*(ERROR|WARNING)", res)) {
158+
if (!is.null(attr(res, "status")) || anyNA(res) || any(grepl("^Status:.*(ERROR|WARNING)", res))) {
132159
writeLines(as.character(res))
133160
stop("R CMD check failed")
134161
}

0 commit comments

Comments
 (0)