1
1
# ## 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
38
4
39
5
# ## Build documentation
40
6
using Documenter
41
7
8
+ using JuliaGPsDocs
42
9
using ApproximateGPs
43
10
11
+ JuliaGPsDocs. generate_examples (ApproximateGPs)
12
+
44
13
# Doctest setup
45
14
DocMeta. setdocmeta! (
46
15
ApproximateGPs,
@@ -58,11 +27,14 @@ makedocs(;
58
27
pages= [
59
28
" Home" => " index.md" ,
60
29
" 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 ,
66
38
],
67
39
strict= true ,
68
40
checkdocs= :exports ,
0 commit comments