Skip to content

Test JuliaGPsDocs on repo #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 0 additions & 92 deletions docs/literate.jl

This file was deleted.

54 changes: 13 additions & 41 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,46 +1,15 @@
### Process examples
# Always rerun examples
const EXAMPLES_OUT = joinpath(@__DIR__, "src", "examples")
ispath(EXAMPLES_OUT) && rm(EXAMPLES_OUT; recursive=true)
mkpath(EXAMPLES_OUT)

# Install and precompile all packages
# Workaround for https://github.com/JuliaLang/Pkg.jl/issues/2219
examples = filter!(isdir, readdir(joinpath(@__DIR__, "..", "examples"); join=true))
let script = "using Pkg; Pkg.activate(ARGS[1]); Pkg.instantiate()"
for example in examples
if !success(`$(Base.julia_cmd()) -e $script $example`)
error(
"project environment of example ",
basename(example),
" could not be instantiated",
)
end
end
end
# Run examples asynchronously
processes = let literatejl = joinpath(@__DIR__, "literate.jl")
map(examples) do example
return run(
pipeline(
`$(Base.julia_cmd()) $literatejl $(basename(example)) $EXAMPLES_OUT`;
stdin=devnull,
stdout=devnull,
stderr=stderr,
);
wait=false,
)::Base.Process
end
end

# Check that all examples were run successfully
isempty(processes) || success(processes) || error("some examples were not run successfully")
using Pkg
Pkg.add(Pkg.PackageSpec(; url="https://github.com/JuliaGaussianProcesses/JuliaGPsDocs.jl")) # While the package is unregistered, it's a workaround

### Build documentation
using Documenter

using JuliaGPsDocs
using ApproximateGPs

JuliaGPsDocs.generate_examples(ApproximateGPs)

# Doctest setup
DocMeta.setdocmeta!(
ApproximateGPs,
Expand All @@ -58,11 +27,14 @@ makedocs(;
pages=[
"Home" => "index.md",
"userguide.md",
"API" => ["api/index.md", "api/sparsevariational.md", "api/laplace.md"],
"Examples" =>
map(filter!(filename -> endswith(filename, ".md"), readdir(EXAMPLES_OUT))) do x
return joinpath("examples", x)
end,
"API" => joinpath.(Ref("api"), ["index.md", "sparsevariational.md", "laplace.md"]),
"Examples" => map(
basename.(
filter!(isdir, readdir(joinpath(@__DIR__, "src", "examples"); join=true)),
),
) do x
joinpath("examples", x, "index.md")
end,
],
strict=true,
checkdocs=:exports,
Expand Down