NCC-CNC / wheretowork

Interactive application for systematic conservation planning
https://NCC-CNC.github.io/wheretowork
Other
8 stars 1 forks source link

recording failed tests here that only happen on GitHub Actions. Odd thing is that these test pass on local checks #363

Open DanWismer opened 6 months ago

DanWismer commented 6 months ago

image

DanWismer commented 5 months ago

image

DanWismer commented 5 months ago

image

DanWismer commented 5 months ago

image

DanWismer commented 2 months ago

@jeffreyhanson any idea on this? image

Should I just add testthat here ? https://github.com/NCC-CNC/wheretowork/blob/316b2567ecc5a7d35572994490c34ec40d2403df/.github/workflows/R-CMD-check-ubuntu.yaml#L54

Wondering how it worked before? Never had this problem.

image

jeffreyhanson commented 2 months ago

Yeah that's weird. Is listed testthat in Suggests part of the DESCRIPTION?

jeffreyhanson commented 2 months ago

Hmm, also check if it's installed in renv?

DanWismer commented 2 months ago

Its not in the rene.lock file.

I tried renv::instal("testthat") and then renv::snapshot(), however it says the the lockfile is up to date. I think because it is not used in the application code the new version of renv can't pick it up?

We have it listed in the Suggests part of the Description

jeffreyhanson commented 2 months ago

Hmm, maybe try renv::snapshot(type="explicit") to capture those in the DESCRTION file?

DanWismer commented 2 months ago

I tried that, no dice.

I am reading this: https://github.com/rstudio/renv/issues/1019

DanWismer commented 2 months ago

Maybe? https://github.com/rstudio/renv/issues/315

DanWismer commented 2 months ago

so I did renv::snapshot(dev=TRUE) which will included the suggested packages into the renv.lock.

However now it says that the project is out of sync because the following packages are installed, recorded but not used... image

DanWismer commented 2 months ago

I see that renv doesn't capture dependencies in the testthat folder. It considers testthat as separate from the core project.

I ran renv::dependencies(path = "tests/testthat") and see that these packages are being used, where some are found in the main code base which is fine, but others are only found in the Sugests.

DanWismer commented 2 months ago

@jeffreyhanson I am getting a weird faliure when it trys to install igraph: image

I found out where it is called:

https://github.com/NCC-CNC/wheretowork/blob/316b2567ecc5a7d35572994490c34ec40d2403df/R/utils_spatial_misc.R#L89-L137

I am wondering if you have a new / different way to calculate reserve sizes, without the need to use igraph?

jeffreyhanson commented 2 months ago

Hmm, that's odd. Yeah, you could potentially use the sf package instead of igraph - but that will slow down performance a lot. I would suggest trying to work out why it's failing. The error message suggests that something is going wrong with the C/C++ compiled part of the package (since it's complaining about a DLL file). Looking at the compilation flags in the raw logs, we can see compilation of the igraph package depends on the cpp11 package (e.g., see I'D:/a/wheretowork/wheretowork/renv/staging/1/cpp11/include). In particular cpp11 is an R package for helping to write C++ code that interfaces with R (see https://cpp11.r-lib.org/). Could you try updating cpp11 in renv to the latest version?

DanWismer commented 2 months ago

Thanks, I see that cpp11 R package updated at the end of August. I updated to the latest 0.5 version and will see it that works.

DanWismer commented 2 months ago

Darn, still errors at the same spot. But only for Windows build

jeffreyhanson commented 2 months ago

Hmm, maybe the issue is one of its other dependencies?

DanWismer commented 2 months ago

I got it to pass on Windows!

in the igraph 2.0.3 NEWS, GMP is no longer a dependency, and libxml2 and glpk are optional.

I removed those from the R-CMD-check-windows.yaml script: https://github.com/NCC-CNC/wheretowork/pull/380/commits/d6513acf105400e07d33d7c80f0e0b6005a2c785

I didn't see these system dependecies for Ubuntu or in the Dockerfile. @jeffreyhanson would you know why?

jeffreyhanson commented 2 months ago

Ah - nice work tracking that down! No idea why having those dependencies present would cause issues.

DanWismer commented 2 months ago

This still happens randomly: image

DanWismer commented 2 months ago

I think all these random fails have to do with the string encodings?

Maybe this: https://github.com/NCC-CNC/wheretowork/blob/316b2567ecc5a7d35572994490c34ec40d2403df/R/fct_write_project.R#L158-L159

The random tests fail when simulated WTW data is generated, then saved using write_project. And then read using read_project.

It says that there is NULL in x$ which is weird.

DanWismer commented 2 months ago

image can not subset columns that don't exists

jeffreyhanson commented 2 months ago

Yeah, that's odd - no idea what's going wrong here sorry. To help with debugging this, you could throw error messages that describe the contexts of x. E.g., something like: stop(names(x)) or stop(length(x))