Skip to content

Commit

Permalink
feat(benchmark): Fail early if pak cannot resolve packages
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusSkytte committed Mar 21, 2024
1 parent 9919941 commit 549c174
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data-raw/benchmark_update_snapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ withr::local_options("odbc.batch_rows" = 1000)
# Load the connection helper
source("tests/testthat/helper-setup.R")

# Install all needed package versions
for (version in c("CRAN", "main", "branch")) {
branch <- system("git symbolic-ref --short HEAD", intern = TRUE)
if (version == "branch" && branch == "main") {
Expand All @@ -16,6 +17,21 @@ for (version in c("CRAN", "main", "branch")) {
)

pak::pkg_install(source, lib = glue::glue("SCDB_installation/{source}"))
}

# Then loop over each and benchmark the update_snapshot function
for (version in c("CRAN", "main", "branch")) {
branch <- system("git symbolic-ref --short HEAD", intern = TRUE)
if (version == "branch" && branch == "main") {
next
}

source <- dplyr::case_when(
version == "CRAN" ~ "SCDB",
version == "main" ~ "ssi-dk/SCDB",
version == "branch" ~ glue::glue("ssi-dk/SCDB@{branch}")
)

library("SCDB", lib.loc = glue::glue("SCDB_installation/{source}"))

try({
Expand Down

0 comments on commit 549c174

Please sign in to comment.