mkFlake: build haddock documentation in CI (#1932) - #2549
Open
hamishmack wants to merge 1 commit into
Open
Conversation
mkFlake produced no jobs for the haddock (.doc) outputs, so ciJobs/hydraJobs
never checked that documentation builds. Add a `haddock` job group:
- mkFlakeHaddock (lib/default.nix) folds over local package components and
collects each one's `doc` output. Only library/test components with haddock
enabled expose a `doc` attr (see builder/comp-builder.nix), so guarding on
`component ? doc` selects exactly those and skips exes, benchmarks and
haddock-disabled components -- no null or broken jobs.
- mkFlakeCiJobs gains a `haddock` group (arg defaults to {}, so any other
caller keeps working); mkFlake computes it and threads it through.
- A `doHaddock` flake option (default true) lets users opt out; wired through
the overlay's mkFlake wrapper.
Additive and non-breaking: existing job groups are unchanged. Default on, since
catching broken haddock is the point of the issue.
Unit tests in test/unit.nix cover the component selection/keying and the
mkFlakeCiJobs wiring.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mkFlake(and thereforeciJobs/hydraJobs) produced no jobs for the haddock(
.doc) outputs, so CI never checked that documentation builds — a real bugslipped through because of this (see the issue). This adds a
haddockjobgroup.
mkFlakeHaddock(lib/default.nix) folds over the local packages'components and collects each one's
docoutput, keyed by component-id likemkFlakePackages. Only library/test components with haddock enabled expose adocattr (seebuilder/comp-builder.nix), so guarding oncomponent ? docselects exactly those and skips exes, benchmarks and haddock-disabled
components — no null/broken jobs.
mkFlakeCiJobsgains ahaddockgroup. Its new arg defaults to{}, sothe function stays compatible for any other caller.
mkFlakecomputeshaddock(gated on a newdoHaddockarg, defaulttrue) and threads it through.doHaddockflake module option (modules/flake.nix, defaulttrue)lets users opt out; it's wired through the overlay's
mkFlakewrapper.Default on, since catching broken haddock is the whole point of the issue.
Non-breaking
Purely additive —
checks,coverage,packages,devShells,roots,plan-nix/stack-nixare all unchanged. Opt out per project withflake = { doHaddock = false; };.Tests / verification
test/unit.nix:testMkFlakeHaddock(selection + keying: library and test docs collected,exe and haddock-disabled library skipped),
testMkFlakeHaddockEmpty,testMkFlakeCiJobsHaddock,testMkFlakeCiJobsHaddockDefault. The fullunit.testssuite evaluates to[](all pass) underghc9124.nix-instantiate --parsecleanly.lib.evalModulesthat the newdoHaddockoption is valid anddefaults to
true.plan-nixvia IFD + network); the unit tests exercise the selection and CI-jobs wiring
directly, and CI will exercise the end-to-end flake path.
Related: #2029 (hydra-build-products for haddock, already merged in a sibling
quick-fix) and #737 (standalone project-wide haddock).
Closes #1932.