Skip to content

mkFlake: build haddock documentation in CI (#1932) - #2549

Open
hamishmack wants to merge 1 commit into
masterfrom
hkm/issue-1932-haddock-ci-jobs
Open

mkFlake: build haddock documentation in CI (#1932)#2549
hamishmack wants to merge 1 commit into
masterfrom
hkm/issue-1932-haddock-ci-jobs

Conversation

@hamishmack

Copy link
Copy Markdown
Collaborator

Summary

mkFlake (and therefore ciJobs/hydraJobs) produced no jobs for the haddock
(.doc) outputs, so CI never checked that documentation builds — a real bug
slipped through because of this (see the issue). This adds a haddock job
group.

  • mkFlakeHaddock (lib/default.nix) folds over the local packages'
    components and collects each one's doc output, keyed by component-id like
    mkFlakePackages. 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/broken jobs.
  • mkFlakeCiJobs gains a haddock group. Its new arg defaults to {}, so
    the function stays compatible for any other caller.
  • mkFlake computes haddock (gated on a new doHaddock arg, default
    true) and threads it through.
  • A doHaddock flake module option (modules/flake.nix, default true)
    lets users opt out; it's wired through the overlay's mkFlake wrapper.

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-nix are all unchanged. Opt out per project with
flake = { doHaddock = false; };.

Tests / verification

  • Added four IFD-free unit tests in test/unit.nix:
    testMkFlakeHaddock (selection + keying: library and test docs collected,
    exe and haddock-disabled library skipped), testMkFlakeHaddockEmpty,
    testMkFlakeCiJobsHaddock, testMkFlakeCiJobsHaddockDefault. The full
    unit.tests suite evaluates to [] (all pass) under ghc9124.
  • All edited files nix-instantiate --parse cleanly.
  • Confirmed via lib.evalModules that the new doHaddock option is valid and
    defaults to true.
  • I did not run a full project-flake eval (it requires building plan-nix
    via 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.

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.
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.

mkFlake should include builds for haddock

1 participant