fredrikekre / Literate.jl

Simple package for literate programming in Julia
https://fredrikekre.github.io/Literate.jl
Other
543 stars 64 forks source link

Question: checking for all `[deps]` in `docs/Project.toml` #212

Closed JeffFessler closed 1 year ago

JeffFessler commented 1 year ago

I test my Literate examples on my local host. After they work locally, I push them to a PR in github. Often I forget to include some package(s) in the [deps] for my docs/Project.toml.

My local test passes, even though it shouldn't, because the default LOAD_PATH includes "v#.#", so my local test run is getting the needed package from my base environment without warning me that it is missing from docs/Project.toml.

Oddly, even when I am missing an deps entry, the CI on github still runs fine and reports "All checks passed" instead of reporting my omission. But if I click "Show all checks" and look at the details for the Documentation run, then I see that the "Build and Deploy" stage actually failed due to the missing [deps] entry.

mortenpi commented 1 year ago

Do you have a link to an example CI run where you had this failure?

JeffFessler commented 1 year ago

This happens to me very often so it was easy to make an example: https://github.com/JeffFessler/book-mmaj-demo/pull/12 github says it "passes" but the actual build is full of errors due to the missing package.

mortenpi commented 1 year ago

The build on that PR was a success though? It does have heaps of warnings in the logs, but they're warnings, not errors. If you want them to be errors, you need to set strict = true in makedocs.

JeffFessler commented 1 year ago

Interesting. I had not noticed that those were mere warnings because they are filled with serious sounding words like failed and ArgumentError and UndefVarError. I guess I expected that an omitted deps would be an actual error, not just a warning.

I had studied the Literate docs pretty carefully, but I had overlooked the (apparently experimental) keyword option strict = true in the Documenter docs for makedocs. Thanks for letting me know about that! I added it and now things fail/work as expected. I'll close this issue. Hopefully the dialogue here will help someone else in the future. Thanks much!

fredrikekre commented 1 year ago

Is there a way to make my local test more faithful to the cloud environment so that if I am missing a deps entry then it will fail locally? I've tried JULIA_LOAD_PATH=docs/Project.toml:@stdlib but that just caused many seemingly unrelated errors.

Setting the load path should work, if you make sure the only entry is the docs/Project.toml environment. What unrelated errors did you see?