-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GitHub Action for non-UTF-8 locales #7821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+47
−24
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d20dd3c
GHA: add locale-specific checks
aitap c2aeade
Drop unnecessary environment variables
aitap e5b3b62
Put encoding configs in R-CMD-check-occasional, enabling them for now
MichaelChirico 0a3723f
leave ISO-8859-1 implicit for fr_CA
MichaelChirico b465638
Gemini: iconv to prevent gibberish in GHA logs
MichaelChirico 61293b7
Gemini: try iconv directly on the 'Check' step
MichaelChirico 2a36892
Gemini: back to overwriting R binary, but using R.home() for subproce…
MichaelChirico c9ec1fb
Install dependencies and build in current locale
aitap fed7e50
Set fr_CA.ISO-8859-1 explicitly, just in case
aitap dc269ad
Do use rcmdcheck on non-Linux
aitap c1caf54
Merge branch 'master' into GHA-locales
MichaelChirico 49aa53c
Use /etc/locale.gen for extra locales
aitap 064e8c7
Use UTF-8 instead of utf8 as the encoding name
aitap 5ef63e6
disable on push again
MichaelChirico e643f8f
explanatory comment for posterity
MichaelChirico ce09354
tweak
MichaelChirico add165a
partial revert
MichaelChirico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,46 +17,60 @@ jobs: | |
| matrix: | ||
| os: [macOS-latest, windows-latest, ubuntu-latest] | ||
| r: ['devel', 'release', '3.5', '3.6', '4.0', '4.1', '4.2', '4.3', '4.4', '4.5'] | ||
| locale: ['en_US.utf8', | ||
| locale: ['en_US.UTF-8', | ||
| # Multibyte characters: Mandarin | ||
| 'zh_CN.utf8', | ||
| 'zh_CN.UTF-8', | ||
| # Encoding: non-UTF-8 locales for French, Mandarin, and Russian | ||
| 'fr_CA.ISO-8859-1', 'zh_CN.GB18030', 'ru_RU.KOI8-R', | ||
| # Collate order (#3502, see also #7837): Latvian, Azeri, Hungarian, Faroese, Albanian | ||
| 'lv_LV.utf8', 'az_AZ.utf8', 'hu_HU.utf8', 'fo_FO.utf8', 'sq_MK.utf8', | ||
| 'lv_LV.UTF-8', 'az_AZ.UTF-8', 'hu_HU.UTF-8', 'fo_FO.UTF-8', 'sq_MK.UTF-8', | ||
| # Local time formatting (for R bug #19117) | ||
| 'vi_VN.utf8'] | ||
| 'vi_VN.UTF-8'] | ||
| # we're constrained by GHA inflexibility to do a tedious thing here with 'exclude' below. | ||
| # better would be for GHA to support multiple 'matrix' configs (one for ubuntu, one for other OS); | ||
| # an approach with multiple jobs would tediously require copy-pasting the _rest_ of the steps | ||
| exclude: | ||
| # only run non-English locale CI on Ubuntu | ||
| - os: macOS-latest | ||
| locale: 'zh_CN.utf8' | ||
| locale: 'zh_CN.UTF-8' | ||
| - os: macOS-latest | ||
| locale: 'lv_LV.utf8' | ||
| locale: 'fr_CA.ISO-8859-1' | ||
| - os: macOS-latest | ||
| locale: 'az_AZ.utf8' | ||
| locale: 'zh_CN.GB18030' | ||
| - os: macOS-latest | ||
| locale: 'hu_HU.utf8' | ||
| locale: 'ru_RU.KOI8-R' | ||
| - os: macOS-latest | ||
| locale: 'fo_FO.utf8' | ||
| locale: 'lv_LV.UTF-8' | ||
| - os: macOS-latest | ||
| locale: 'sq_MK.utf8' | ||
| locale: 'az_AZ.UTF-8' | ||
| - os: macOS-latest | ||
| locale: 'vi_VN.utf8' | ||
| locale: 'hu_HU.UTF-8' | ||
| - os: macOS-latest | ||
| locale: 'fo_FO.UTF-8' | ||
| - os: macOS-latest | ||
| locale: 'sq_MK.UTF-8' | ||
| - os: macOS-latest | ||
| locale: 'vi_VN.UTF-8' | ||
| - os: windows-latest | ||
| locale: 'zh_CN.UTF-8' | ||
| - os: windows-latest | ||
| locale: 'fr_CA.ISO-8859-1' | ||
| - os: windows-latest | ||
| locale: 'zh_CN.GB18030' | ||
| - os: windows-latest | ||
| locale: 'zh_CN.utf8' | ||
| locale: 'ru_RU.KOI8-R' | ||
| - os: windows-latest | ||
| locale: 'lv_LV.utf8' | ||
| locale: 'lv_LV.UTF-8' | ||
| - os: windows-latest | ||
| locale: 'az_AZ.utf8' | ||
| locale: 'az_AZ.UTF-8' | ||
| - os: windows-latest | ||
| locale: 'hu_HU.utf8' | ||
| locale: 'hu_HU.UTF-8' | ||
| - os: windows-latest | ||
| locale: 'fo_FO.utf8' | ||
| locale: 'fo_FO.UTF-8' | ||
| - os: windows-latest | ||
| locale: 'sq_MK.utf8' | ||
| locale: 'sq_MK.UTF-8' | ||
| - os: windows-latest | ||
| locale: 'vi_VN.utf8' | ||
| locale: 'vi_VN.UTF-8' | ||
| # macOS/arm64 only available for R>=4.1.0 | ||
| - os: macOS-latest | ||
| r: '3.5' | ||
|
|
@@ -75,9 +89,12 @@ jobs: | |
| - name: Set locale | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: | | ||
| sudo locale-gen "${{ matrix.locale }}" | ||
| echo "LC_ALL=${{ matrix.locale }}" >> $GITHUB_ENV | ||
| echo "LANGUAGE=$(echo '${{ matrix.locale }}' | cut -d'.' -f1)" >> $GITHUB_ENV | ||
| LOCALE="${{ matrix.locale }}" | ||
| echo "$LOCALE ${LOCALE#*.}" | sudo tee -a /etc/locale.gen | ||
| sudo locale-gen --keep-existing | ||
| # don't set LC_ALL yet -- it interferes with installation of other packages sometimes. | ||
| # only do so immediately before R CMD check | ||
| echo "R_CMD_CHECK_LC_ALL=${{ matrix.locale }}" >> $GITHUB_ENV | ||
|
MichaelChirico marked this conversation as resolved.
|
||
|
|
||
| - uses: actions/checkout@v7 | ||
|
|
||
|
|
@@ -162,16 +179,22 @@ jobs: | |
| build_args = "--no-build-vignettes" | ||
| check_args = c(check_args, "--no-build-vignettes", "--ignore-vignettes") | ||
| } | ||
| if (requireNamespace("rcmdcheck", quietly=TRUE)) { | ||
| testing_locale = Sys.getenv("R_CMD_CHECK_LC_ALL") # only set on Linux | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be slightly nicer to have UTF-8 returned by default here? I'm also thinking to invert it to avoid |
||
| if (nzchar(testing_locale)) Sys.setenv(LC_ALL = testing_locale) | ||
| non_utf8_locale = nzchar(testing_locale) && !grepl("UTF-8", testing_locale) | ||
| if (requireNamespace("rcmdcheck", quietly=TRUE) && !non_utf8_locale) { | ||
| rcmdcheck::rcmdcheck(args=check_args, build_args=build_args, error_on="warning", check_dir="check") | ||
| } else { | ||
| Rbin = if (.Platform$OS.type == "windows") "R.exe" else "R" | ||
| system2(Rbin, c("CMD", "build", ".", build_args)) | ||
| dt_tar = list.files(pattern = "^data[.]table_.*[.]tar[.]gz$") | ||
| if (!length(dt_tar)) stop("Built tar.gz not found among: ", toString(list.files())) | ||
| res = system2(Rbin, c("CMD", "check", dt_tar[1L], check_args), stdout=TRUE, stderr=TRUE) | ||
| if (!is.null(attr(res, "status")) || anyNA(res) || any(grepl("^Status:.*(ERROR|WARNING)", res))) { | ||
| writeLines(as.character(res)) | ||
| status = attr(res, "status") | ||
| if (non_utf8_locale) | ||
| res = iconv(res, sub(".*[.]", "", testing_locale), "UTF-8", "byte") | ||
| writeLines(res, useBytes = TRUE) | ||
| if (!is.null(status) || anyNA(res) || any(grepl("^Status:.*(ERROR|WARNING)", res))) { | ||
| stop("R CMD check failed") | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.