1
1
# ## 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
-
6
2
# Always rerun examples
3
+ const EXAMPLES_OUT = joinpath (@__DIR__ , " src" , " examples" )
7
4
ispath (EXAMPLES_OUT) && rm (EXAMPLES_OUT; recursive= true )
8
5
mkpath (EXAMPLES_OUT)
9
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
10
21
# 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
22
34
end
23
35
24
36
# Check that all examples were run successfully
@@ -30,11 +42,6 @@ using Documenter
30
42
using KernelFunctions
31
43
using PDMats, Kronecker # we have to load all optional packages to generate the full API documentation
32
44
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
-
38
45
# Doctest setup
39
46
DocMeta. setdocmeta! (
40
47
KernelFunctions,
0 commit comments