ocean-tracking-network / glatos

9 stars 4 forks source link

testthat with windows executables and externally referenced files are not working #196

Open jdpye opened 10 months ago

jdpye commented 10 months ago

we're experiencing some errors with the merge checking GHA, when it's running the tests in testthat. the ones built to work with VUE.exe and some of the .RDA files that are in the package need to be either excluded or have their references fixed up.

mhpob commented 10 months ago

You can add skip_on_ci() to the tests that require executables, etc., that can't be provided in GH Actions. https://testthat.r-lib.org/articles/skipping.html

Depending on how far down this CI rabbit hole you go, I also wrote a helper that skips some of the RUniverse CI testing: https://github.com/mhpob/matos/blob/master/tests/testthat/helper-runiverse.R

mhpob commented 10 months ago

If you really, really want to go down the rabbit hole, you could also configure the action to use the GitLab/GitHub API to download the relevant executable from a private repo, listing the API key as an env var in the GH secrets vault, when building the runner.

jdpye commented 10 months ago

that would be a fun stretch goal. might save that one for @jackVanish to practice advanced GitHub Action-fu with.

mhpob commented 10 months ago

There seem to be murmurings that you could convert the exe to binary locally (base64?), store the binary as a GH secret/variable, then convert the secret back to an exe when setting up the runner. This got over my head very quickly when I was looking into it so I haven't figured out if that's actually a viable solution.

This is all assuming (I think correctly?) that you can't include vue.exe or vdat.exe in the repo due to distribution and licensing restrictions.

jdpye commented 10 months ago

there are 11 ways i'd be uncomfortable doing that, (in binary). I think the skip is going to be the right way to approach this problem. I'll try and bake something in.

mhpob commented 10 months ago

Depending on how far down this CI rabbit hole you go, I also wrote a helper that skips some of the RUniverse CI testing: https://github.com/mhpob/matos/blob/master/tests/testthat/helper-runiverse.R

Hey @jdpye, sorry to lead you on a wild goose chase with this one, but you won't need the Runiverse skip. skip_on_ci will cover it.

I needed a special Runiverse skipper since some tests in matos used GH Secrets, which are not available when Runiverse runs their build/checks. So, I didn't want it to skip on CI, since my GH repo has the secret to run the tests, just on Runiverse, which didn't.

mhpob commented 9 months ago

Closed in #204 and #214

mhpob commented 9 months ago

Alright, I went down the rabbit hole and used the GitLab API + personal access token + GitHub secrets to get the R CMD check CI to work with the vdat executables.

https://github.com/mhpob/rvdat/blob/main/.github/workflows/R-CMD-check.yaml#L34-L55

It'll take some finagling to get set up in glatos, but the shape now exists.