|
36 | 36 |
|
37 | 37 | using Documenter |
38 | 38 | import LibGit2 |
| 39 | +using Logging: with_logger, NullLogger |
39 | 40 |
|
40 | 41 | baremodule GenStdLib end |
41 | 42 |
|
@@ -402,22 +403,65 @@ else |
402 | 403 | end |
403 | 404 |
|
404 | 405 | const output_path = joinpath(buildrootdoc, "_build", (render_pdf ? "pdf" : "html"), "en") |
405 | | -makedocs( |
| 406 | +doc = makedocs( |
406 | 407 | source = joinpath(buildrootdoc, "src"), |
407 | 408 | build = output_path, |
408 | 409 | modules = [Main, Base, Core, [Base.root_module(Base, stdlib.stdlib) for stdlib in STDLIB_DOCS]...], |
409 | 410 | clean = true, |
410 | 411 | doctest = ("doctest=fix" in ARGS) ? (:fix) : ("doctest=only" in ARGS) ? (:only) : ("doctest=true" in ARGS) ? true : false, |
411 | 412 | linkcheck = "linkcheck=true" in ARGS, |
412 | 413 | linkcheck_ignore = ["https://bugs.kde.org/show_bug.cgi?id=136779"], # fails to load from nanosoldier? |
413 | | - checkdocs = :none, |
| 414 | + checkdocs = :public, |
| 415 | + warnonly = :missing_docs, # warn about missing docstrings, but don't fail |
414 | 416 | format = format, |
415 | 417 | sitename = "The Julia Language", |
416 | 418 | authors = "The Julia Project", |
417 | 419 | pages = PAGES, |
418 | 420 | remotes = documenter_stdlib_remotes, |
| 421 | + debug = true, # makes makedocs return the Documenter object for use later |
419 | 422 | ) |
420 | 423 |
|
| 424 | +# update this when the number of missing docstrings changes |
| 425 | +const known_missing_from_manual = 398 |
| 426 | + |
| 427 | +# Check that we're not regressing in missing docs, but only check on PRs so that master builds can still pass |
| 428 | +if in("deploy", ARGS) && haskey(ENV,"BUILDKITE_BRANCH") && ENV["BUILDKITE_BRANCH"] != "master" |
| 429 | + |
| 430 | + function show_buildkite_annotation(type::String, msg::String) |
| 431 | + if type == "success" |
| 432 | + @info msg |
| 433 | + else |
| 434 | + @warn msg |
| 435 | + end |
| 436 | + run(`buildkite-agent annotate --style $type --context "missing-docs" "$msg"`) |
| 437 | + end |
| 438 | + |
| 439 | + # ignore logging in the report because makedocs has already run this internally, we just want the number out |
| 440 | + missing_from_manual = with_logger(NullLogger()) do |
| 441 | + Documenter.missingdocs(doc) |
| 442 | + end |
| 443 | + if missing_from_manual > known_missing_from_manual |
| 444 | + show_buildkite_annotation( |
| 445 | + "warning", |
| 446 | + """New docstrings have been added for exported functions that are missing from the manual. |
| 447 | + Please add these to the manual. |
| 448 | + Number known to be missing=#$(known_missing_from_manual), Current=$missing_from_manual. |
| 449 | + See the `doctest` job for details. |
| 450 | + """ |
| 451 | + ) |
| 452 | + elseif missing_from_manual < known_missing_from_manual |
| 453 | + show_buildkite_annotation( |
| 454 | + "success", |
| 455 | + """🎉 The number of missing docstrings in the manual has decreased! |
| 456 | + Update `doc/make.jl` from $known_missing_from_manual to: |
| 457 | + ```term |
| 458 | + const known_missing_from_manual = $missing_from_manual |
| 459 | + ``` |
| 460 | + """ |
| 461 | + ) |
| 462 | + end |
| 463 | +end |
| 464 | + |
421 | 465 | # Update URLs to external stdlibs (JuliaLang/julia#43199) |
422 | 466 | for (root, _, files) in walkdir(output_path), file in joinpath.(root, files) |
423 | 467 | endswith(file, ".html") || continue |
|
0 commit comments