11# ## Process examples
2- const EXAMPLES_SRC = joinpath (@__DIR__ , " .." , " examples" )
3- const EXAMPLES_OUT = joinpath (@__DIR__ , " src" , " examples" )
4- const LITERATEJL = joinpath (@__DIR__ , " literate.jl" )
5-
62# Always rerun examples
3+ const EXAMPLES_OUT = joinpath (@__DIR__ , " src" , " examples" )
74ispath (EXAMPLES_OUT) && rm (EXAMPLES_OUT; recursive= true )
85mkpath (EXAMPLES_OUT)
96
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
1021# Run examples asynchronously
11- processes = map (filter! (isdir, readdir (EXAMPLES_SRC; join= true ))) do example
12- scriptjl = joinpath (example, " script.jl" )
13- return run (
14- pipeline (
15- ` $(Base. julia_cmd ()) $LITERATEJL $scriptjl $EXAMPLES_OUT ` ;
16- stdin = devnull ,
17- stdout = devnull ,
18- stderr = stderr ,
19- );
20- wait= false ,
21- ):: Base.Process
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
2234end
2335
2436# Check that all examples were run successfully
@@ -30,11 +42,6 @@ using Documenter
3042using KernelFunctions
3143using PDMats, Kronecker # we have to load all optional packages to generate the full API documentation
3244
33- # Print `@debug` statements (https://github.com/JuliaDocs/Documenter.jl/issues/955)
34- if haskey (ENV , " GITHUB_ACTIONS" )
35- ENV [" JULIA_DEBUG" ] = " Documenter"
36- end
37-
3845# Doctest setup
3946DocMeta. setdocmeta! (
4047 KernelFunctions,
0 commit comments