This commit is contained in:
Patrick Schratz 2024-07-26 11:06:53 +02:00
commit 165e88a660
Signed by: pat-s
GPG key ID: 3C6318841EF78925
4 changed files with 21 additions and 8 deletions

View file

@ -29,12 +29,12 @@ steps:
# download latest package version (avoid having to rebuild image every time)
# rscript_startup arg: required to pass down global option to future workers https://github.com/HenrikBengtsson/future/issues/134#issuecomment-2245666169
- git clone https://pat-s:$$git_ro_token@git.devxy.io/devxy/arm64-r-binaries.git && cd arm64-r-binaries
- R -q -e 'install.packages(".", repos = NULL, quiet = FALSE); packageVersion("rBinaries")'
- R -q -e 'install.packages(".", repos = NULL, quiet = TRUE); packageVersion("rBinaries")'
# manually install some packages into the cache so that some builds don't fail
# Hmisc -> ABCanalysis
# - R -q -e 'pak::pak("Hmisc")'
- mkdir -p /mnt/cache/pkgcache /mnt/cache/R-pkgs
- R -q -e 'options(crayon.enabled = TRUE, Ncpus = 4, future.globals.onReference = "error"); pkgs = tools::CRAN_package_db()[[1]][3:3]; library(rBinaries); future::plan("multisession", workers = 4, rscript_startup = quote(options(crayon.enabled = TRUE))); foo = lapply(pkgs, function(x) build_binary_package(x, build_for_minor=FALSE, debug = FALSE, force = TRUE))'
- R -q -e 'options(crayon.enabled = TRUE, Ncpus = 4, future.globals.onReference = "error"); pkgs = tools::CRAN_package_db()[[1]][3:3]; library(rBinaries); future::plan("multisession", workers = 4, rscript_startup = quote(options(crayon.enabled = TRUE))); foo = lapply(pkgs, function(x) build_binary_package(x, build_for_minor=FALSE, debug = TRUE, force = TRUE))'
backend_options:
kubernetes:
resources:

View file

@ -195,6 +195,11 @@ build_single_tag <- function(
# bytes to MB in binary format
file_size <- round(as.numeric(fs::file_size(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) / (1024^2), 2)
if (debug) {
cli::cli_alert_warning("DEBUG: total_build_time: {total_build_time}")
cli::cli_alert_warning("DEBUG: file_size: {file_size}")
}
# skip DB connection if package already exists
if (file.exists(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) {
con <- DBI::dbConnect(RPostgres::Postgres(),

View file

@ -8,8 +8,6 @@ add_to_package_index <- function(
bucket = "devxy-arm64-r-binaries",
codename = NULL, r_minor_version = NULL,
build_for_minor = FALSE) {
cli::cli_h2("Building package index")
codename <- set_codename(codename)
if (is.null(r_minor_version)) {
r_minor_version <- sub("R version (\\d+\\.\\d+).*", "\\1", R.Version()$version.string)
@ -40,15 +38,25 @@ add_to_package_index <- function(
cranlike::add_PACKAGES(file_names, local_bin_dir)
cli::cli_alert("{.fun create_package_index}: Uploading PACKAGES* files to S3.")
purrr::walk2(
dummy <- purrr::walk2(
sprintf("%s/%s", local_bin_dir, c("PACKAGES.db", "PACKAGES.rds", "PACKAGES.gz")),
sprintf("%s/%s", remote_bin_dir, c("PACKAGES.db", "PACKAGES.rds", "PACKAGES.gz")),
\(x, y) s3fs::s3_file_upload(x, y, overwrite = TRUE)
)
s3fs::s3_file_upload(sprintf("%s/PACKAGES", local_bin_dir), sprintf("%s/PACKAGES", remote_bin_dir), overwrite = TRUE)
pkgs_upload_local <- sprintf("%s/PACKAGES", local_bin_dir)
pkgs_upload_remote <- sprintf("%s/PACKAGES", remote_bin_dir)
if (debug) {
cli::cli_alert_danger("DEBUG: PACKAGES UPLOAD local dir: {pkgs_upload_local}")
cli::cli_alert_danger("DEBUG: PACKAGES UPLOAD remote dir: {pkgs_upload_remote}")
}
dummy <- s3fs::s3_file_upload(pkgs_upload_local, pkgs_upload_remote, overwrite = TRUE)
# s3fs::s3_file_upload(
# sprintf("%s/%s", local_bin_dir, c("PACKAGES", "PACKAGES.db", "PACKAGES.rds", "PACKAGES.gz")),
# sprintf("%s", remote_bin_dir, c("PACKAGES", "PACKAGES.db", "PACKAGES.rds", "PACKAGES.gz")),
# overwrite = TRUE
# )
return(invisible(TRUE))
}

View file

@ -19,8 +19,8 @@ upload_single_binary_to_s3 <- function(
remote_bin_path <- set_bin_path(r_minor_version, build_for_minor, local_build_root = bucket, codename)
if (debug) {
cli::cli_alert_danger("DEBUG: dir_out_bin: {dir_out_bin}, codename: {codename}")
cli::cli_alert_danger("DEBUG: Body: {sprintf('%s/%s', dir_out_bin, tarball_name)}")
cli::cli_alert_danger("DEBUG: local_bin_path: {local_bin_path}")
cli::cli_alert_danger("DEBUG: remote_bin_path: {remote_bin_path}")
}
s3fs::s3_file_system(