perf: seed pure-R binaries into a new slot, interleave shards, and stop builds before the timeout

- Add local/seed-pure-r.R, opt-in via SEED_FROM on install-deps: copy pure-R
  binaries server-side from a slot of the same OS family and arch, after
  verifying each is a binary, has no compiled code, was built by the primary
  R minor, and passes bincraft's cross-minor ABI check; write the
  single_builds and abi_flat_safety rows an upload would.
- Interleave build-all shards with shard_slice() instead of contiguous
  alphabetical blocks, which ranged from 0.1h to 28h per shard.
- Share one BUILD_DEADLINE (BUILD_BUDGET_HOURS, default 44h) across every
  build pass of a build-all-versions step so long runs stop cleanly and
  still archive and index what they built.
- Derive the single_builds platform with codename_platform() instead of a
  hard-coded list.
This commit is contained in:
Patrick Schratz 2026-10-24 01:58:25 +00:00
commit cdfdcd035d
No known key found for this signature in database
GPG key ID: 62050D5BC68AB6DC

View file

@ -31,3 +31,33 @@ parse_build_args <- function(args) {
ncpus = as.integer(pos[3L])
)
}
# The `single_builds` platform name for a bincraft codename, e.g. alpine324 ->
# "alpine-324", rhel9 -> "redhat-9". NA for a codename this repo does not build.
codename_platform <- function(codename) {
ubuntu <- c(jammy = "2204", noble = "2404", resolute = "2604")
if (codename %in% names(ubuntu)) {
return(paste0("ubuntu-", ubuntu[[codename]]))
}
if (grepl("^rhel[0-9]+$", codename)) {
return(sub("^rhel", "redhat-", codename))
}
if (grepl("^alpine[0-9]+$", codename)) {
return(sub("^alpine", "alpine-", codename))
}
NA_character_
}
# The wall-clock deadline a build loop must stop at, from BUILD_DEADLINE (epoch
# seconds). The pipeline sets it once per step, so every pass in the step shares
# one budget and the steps after the builds (archiving, the index upload) still
# get to run before Crow's timeout kills the step. Unset or unparsable means no
# deadline.
build_deadline <- function(value = Sys.getenv("BUILD_DEADLINE", unset = "")) {
deadline <- suppressWarnings(as.numeric(value))
if (length(deadline) != 1L || is.na(deadline)) Inf else deadline
}
deadline_reached <- function(deadline, now = as.numeric(Sys.time())) {
now >= deadline
}