Debian Codegraph @

.jenkins/doc-snippet-build/Jenkinsfile

raw
1 // The documentation snippet build will extract all C++ code snippets from the
2 // Markdown documentation in doc/ and ensure that it compiles and runs without
3 // error.
4 pipeline
5 {
6 // Run inside of the custom Docker image for documentation builds.
7 agent
8 {
9 docker
10 {
11 image 'mlpack/jenkins-mlpack-docbuild:latest'
12 alwaysPull true
13 args '-v /home/jenkins/ccache:/opt/ccache'
14 }
15 }
16
17 options
18 {
19 // Only allow one build at a time of this job.
20 disableConcurrentBuilds(abortPrevious: true)
21
22 // We will do checkout manually.
23 skipDefaultCheckout()
24 }
25
26 stages
27 {
28 stage('Set up workspace')
29 {
30 steps
31 {
32 // Clean the workspace.
33 cleanWs(deleteDirs: true,
34 disableDeferredWipeout: true,
35 notFailBuild: true);
36 checkout scm
37
38 script
39 {
40 u = load '.jenkins/utils.groovy'
41 u.startCheck('Documentation snippet build', 'Setting up workspace...')
42 }
43 }
44 }
45
46 stage('Extract and build documentation snippets')
47 {
48 steps
49 {
50 script { u.updateCheckStatus('Testing documentation snippets...') }
51
52 sh'''
53 export CCACHE_DIR=/opt/ccache/;
54 export CXX="ccache g++";
55 export CXXFLAGS="-O3 -DNDEBUG -fopenmp -I./src/ -I/usr/include/eigen3/";
56 export LDFLAGS="-fopenmp";
57 export OMP_NUM_THREADS=1;
58
59 ccache -p;
60 ls -l /opt/ccache/
61 ccache --set-config "sloppiness=include_file_ctime";
62 ccache --set-config "hash_dir=false";
63 ccache --set-config "max_size=10G";
64 ccache --zero-stats;
65 ./scripts/test-docs.sh doc/;
66 # Print ccache statistics.
67 ccache -s
68 '''
69 }
70 }
71 }
72
73 post
74 {
75 success
76 {
77 script
78 {
79 u.finishCheck('All documentation snippets build and run.', true)
80 }
81 }
82
83 failure
84 {
85 script
86 {
87 u.finishCheck('Problems building documentation snippets.', false)
88 }
89 }
90
91 always
92 {
93 // Clean the workspace.
94 cleanWs(cleanWhenNotBuilt: true,
95 deleteDirs: true,
96 disableDeferredWipeout: true,
97 notFailBuild: true);
98 }
99 }
100 }