@@ -83,29 +83,14 @@ jobs:
8383 if : matrix.os == 'ubuntu-latest'
8484 run : |
8585 sudo locale-gen "${{ matrix.locale }}"
86- echo "LC_ALL=${{ matrix.locale }}" >> $GITHUB_ENV
87- echo "LANGUAGE=$(echo '${{ matrix.locale }}' | cut -d'.' -f1)" >> $GITHUB_ENV
86+ echo "R_CMD_CHECK_LC_ALL=${{ matrix.locale }}" >> $GITHUB_ENV
8887
8988 - uses : actions/checkout@v7
9089
9190 - uses : r-lib/actions/setup-r@v2
9291 with :
9392 r-version : ${{ matrix.r }}
9493
95- - name : Override Rscript for locale-specific check
96- if : matrix.os == 'ubuntu-latest' && !contains(matrix.locale, 'utf8')
97- run : |
98- RSCRIPT_PATH="$HOME/.local/bin"
99- mkdir -p "$RSCRIPT_PATH"
100- echo "$RSCRIPT_PATH" >> "$GITHUB_PATH"
101- target="$RSCRIPT_PATH/Rscript"
102- tee "$target" << EOF
103- #!/bin/bash
104- set -o pipefail
105- exec "$(which Rscript)" "\$@" 2>&1 | iconv -c -t UTF-8
106- EOF
107- chmod +x "$target"
108-
10994 - name : Set script permissions
11095 run : chmod +x configure cleanup 2>/dev/null || true # Silence some GHA Annotations
11196 shell : bash
@@ -183,14 +168,19 @@ jobs:
183168 build_args = "--no-build-vignettes"
184169 check_args = c(check_args, "--no-build-vignettes", "--ignore-vignettes")
185170 }
186- if (requireNamespace("rcmdcheck", quietly=TRUE)) {
171+ if (nzchar(locale <- Sys.getenv("R_CMD_CHECK_LC_ALL"))) # only set on Linux
172+ Sys.setenv(LC_ALL = locale) # for the child process
173+ utf8locale = grepl("utf8", locale)
174+ if (requireNamespace("rcmdcheck", quietly=TRUE) && utf8locale) {
187175 rcmdcheck::rcmdcheck(args=check_args, build_args=build_args, error_on="warning", check_dir="check")
188176 } else {
189177 Rbin = if (.Platform$OS.type == "windows") "R.exe" else "R"
190178 system2(Rbin, c("CMD", "build", ".", build_args))
191179 dt_tar = list.files(pattern = "^data[.]table_.*[.]tar[.]gz$")
192180 if (!length(dt_tar)) stop("Built tar.gz not found among: ", toString(list.files()))
193181 res = system2(Rbin, c("CMD", "check", dt_tar[1L], check_args), stdout=TRUE, stderr=TRUE)
182+ if (!utf8locale)
183+ res = structure(iconv(res, sub(".*[.]", "", locale), "UTF-8", "byte"), status = attr(res, "status"))
194184 if (!is.null(attr(res, "status")) || anyNA(res) || any(grepl("^Status:.*(ERROR|WARNING)", res))) {
195185 writeLines(as.character(res))
196186 stop("R CMD check failed")
0 commit comments