Skip to content

Avoid unnecessary rebuilding when running doctests#5688

Draft
neilmayhew wants to merge 1 commit intomasterfrom
nm/doctest-avoid-rebuilding
Draft

Avoid unnecessary rebuilding when running doctests#5688
neilmayhew wants to merge 1 commit intomasterfrom
nm/doctest-avoid-rebuilding

Conversation

@neilmayhew
Copy link
Copy Markdown
Contributor

Description

Closes #5685

Checklist

  • Commits in meaningful sequence and with useful messages.
  • Tests added or updated when needed.
  • CHANGELOG.md files updated for packages with externally visible changes.
    NOTE: New section is never added with the code changes. (See RELEASING.md).
  • Versions updated in .cabal and CHANGELOG.md files when necessary, according to the
    versioning process.
  • Version bounds in .cabal files updated when necessary.
    NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
  • Code formatted (use scripts/fourmolize.sh).
  • Cabal files formatted (use scripts/cabal-format.sh).
  • CDDL files are up to date (use scripts/gen-cddl.sh)
  • hie.yaml updated (use scripts/gen-hie.sh).
  • Self-reviewed the diff.

@neilmayhew neilmayhew requested a review from a team as a code owner March 28, 2026 00:28
Comment thread scripts/doctest.sh
Comment on lines +47 to +50
# Build the packages
echo "***** cabal build ${PACKAGES[*]:-all} *****"
cabal build "${PACKAGES[@]:-all}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary for avoiding rebuilding, and is just a useful safety feature for when the script is used outside of CI.

Comment thread scripts/doctest.sh
Comment on lines -53 to +57
cabal doctest --repl-options='-w -Wdefault' "${ARGS[@]}"
cabal doctest "${ARGS[@]}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this was tripping cabal up and making it think modules needed to be rebuilt. cabal-doctest now sets these options anyway, so we don't need them here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My previous investigation (using claude) about this was that cabal is producing only .o files and not the shared .dyn_o needed by doctest, and the proposed solution was adding shared: True to cabal.project. This does affect all users too but it also means we can run doctest locally before pushing commits to make sure they pass, without having to rebuild the packages. The only concern I haven't looked into is whether the caches carry over to the intended stage of the pipeline (viz. cabal build all... -> cabal doctest). I may be completely wrong about this.

@lehins
Copy link
Copy Markdown
Collaborator

lehins commented Mar 28, 2026

I am not sure if it actually helped, cause running doctests still results in bunch of modules getting rebuild

@neilmayhew neilmayhew marked this pull request as draft April 1, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid rebuilding for doctests

3 participants