Anirban166 / Autocomment-atime-results

GitHub Action that automatically comments a plot and other atime-based results on PRs
https://github.com/marketplace/actions/autocomment-atime-results
0 stars 1 forks source link

Running multiple test cases #16

Closed Anirban166 closed 8 months ago

Anirban166 commented 8 months ago

Testing to see if multiple atime test cases are being portrayed side by side in the plot that will be commented on the PR thread. I defined two tests, and this is the version I used here:

pkg.edit.fun=quote(function(old.Package, new.Package, sha, new.pkg.path){
      pkg_find_replace <- function(glob, FIND, REPLACE){
        atime::glob_find_replace(file.path(new.pkg.path, glob), FIND, REPLACE)
      }
      Package_regex <- gsub(".", "_?", old.Package, fixed=TRUE)
      Package_ <- gsub(".", "_", old.Package, fixed=TRUE)
      new.Package_ <- paste0(Package_, "_", sha)
      pkg_find_replace(
        "DESCRIPTION", 
        paste0("Package:\\s+", old.Package),
        paste("Package:", new.Package))
      pkg_find_replace(
        file.path("src","Makevars.*in"),
        Package_regex,
        new.Package_)
      pkg_find_replace(
        file.path("R", "onLoad.R"),
        Package_regex,
        new.Package_)
      pkg_find_replace(
        file.path("R", "onLoad.R"),
        sprintf('packageVersion\\("%s"\\)', old.Package),
        sprintf('packageVersion\\("%s"\\)', new.Package))
      pkg_find_replace(
        file.path("src", "init.c"),
        paste0("R_init_", Package_regex),
        paste0("R_init_", gsub("[.]", "_", new.Package_)))
      pkg_find_replace(
        "NAMESPACE",
        sprintf('useDynLib\\("?%s"?', Package_regex),
        paste0('useDynLib(', new.Package_))
    })

test.list <- list(
  # 1    
  shallow.4440 = list(
    pkg.edit.fun=pkg.edit.fun,
    N = quote(10^seq(3, 8)),
    expr = quote(data.table:::`[.data.table`(dt_mod, , N := .N, by = g)),
    setup = quote({
      n <- N/100
      set.seed(1L)
      dt <- data.table(
        g = sample(seq_len(n), N, TRUE),
        x = runif(N),
        key = "g")
      dt_mod <- copy(dt)
    })
  ),
  # 2    
  atime.list.4200 = list(
  pkg.edit.fun=pkg.edit.fun,
  N = quote(10^seq(1,20)),
  expr = quote(data.table:::`[.data.table`(d, , (max(v1)-min(v2)), by = id3)),
  setup = quote({ 
    set.seed(108)
    d <- data.table(
      id3 = sample(c(seq.int(N*0.9), sample(N*0.9, N*0.1, TRUE))),
      v1 = sample(5L, N, TRUE),
      v2 = sample(5L, N, TRUE))
    })
  )
  # More to be added.    
)
github-actions[bot] commented 8 months ago

Comparison Plot

Generated via commit 775180d98c7bb0a4df20b865d45687d32930f294

tdhock commented 8 months ago

you don't need to quote N

tdhock commented 8 months ago

again this data.table-specific test code should not be in this repo. this repo should only have code specific to running atime_pkg on github actions. please fork the data.table repo, and put the data.table perforamce test code in data,table/inst/tests/atime.R similarly, please fork https://github.com/tdhock/binsegRcpp/ and create a PR like this https://github.com/SiyaoIsHiding/binsegRcpp/pull/4 yout github action should work with any R package that has inst/tests/atime.R in it

Anirban166 commented 8 months ago

again this data.table-specific test code should not be in this repo.

It is obviously not in this repository. I only shared it here for convenience so one does not have to go to my fork of data.table and look at my tests.R file there. In other words, I included that code snippet in my comment above for ease of navigation (if someone were curious about the changes and wanted to quickly see) since I'm modifying that test file in another repository, and it's relevant since the workflow uses it (but the test code is not here).

this repo should only have code specific to running atime_pkg on github actions. please fork the data.table repo, and put the data.table perforamce test code in data,table/inst/tests/atime.R

It already is that way - All this repository has is the GitHub Action. It runs atime::atime_pkg on my fork of data.table, using the tests defined there.

similarly, please fork https://github.com/tdhock/binsegRcpp/ and create a PR like this SiyaoIsHiding/binsegRcpp#4 yout github action should work with any R package that has inst/tests/atime.R in it

Sure, and yup it does

you don't need to quote N

Noted