-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Currently, the Lint Changed Files workflow is erroring out for commits that include .R files—see, e.g. https://github.com/stdlib-js/stdlib/actions/runs/22865163230/job/66329844383?pr=10805#step:19:277, where you get a warning and then an error that: package ‘lintr’ is not available (for R version 3.5.3).
Problem
The current Lint Changed Files workflow for R is:
stdlib/.github/workflows/lint_changed_files.yml
Lines 271 to 287 in 7e2e27a
| # Setup R: | |
| - name: 'Setup R' | |
| if: ( success() || failure() ) && steps.check-r-files.outputs.files != '' | |
| # Pin action to full length commit SHA | |
| uses: r-lib/actions/setup-r@6f6e5bc62fba3a704f74e7ad7ef7676c5c6a2590 # v2.11.4 | |
| with: | |
| r-version: '3.5.3' | |
| # Lint R files: | |
| - name: 'Lint R files' | |
| if: ( success() || failure() ) && steps.check-r-files.outputs.files != '' | |
| run: | | |
| # Install R dependencies: | |
| make install-deps-r | |
| # Lint R files: | |
| make lint-r-files FILES="${{ steps.check-r-files.outputs.files }}" |
We use the setup-r GitHub action where we can specify the R version with: r-version: '3.5.3' for R installation , and then use the stdlib make commands for install-deps-r and lint-r-files.
stdlib/tools/make/lib/install/r_deps.mk
Lines 38 to 39 in 7e2e27a
| install-deps-r: | |
| $(QUIET) $(CAT) $(R_REQUIREMENTS) | xargs $(R_INSTALL_PKGS_CMD) |
The install-deps-r command uses two stdlib files: tools/scripts/install_r_pkgs.R and etc/r/requirements.txt, which just loops install.packages() over the packages listed in requirements, which means they're trying to use the latest versions of those packages.
The latest versions of both lintr and VGAM have R (>= 4.1.0) in their Depends.
Solutions
Use older package versions
One option would be to install older versions of lintr and VGAM. For lintr, Depends went to R (>= 3.5.0) in lintr 3.1.0, and, based on the VGAM NEWS file, it looks like the bump to 4.1.0 happened in 1.1-12 (so VGAM version 1.1-11 should work).
1. Keep install-deps-r, use remotes::install_version()
To install older package versions you could keep the current make target and use remotes::install_version() which would require the remotes package (which should be fine, since it only depends on R 3.0). This would need a modified version of the stdlib install_r_packages.R that uses two arguments from requirements.txt when needed—you'd add specified versions for lintr and vgam (e..g lintr==3.1.0) and split those to specify the version argument in install_version(). You'd need to point the repo argument to a CRAN archive or tagged GitHub release, which is easy enough.
2. Download and install versioned packages from source with install.packages()
Basically, point to the CRAN archive for each version, e.g. https://cran.r-project.org/src/contrib/Archive/VGAM/VGAM_1.1-1.tar.gz, and download it as packageurl and install.packages(packageurl, repos = NULL, type = "source").
3. Use the setup-r-dependencies action
The r-lib action setup-r-dependencies uses pak::pak() for installation, which can be pointed to snapshots of CRAN to install old package versions. Currently, you're good with R 3.5.0 for that.
Use newer R version
Update the version of R we install
Change the r-version argument in the setup-r action to r-version: '4.1.0'.
Since lintr, remotes, and pak are all r-lib packages, this would let us update R versions if needed (technically, the tidyverse/r-lib R-version-support cycle could bump their minimums to 4.2.0 this Spring).