
Create a Rust-compatible R-CMD-check Workflow
Source:R/42C_use_workflow_rust_compatible_check.R
use_workflow_rust_compatible_check.RdCopies the built-in R-CMD-Check.yaml workflow template to the target
package's .github/workflows/ directory, so that R CMD check runs on
GitHub Actions with a toolchain that can download, compile and link Rust
crates (packages built on extendr/rextendr).
Why not the usethis workflow
usethis::use_github_action("check-standard") only sets up R and then calls
R CMD check on a matrix of operating systems. For packages with Rust code
this is not enough:
No Rust toolchain is installed, so the runner default is used. On Windows that default is an MSVC toolchain, while R and Rtools are GNU based, so the static library produced by
cargocannot be linked, and the resulting build noise (cargowarnings, linker messages) makesR CMD checkreport a WARNING.
The template used here follows the official extendr CI:
dtolnay/rust-toolchaininstalls the requested toolchain, and on Windows additionally thex86_64-pc-windows-gnutarget that Rtools can link.The R matrix covers Windows, macOS, Ubuntu release and Ubuntu devel, with
fail-fast: falseso one broken platform does not hide the others.R_REMOTES_NO_ERRORS_FROM_WARNINGSkeepsremotes/pakdownload noise from turning into check failures.
Examples
if (FALSE) { # \dontrun{
temp <- tempdir()
usethis::create_package(temp)
use_workflow_rust_compatible_check(temp)
use_workflow_rust_compatible_check(temp, overwrite = TRUE)
} # }