Skip to content

Commit d8510de

Browse files
theogfgithub-actions[bot]st--
authored
Test JuliaGPsDocs on repo (#124)
* Adapt to use JuliaGPsDocs * Update make.jl * Update docs/make.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: ST John <[email protected]>
1 parent b4f17c3 commit d8510de

File tree

2 files changed

+13
-133
lines changed

2 files changed

+13
-133
lines changed

docs/literate.jl

Lines changed: 0 additions & 92 deletions
This file was deleted.

docs/make.jl

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,15 @@
11
### Process examples
2-
# Always rerun examples
3-
const EXAMPLES_OUT = joinpath(@__DIR__, "src", "examples")
4-
ispath(EXAMPLES_OUT) && rm(EXAMPLES_OUT; recursive=true)
5-
mkpath(EXAMPLES_OUT)
6-
7-
# Install and precompile all packages
8-
# Workaround for https://github.com/JuliaLang/Pkg.jl/issues/2219
9-
examples = filter!(isdir, readdir(joinpath(@__DIR__, "..", "examples"); join=true))
10-
let script = "using Pkg; Pkg.activate(ARGS[1]); Pkg.instantiate()"
11-
for example in examples
12-
if !success(`$(Base.julia_cmd()) -e $script $example`)
13-
error(
14-
"project environment of example ",
15-
basename(example),
16-
" could not be instantiated",
17-
)
18-
end
19-
end
20-
end
21-
# Run examples asynchronously
22-
processes = let literatejl = joinpath(@__DIR__, "literate.jl")
23-
map(examples) do example
24-
return run(
25-
pipeline(
26-
`$(Base.julia_cmd()) $literatejl $(basename(example)) $EXAMPLES_OUT`;
27-
stdin=devnull,
28-
stdout=devnull,
29-
stderr=stderr,
30-
);
31-
wait=false,
32-
)::Base.Process
33-
end
34-
end
35-
36-
# Check that all examples were run successfully
37-
isempty(processes) || success(processes) || error("some examples were not run successfully")
2+
using Pkg
3+
Pkg.add(Pkg.PackageSpec(; url="https://github.com/JuliaGaussianProcesses/JuliaGPsDocs.jl")) # While the package is unregistered, it's a workaround
384

395
### Build documentation
406
using Documenter
417

8+
using JuliaGPsDocs
429
using ApproximateGPs
4310

11+
JuliaGPsDocs.generate_examples(ApproximateGPs)
12+
4413
# Doctest setup
4514
DocMeta.setdocmeta!(
4615
ApproximateGPs,
@@ -58,11 +27,14 @@ makedocs(;
5827
pages=[
5928
"Home" => "index.md",
6029
"userguide.md",
61-
"API" => ["api/index.md", "api/sparsevariational.md", "api/laplace.md"],
62-
"Examples" =>
63-
map(filter!(filename -> endswith(filename, ".md"), readdir(EXAMPLES_OUT))) do x
64-
return joinpath("examples", x)
65-
end,
30+
"API" => joinpath.(Ref("api"), ["index.md", "sparsevariational.md", "laplace.md"]),
31+
"Examples" => map(
32+
basename.(
33+
filter!(isdir, readdir(joinpath(@__DIR__, "src", "examples"); join=true)),
34+
),
35+
) do x
36+
joinpath("examples", x, "index.md")
37+
end,
6638
],
6739
strict=true,
6840
checkdocs=:exports,

0 commit comments

Comments
 (0)