Find a way to run doctests without rebuilding everything dynamically
Clarification and motivation
After !397 (merged) we are using mostly static linking in CI to build our packages.
One issue, described in that MR, is with doctests:
It seems that packages which use some internal GHC API break when they are built statically. It is not a problem for morley, but doctests break because of that, probably because they use GHC API to parse haskell modules. Example of a failure: https://gitlab.com/morley-framework/morley/-/jobs/1579625653#L54. This MR works around it by building doctests dynamically, but it requires us to rebuild GHC and all haskell packages in CI just for this running doctests.
The workaround is clearly not ideal, as it requires CI to rebuild ~everything dynamically.
We run doctests with a wrapper module (and library, after #554 (closed)) that generates options before giving them to the doctest
function/library.
Paraphrasing Zhenya's suggestions in a Slack discussion a possible solution could be to either:
- avoid importing the
doctest
library and have the wrapper use thedoctest
executable instead, from nixpkgs (as CI would do) or from$PATH
(locally). - it may be possible to minimize the dependency of the doctest components by removing the libraries to execute them on (currently
morley
andlorentz
).
Note: it's possible that there are other/better solutions as well, which we should consider.
Acceptance criteria
doctest
s are executed in CI without the need to rebuild packages dynamically.