Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
^doc$
^Meta$
^README\.Rmd$
^rv$
^rproject\.toml$
^rv\.lock$
^\.Rprofile$

2 changes: 2 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source("rv/scripts/rvr.R")
source("rv/scripts/activate.R")
23 changes: 13 additions & 10 deletions .github/workflows/RunChecks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: '4.5'}
- {os: ubuntu-latest, r: '4.4'}
- {os: ubuntu-latest, r: '4.3'}
- {os: ubuntu-latest, r: '4.2'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -63,15 +64,17 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
metrumresearchgroup/mrgmisc
metrumresearchgroup/nmrec
metrumresearchgroup/bbr
any::rcmdcheck
needs: check

- uses: a2-ai/setup-rv@main
- name: replace-rversion
run: |
# we need to replace r_version = "4.x" with the matrixed R version
sed -i -E 's|^r_version = "4\.[0-9\.]+"$|r_version = "'"${{ matrix.config.r }}"'"|' rproject.toml
- name: rv-plan
run: |
rv plan
- name: rv-sync
run: |
rv sync
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: 4.4

- name: Download mocked binaries
run: |
Expand Down Expand Up @@ -58,15 +59,17 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
metrumresearchgroup/mrgmisc
metrumresearchgroup/nmrec
metrumresearchgroup/bbr
any::pkgdown
local::.
needs: website
- uses: a2-ai/setup-rv@main
# - name: replace-rversion
# run: |
# # we need to replace r_version = "4.x" with the matrixed R version
# sed -i -E 's|^r_version = "4\.[0-9\.]+"$|r_version = "'"${{ matrix.config.r }}"'"|' rproject.toml
- name: rv-plan
run: |
rv plan
- name: rv-sync
run: |
rv sync

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion R/attach.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ slurmtools_options_message <- function() {
} else {
set_options <- c(
set_options,
paste("slurmtools.slurm_jon_template_path:", tmpl_path)
paste("slurmtools.slurm_job_template_path:", tmpl_path)
)
}

Expand Down
19 changes: 19 additions & 0 deletions rproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use_lockfile = false

[project]
name = "slurmtools"
r_version = "4.4"

repositories = [
# use this to constantly be dealing with "whats next" - can always switch to pinned version"
{alias = "ppm", url = "https://packagemanager.posit.co/cran/latest"},
{alias = "prism", url = "https://prism.dev.a2-ai.cloud/rpkgs/stratus/2025-05-09"},
]

dependencies = [
{name = "slurmtools", dependencies_only = true, path = ".", install_suggestions = true},
"pkgbuild",
"pkgdown",
"rcmdcheck",
]

2 changes: 2 additions & 0 deletions rv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
library
__rv__staging
33 changes: 33 additions & 0 deletions rv/scripts/activate.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local({
rv_info <- system2("rv", c("info", "--library", "--r-version", "--repositories"), stdout = TRUE)
if (!is.null(attr(rv_info, "status"))) {
# if system2 fails it'll add a status attribute with the error code
warning("failed to run rv info, check your console for messages")
} else {
# extract library, r-version, and repositories from rv
rv_lib <- sub("library: (.+)", "\\1", grep("^library:", rv_info, value = TRUE))
rv_r_ver <- sub("r-version: (.+)", "\\1", grep("^r-version:", rv_info, value = TRUE))
repo_str <- sub("repositories: ", "", grep("^repositories:", rv_info, value = TRUE))
repo_entries <- gsub("[()]", "", strsplit(repo_str, "), (", fixed = TRUE)[[1]])
repo_list <- trimws(sub(".*, ", "", repo_entries)) # Extract URL
names(repo_list) <- trimws(sub(", .*", "", repo_entries)) # Extract Name
# this might not yet exist, so we'll normalize it but not force it to exist
# and we create it below as needed
rv_lib <- normalizePath(rv_lib, mustWork = FALSE)
if (!dir.exists(rv_lib)) {
message("creating rv library: ", rv_lib)
dir.create(rv_lib, recursive = TRUE)
}
.libPaths(rv_lib, include.site = FALSE)
options(repos = repo_list)

if (interactive()) {
message("rv libpaths active!\nlibrary paths: \n", paste0(" ", .libPaths(), collapse = "\n"), "\n")
message("rv repositories active!\nrepositories: \n", paste0(" ", names(getOption("repos")), ": ", getOption("repos"), collapse = "\n"))
sys_r <- sprintf("%s.%s", R.version$major, R.version$minor)
if (!grepl(paste0("^", rv_r_ver), sys_r)) {
message(sprintf("\nWARNING: R version specified in config (%s) does not match session version (%s)", rv_r_ver, sys_r))
}
}
}
})
26 changes: 26 additions & 0 deletions rv/scripts/rvr.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.rv <- new.env()
.rv$config_path <- file.path(normalizePath(getwd()), "rproject.toml")
.rv$summary <- function(json = FALSE) {
command <- c("summary")
if (json) { command <- c(command, "--json") }
.rv$command(command)
}
.rv$plan <- function() { .rv$command("plan") }
.rv$sync <- function() { .rv$command("sync") }
.rv$add <- function(..., dry_run = FALSE) {
dots <- unlist(list(...))
command <- c("add", dots)
if (dry_run) { command <- c(command, "--dry-run") }
.rv$command(command)
}

.rv$command <- function(command) {
# underlying system calls to rv
args <- c(command, "-c", .rv$config_path)
res <- system2("rv", args, stdout = TRUE)
if (!is.null(attr(res, "status"))) {
warning(sprintf("failed to run `rv %s`, check your console for messages", paste(args, collapse = " ")))
} else {
message(paste(res, collapse = "\n"))
}
}
Loading