iconv to prevent gibberish in GHA logs #106
Workflow file for this run
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
| on: | |
| push: | |
| schedule: | |
| - cron: '17 13 23 * *' # 23rd of month at 13:17 UTC | |
| workflow_dispatch: | |
| # A more complete suite of checks to run monthly; each PR/merge need not pass all these, but they should pass before CRAN release | |
| name: R-CMD-check-occasional | |
| jobs: | |
| R-CMD-check-occasional: | |
| runs-on: ${{ matrix.os }} | |
| name: ${{ matrix.os }} (${{ matrix.r }}, ${{ matrix.locale }}) | |
| strategy: | |
| fail-fast: false | |
| 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', | |
| # Multibyte characters: Mandarin | |
| 'zh_CN.utf8', | |
| # Encoding: non-UTF-8 locales for French, Mandarin, and Russian | |
| 'fr_CA', 'zh_CN.GB18030', 'ru_RU.KOI8-R', # fr_CA is implicitly 'ISO-8859-1' | |
| # 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', | |
| # Local time formatting (for R bug #19117) | |
| 'vi_VN.utf8'] | |
| # 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' | |
| - os: macOS-latest | |
| locale: 'fr_CA.ISO-8859-1' | |
| - os: macOS-latest | |
| locale: 'zh_CN.GB18030' | |
| - os: macOS-latest | |
| locale: 'ru_RU.KOI8-R' | |
| - os: macOS-latest | |
| locale: 'lv_LV.utf8' | |
| - os: macOS-latest | |
| locale: 'az_AZ.utf8' | |
| - os: macOS-latest | |
| locale: 'hu_HU.utf8' | |
| - os: macOS-latest | |
| locale: 'fo_FO.utf8' | |
| - os: macOS-latest | |
| locale: 'sq_MK.utf8' | |
| - os: macOS-latest | |
| locale: 'vi_VN.utf8' | |
| - os: windows-latest | |
| locale: 'zh_CN.utf8' | |
| - os: windows-latest | |
| locale: 'fr_CA.ISO-8859-1' | |
| - os: windows-latest | |
| locale: 'zh_CN.GB18030' | |
| - os: windows-latest | |
| locale: 'ru_RU.KOI8-R' | |
| - os: windows-latest | |
| locale: 'lv_LV.utf8' | |
| - os: windows-latest | |
| locale: 'az_AZ.utf8' | |
| - os: windows-latest | |
| locale: 'hu_HU.utf8' | |
| - os: windows-latest | |
| locale: 'fo_FO.utf8' | |
| - os: windows-latest | |
| locale: 'sq_MK.utf8' | |
| - os: windows-latest | |
| locale: 'vi_VN.utf8' | |
| # macOS/arm64 only available for R>=4.1.0 | |
| - os: macOS-latest | |
| r: '3.5' | |
| - os: macOS-latest | |
| r: '3.6' | |
| - os: macOS-latest | |
| r: '4.0' | |
| - os: macOS-latest | |
| r: '4.1' | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| RUN_ALL_DATATABLE_TESTS: yes | |
| steps: | |
| - 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 | |
| - uses: actions/checkout@v7 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: ${{ matrix.r }} | |
| - name: Override R for locale-specific check | |
| if: matrix.os == 'ubuntu-latest' && !contains(matrix.locale, 'utf8') | |
| run: | | |
| sudo mkdir -p /override | |
| sudo tee /override/R << 'EOF' | |
| #!/bin/bash | |
| set -o pipefail | |
| exec $(which R) "$@" 2>&1 | iconv -c -t UTF-8 | |
| EOF | |
| sudo chmod +x /override/R | |
| echo "PATH=/override:$PATH" >> $GITHUB_ENV | |
| - name: Set script permissions | |
| run: chmod +x configure cleanup 2>/dev/null || true # Silence some GHA Annotations | |
| shell: bash | |
| - name: Install check dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev pandoc | |
| - name: Pre-untap untrusted Homebrew taps on macOS | |
| if: matrix.os == 'macOS-latest' | |
| run: brew untap aws/tap 2>/dev/null || true | |
| - name: Install R Package Build Dependencies on MacOS | |
| if: matrix.os == 'macOS-latest' | |
| uses: r-hub/actions/setup-r-sysreqs@v1 | |
| with: | |
| type: 'minimal' | |
| - name: Install check dependencies (macOS) | |
| if: matrix.os == 'macOS-latest' | |
| run: | | |
| brew install gdal proj gettext | |
| brew link --overwrite --force gettext 2>/dev/null || true | |
| - name: Check | |
| env: | |
| # several Suggests dependencies have R dependencies more recent than ours | |
| _R_CHECK_FORCE_SUGGESTS_: false | |
| _R_CHECK_CRAN_INCOMING_REMOTE_: false | |
| _R_CHECK_TESTS_NLINES_: 0 | |
| run: | | |
| options(crayon.enabled=TRUE) | |
| dir.create("~/.R", showWarnings=FALSE) | |
| # suppress noisy Annotation for e.g. {hexbin} about tabs v. spaces | |
| cat("FCFLAGS += -Wno-tabs\nFFLAGS += -Wno-tabs\n", file="~/.R/Makevars", append=TRUE) | |
| # e.g. Annotation about lacking macosx binaries: bin/macosx/sonoma-arm64/contrib/4.7 | |
| if (grepl("Under development", R.version$status)) options(pkgType="source") | |
| # to avoid Annotation about certain packages being unavailable, use this old snapshot repo | |
| if (getRversion() < "3.6") options(repos=c(CRAN="https://packagemanager.posit.co/cran/2020-04-24")) | |
| message("*** Using the following repos for installation ***") | |
| print(getOption("repos")) | |
| message("*** Installing Suggested packages ***") | |
| sugg <- names(tools:::.split_dependencies(read.dcf("DESCRIPTION", "Suggests"))) | |
| install.packages(sugg) | |
| other_deps_expr = parse('inst/tests/other.Rraw', n=1L) | |
| eval(other_deps_expr) | |
| other_pkgs = setdiff( | |
| get(as.character(other_deps_expr[[1:2]])), | |
| tools:::.get_standard_package_names()$base) # skip parallel | |
| # Many will not install on oldest R versions | |
| message("*** Installing fully optional packages ***") | |
| try(install.packages(c(other_pkgs, "rcmdcheck"))) | |
| has_other_pkg = sapply(other_pkgs, requireNamespace, quietly=TRUE) | |
| run_other = all(has_other_pkg) | |
| if (run_other) { | |
| desc = read.dcf("DESCRIPTION") | |
| desc[1L, "Suggests"] = toString(unique(c(desc[1, "Suggests"], other_pkgs))) | |
| write.dcf(desc, "DESCRIPTION") | |
| message("Setting TEST_DATA_TABLE_WITH_OTHER_PACKAGES=TRUE to run other.Rraw") | |
| } else { | |
| message(sprintf("Skipping other.Rraw since some required packages are not available: %s\n", toString(other_pkgs[!has_other_pkg]))) | |
| } | |
| Sys.setenv(TEST_DATA_TABLE_WITH_OTHER_PACKAGES=as.character(run_other)) | |
| do_vignettes = requireNamespace("litedown", quietly=TRUE) | |
| build_args = NULL | |
| check_args = c("--no-manual", "--as-cran") | |
| if (!do_vignettes) { | |
| message("Skipping vignettes since knitr is unavailable.") | |
| build_args = "--no-build-vignettes" | |
| check_args = c(check_args, "--no-build-vignettes", "--ignore-vignettes") | |
| } | |
| if (requireNamespace("rcmdcheck", quietly=TRUE)) { | |
| 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)) | |
| stop("R CMD check failed") | |
| } | |
| } | |
| shell: Rscript {0} | |
| - name: Upload check results | |
| if: failure() | |
| uses: actions/upload-artifact@main | |
| with: | |
| name: ${{ runner.os }}-r${{ matrix.r }}-l${{ matrix.locale }}results | |
| path: check |