Namespace errors when building R vignettes with GitHub check-standard.yaml

I'm new to using GitHub actions to do checks in the background.

himach checks out ok locally, and also if I use devtools::check_win_release(), for example.
But using the off-the-peg check-standard.yaml (here in the himach GitHub) for checks on GitHub there's a problem when checking the vignettes that objects defined in himach don't seem to be available, so that I get errors such as "object 'mach_kph' not found" where the vignette has in-line code r mach_kph. The object certainly exists, and the in-line code comes after the library(himach) call.

Baffled, so any pointers welcome.

(In case you can't see the logs without logging in, here are the errors in lines 37 & 42:
-- R CMD build -----------------------------------------------------------------

28pdflatex not found! Not building PDF manual.

29* checking for file 'D:\a\himach\himach/DESCRIPTION' ... OK

30* preparing 'himach':

31* checking DESCRIPTION meta-information ... OK

32* installing the package to build vignettes

33* creating vignettes ... ERROR

34Error: --- re-building 'Supersonic_Routes.Rmd' using rmarkdown

35Quitting from lines 33-54 (Supersonic_Routes.Rmd)

36Error: Error: processing vignette 'Supersonic_Routes.Rmd' failed with diagnostics:

37object 'mach_kph' not found

38--- failed re-building 'Supersonic_Routes.Rmd'

39--- re-building 'Supersonic_Routes_in_depth.Rmd' using rmarkdown

40Quitting from lines 26-38 (Supersonic_Routes_in_depth.Rmd)

41Error: Error: processing vignette 'Supersonic_Routes_in_depth.Rmd' failed with diagnostics:

42'crs_Pacific' is not an exported object from 'namespace:himach'

43--- failed re-building 'Supersonic_Routes_in_depth.Rmd'

44SUMMARY: processing the following files failed:

45 'Supersonic_Routes.Rmd' 'Supersonic_Routes_in_depth.Rmd'

46Error: Error: Vignette re-building failed.

47Execution halted

48Error: Error in proc$get_built_file() : Build process failed

49Calls: ... build_package -> with_envvar -> force ->

50Execution halted

51Error: Process completed with exit code 1.

I turned off the vignette building, and the errors then just appear in later checks, for example:

Warning: Missing or unexported objects:
[73] ‘himach::crs_longlat’ ‘himach::mach_kph’

and
── Error (test_grid.R:5:1): (code run outside of test_that()) ────────────────

[156]Error: Error: 'crs_Pacific' is not an exported object from 'namespace:himach'

These exist (eg mach_kph) and work in other test environments.
So, in GitHub are the data files not being built/found, for some reason?

:wave: @david6!

A first thing I notice is that you have .gitignore-ed the man/ folder himach/.gitignore at 8e6f01d1b2e5e92d7c613e0b457868911ba91ea5 · david6marsh/himach · GitHub which one shouldn't do as the GitHub Actions workflow does not run document. You should remove that line from .gitignore, run devtools::document() to make sure the docs are up to date, and then commit + push the man/ folder.

Regarding exported data, your repository does not have a data folder. See the R packages book section about data. It seems to be a .gitignore problem too actually.

Good luck!

1 Like

Hi Maelle, thanks for the response.
Actually I turned off GitHub Actions yesterday afternoon because I wanted to push a new version of himach without having GitHub create lots of fails. Done now, so I can go back to the problem.

Now that you say it, I don't know why /data is in .gitignore. And that does sound like it could cause the problem. I'll check it out.

1 Like

Cracked it! Thanks for the help, @maelle. I've flagged your answer as the solution, since tidying up my .gitignoredid the job.

1 Like

Awesome, good luck with further development!