Debian Codegraph @

.github/workflows/build_cmake.yml

raw
1 name: CMake Build for Doxygen
2
3 on: [push, pull_request]
4
5 jobs:
6 build:
7 permissions:
8 contents: write # to push pages branch (peaceiris/actions-gh-pages)
9
10 name: ${{ matrix.config.name }}
11 runs-on: ${{ matrix.config.os }}
12 strategy:
13 fail-fast: false
14 matrix:
15 config:
16 - {
17 name: "Ubuntu Latest GCC Release (Intel)",
18 os: ubuntu-24.04,
19 build_type: "Release", cc: "gcc", cxx: "g++",
20 build_gen: "Unix Makefiles",
21 cmake_extra_opts: "-Dbuild_search=YES -Dbuild_app=YES -Dbuild_parse=YES"
22 }
23 - {
24 name: "Ubuntu Latest GCC Debug (Intel)",
25 os: ubuntu-24.04,
26 build_type: "Debug", cc: "gcc", cxx: "g++",
27 build_gen: "Unix Makefiles",
28 cmake_extra_opts: "-Dbuild_search=YES -Dbuild_app=YES -Dbuild_parse=YES"
29 }
30 - {
31 name: "Ubuntu Latest Clang Release (Intel)",
32 os: ubuntu-24.04,
33 build_type: "Release", cc: "clang", cxx: "clang++",
34 build_gen: "Unix Makefiles",
35 cmake_extra_opts: "-Duse_libclang=YES -Dstatic_libclang=YES -Duse_libc++=NO"
36 }
37 - {
38 name: "Ubuntu Latest Clang Debug (Intel)",
39 os: ubuntu-24.04,
40 build_type: "Debug", cc: "clang", cxx: "clang++",
41 build_gen: "Unix Makefiles",
42 cmake_extra_opts: "-Duse_libclang=YES -Dstatic_libclang=YES -Duse_libc++=NO"
43 }
44
45 - {
46 name: "Ubuntu Latest GCC Release (Arm)",
47 os: ubuntu-24.04-arm,
48 build_type: "Release", cc: "gcc", cxx: "g++",
49 build_gen: "Unix Makefiles",
50 cmake_extra_opts: "-Dbuild_search=YES -Dbuild_app=YES -Dbuild_parse=YES"
51 }
52 - {
53 name: "Ubuntu Latest GCC Debug (Arm)",
54 os: ubuntu-24.04-arm,
55 build_type: "Debug", cc: "gcc", cxx: "g++",
56 build_gen: "Unix Makefiles",
57 cmake_extra_opts: "-Dbuild_search=YES -Dbuild_app=YES -Dbuild_parse=YES"
58 }
59 - {
60 name: "Ubuntu Latest Clang Release (Arm)",
61 os: ubuntu-24.04-arm,
62 build_type: "Release", cc: "clang", cxx: "clang++",
63 build_gen: "Unix Makefiles",
64 cmake_extra_opts: "-Duse_libclang=YES -Dstatic_libclang=YES -Duse_libc++=NO"
65 }
66 - {
67 name: "Ubuntu Latest Clang Debug (Arm)",
68 os: ubuntu-24.04-arm,
69 build_type: "Debug", cc: "clang", cxx: "clang++",
70 build_gen: "Unix Makefiles",
71 cmake_extra_opts: "-Duse_libclang=YES -Dstatic_libclang=YES -Duse_libc++=NO"
72 }
73 - {
74 name: "macOS Latest Release (Intel)",
75 os: macos-14,
76 build_type: "Release", cc: "clang", cxx: "clang++",
77 build_gen: "Unix Makefiles"
78 }
79 - {
80 name: "macOS Latest Debug (Intel)",
81 os: macos-14,
82 build_type: "Debug", cc: "clang", cxx: "clang++",
83 build_gen: "Unix Makefiles"
84 }
85 - {
86 name: "macOS Latest Release (Apple Silicon)",
87 os: macos-14,
88 build_type: "Release", cc: "clang", cxx: "clang++",
89 build_gen: "Unix Makefiles"
90 }
91 - {
92 name: "macOS Latest Debug (Apple Silicon)",
93 os: macos-14,
94 build_type: "Debug", cc: "clang", cxx: "clang++",
95 build_gen: "Unix Makefiles"
96 }
97 - {
98 name: "Windows Latest MSVC Debug",
99 os: windows-latest,
100 build_type: "Debug", cc: "cl", cxx: "cl",
101 build_gen: "NMake Makefiles"
102 }
103 - {
104 name: "Windows Latest MSVC Release",
105 os: windows-latest,
106 build_type: "Release", cc: "cl", cxx: "cl",
107 build_gen: "NMake Makefiles"
108 }
109 steps:
110 - name: Checkout doxygen
111 uses: actions/checkout@v5
112 with:
113 fetch-depth: 0
114
115 - name: Install libiconv (Windows)
116 uses: suisei-cn/actions-download-file@v1
117 with:
118 url: "https://github.com/pffang/libiconv-for-Windows/releases/download/v1.16/libiconv-for-Windows_1.16.7z"
119 target: .
120 if: matrix.config.os == 'windows-latest'
121
122 - name: Install LaTeX (Linux)
123 run: |
124 # workaround to avoid hanging on restarting the snapd after installing the firefox snap
125 sudo snap remove --purge firefox
126 sudo snap remove --purge snapd
127 sudo apt remove -y --purge snapd
128 sudo apt-mark hold snapd
129 # end workaround
130 sudo apt update --fix-missing
131 sudo apt upgrade
132 sudo apt update
133 sudo apt-get install texlive texlive-latex-recommended texlive-extra-utils texlive-latex-extra texlive-font-utils
134 if: startsWith(matrix.config.os,'ubuntu-')
135
136 - name: Install LaTeX (MacOS)
137 run: |
138 brew update || true
139 brew install --cask mactex || true
140 echo "/Library/TeX/texbin/" >> $GITHUB_PATH
141 if: startsWith(matrix.config.os,'macos-')
142
143 - name: Install libclang (Ubuntu 24.04)
144 run: |
145 sudo apt update
146 sudo apt remove llvm-14 llvm-14-dev llvm-14-tools llvm-14-runtime clang-14 clang-format-14 libclang-common-14-dev libclang-cpp14 libclang1-14 libllvm14
147 sudo apt remove llvm-15 llvm-15-dev llvm-15-tools llvm-15-runtime clang-15 clang-format-15 libclang-common-15-dev libclang-cpp15 libclang1-15 libllvm15
148 sudo apt remove llvm-16 llvm-16-dev llvm-16-tools llvm-16-runtime clang-16 clang-format-16 libclang-common-16-dev libclang-cpp16 libclang1-16 libllvm16
149 sudo apt remove llvm-17 llvm-17-dev llvm-17-tools llvm-17-runtime clang-17 clang-format-17 libclang-common-17-dev libclang-cpp17 libclang1-17 libllvm17
150 sudo apt-get autoremove
151 sudo apt-get clean
152 sudo apt install -y libclang-common-18-dev libclang-18-dev clang-18 llvm-18 llvm-18-dev
153 apt list --installed | egrep '(clang|llvm)'
154 ls -d /usr/lib/llvm-*/include/
155 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
156 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
157 ls -al /usr/bin/clang++
158 ls -al /etc/alternatives/clang++
159 which clang++
160 clang++ -v
161 if: matrix.config.cc == 'clang' && startsWith(matrix.config.os,'ubuntu-24')
162
163 - name: Install libxapian (Ubuntu 24.04)
164 run: |
165 sudo apt update
166 sudo apt install libxapian-dev
167 if: startsWith(matrix.config.os,'ubuntu-24')
168
169 - name: Install MikTeX (Windows)
170 uses: nick-invision/retry@v3
171 with:
172 timeout_minutes: 15
173 max_attempts: 5
174 retry_wait_seconds: 60
175 command: |
176 choco install miktex --debug --verbose --no-progress --params "/Set:basic" -y
177 if ($?) { echo "C:\Program Files\MiKTeX\miktex\bin\x64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 }
178 if: matrix.config.os == 'windows-latest'
179
180 - name: Configure MikTeX (Windows)
181 run: |
182 miktex --admin --verbose packages update-package-database
183 miktex --admin --verbose packages update
184 miktex --admin --verbose fndb refresh
185 initexmf --admin --verbose --set-config-value=[MPM]AutoInstall=1
186 initexmf --admin --verbose --update-fndb
187 initexmf --admin --verbose --mklinks --force
188 updmap --admin
189 if: matrix.config.os == 'windows-latest'
190
191 - name: Install Ghostscript (Linux)
192 run: |
193 sudo apt update
194 sudo apt-get install ghostscript
195 if: startsWith(matrix.config.os,'ubuntu-')
196
197 - name: Install Ghostscript (Windows)
198 run:
199 choco install ghostscript
200 if: matrix.config.os == 'windows-latest'
201
202 - name: Setting Ghostscript paths (Windows)
203 shell: bash
204 run: |
205 export GSpath=`find /c/Prog*/gs -name gswin\*c.exe | sed -e "s/gswin.*c.exe//"`
206 export PATH="$GSpath:$PATH"
207 export GSpath=`echo "$GSpath" | sed -e "s%/c%C:%"`
208 echo "$GSpath" >> $GITHUB_PATH
209 if: matrix.config.os == 'windows-latest'
210
211 - name: Install xmllint (Linux)
212 run: |
213 sudo apt-get update
214 sudo apt-get install libxml2-utils
215 if: startsWith(matrix.config.os,'ubuntu-')
216
217 - name: Install xmllint (MacOS)
218 run: |
219 brew update || true
220 brew upgrade || true
221 brew install libxml2
222 if: startsWith(matrix.config.os,'macos-')
223
224 - name: Install bison (MacOS)
225 run: |
226 brew update
227 brew install bison;
228 echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
229 #echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
230 if: startsWith(matrix.config.os,'macos-')
231
232 - name: Install bison/flex (Windows)
233 run: |
234 #Choco-Install -PackageName winflexbison
235 choco install winflexbison3
236 if: matrix.config.os == 'windows-latest'
237
238 - name: Install Graphviz (Linux)
239 run: |
240 sudo apt update
241 sudo apt-get install graphviz
242 if: startsWith(matrix.config.os,'ubuntu-')
243
244 - name: Install Graphviz (MacOS)
245 run: |
246 if ! brew install graphviz; then
247 # Workaround issue with unexpected symlinks: https://github.com/actions/runner-images/issues/6817
248 for f in 2to3 idle3 pydoc3 python3 python3-config; do
249 rm /usr/local/bin/$f || true
250 done
251 # Try again
252 brew install graphviz
253 fi
254 if: startsWith(matrix.config.os,'macos-')
255
256 - name: Install Graphviz (Windows)
257 run:
258 choco install graphviz.portable
259 if: matrix.config.os == 'windows-latest'
260
261 - name: Setup VS Environment (Windows)
262 uses: seanmiddleditch/gha-setup-vsdevenv@master
263 if: matrix.config.os == 'windows-latest'
264
265 - name: Refresh Env (Windows)
266 run: |
267 Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
268 refreshenv
269 if: matrix.config.os == 'windows-latest'
270
271 - name: Install Qt 6.8
272 uses: jdpurcell/install-qt-action@v5
273 with:
274 version: 6.8.*
275 if: matrix.config.os == 'ubuntu-24.04-arm'
276
277 - name: Install Qt 6.2
278 uses: jdpurcell/install-qt-action@v5
279 with:
280 version: 6.2.*
281 if: startsWith(matrix.config.os,'macos-')
282
283 - name: Install Qt 5
284 uses: jdpurcell/install-qt-action@v5
285 with:
286 version: 5.*
287 if: startsWith(matrix.config.os,'macos-')!=true && matrix.config.os != 'ubuntu-24.04-arm'
288
289 - name: Check tool versions (Linux / MacOS)
290 shell: bash
291 run: |
292 echo "=== perl ===";
293 perl --version;
294 echo "=== python ===";
295 python --version;
296 echo "=== cmake ===";
297 cmake --version;
298 echo "=== latex ===";
299 latex --version;
300 echo "=== bibtex ===";
301 bibtex --version
302 echo "=== dvips ===";
303 dvips --version
304 echo "=== bison ===";
305 bison --version;
306 echo "=== flex ===";
307 flex --version;
308 echo "=== dot ===";
309 dot -V;
310 echo "=== ghostscript ===";
311 gs --version;
312 if: matrix.config.os != 'windows-latest'
313
314 - name: Check tool versions (Windows)
315 shell: bash
316 run: |
317 echo "=== perl ===";
318 perl --version;
319 echo "=== python ===";
320 python --version;
321 echo "=== cmake ===";
322 cmake --version;
323 echo "=== latex ===";
324 latex --version;
325 echo "=== bibtex ===";
326 bibtex --version
327 echo "=== dvips ===";
328 dvips --version
329 echo "=== bison ===";
330 win_bison --version;
331 echo "=== flex ===";
332 win_flex --version;
333 echo "=== dot ===";
334 dot -V;
335 echo "=== ghostscript ===";
336 gswin64c --version;
337 if: matrix.config.os == 'windows-latest'
338
339 - name: Configure
340 shell: cmake -P {0}
341 run: |
342 set(ENV{CC} ${{ matrix.config.cc }})
343 set(ENV{CXX} ${{ matrix.config.cxx }})
344
345 execute_process(
346 COMMAND cmake
347 -S .
348 -B build
349 -D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
350 -G "${{ matrix.config.build_gen }}"
351 -Dbuild_doc=YES
352 -Dbuild_wizard=YES
353 ${{ matrix.config.cmake_extra_opts }}
354 RESULT_VARIABLE result
355 )
356 if (NOT result EQUAL 0)
357 message(FATAL_ERROR "Bad exit status")
358 endif()
359
360 - name: Build
361 shell: cmake -P {0}
362 run: |
363 include(ProcessorCount)
364 ProcessorCount(N)
365 execute_process(
366 COMMAND cmake --build build --parallel ${N}
367 RESULT_VARIABLE result
368 OUTPUT_VARIABLE output
369 ERROR_VARIABLE output
370 ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE
371 )
372 if (NOT result EQUAL 0)
373 string(REGEX MATCH "FAILED:.*$" error_message "${output}")
374 string(REPLACE "\n" "%0A" error_message "${error_message}")
375 message("::error::${error_message}")
376 message(FATAL_ERROR "Build failed")
377 endif()
378
379 - name: Archive build artifacts
380 uses: actions/upload-artifact@v4
381 with:
382 name: "${{ matrix.config.name }} build artifacts"
383 path: build/bin/
384
385 - name: Run tests (Linux / MacOS)
386 shell: cmake -P {0}
387 run: |
388 set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")
389
390 execute_process(
391 COMMAND
392 cmake -E env TEST_FLAGS="--xml --xmlxsd --xhtml --qhp --docbook --rtf --man"
393 cmake --build build --target tests
394 RESULT_VARIABLE result
395 )
396 if (NOT result EQUAL 0)
397 message(FATAL_ERROR "Running tests failed!")
398 endif()
399 if: matrix.config.os != 'windows-latest'
400
401 - name: Run tests (Windows)
402 shell: cmake -P {0}
403 run: |
404 set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")
405
406 execute_process(
407 COMMAND
408 cmake -E env TEST_FLAGS="--xml --xmlxsd --xhtml --qhp --docbook --rtf --man --pdf"
409 cmake --build build --target tests
410 RESULT_VARIABLE result
411 )
412 if (NOT result EQUAL 0)
413 message(FATAL_ERROR "Running tests failed!")
414 endif()
415 if: matrix.config.os == 'windows-latest'
416
417 - name: Generate documentation
418 shell: cmake -P {0}
419 run: |
420 execute_process(
421 COMMAND cmake --build build --target docs
422 RESULT_VARIABLE result
423 )
424 if (NOT result EQUAL 0)
425 message(FATAL_ERROR "Building documentation failed")
426 endif()
427
428 - name: Archive html documentation artifacts
429 uses: actions/upload-artifact@v4
430 with:
431 name: "Html documentation artifacts"
432 path: build/html/
433 if: matrix.config.name == 'Ubuntu Latest GCC Release (Intel)'
434
435 - name: Archive Latex documentation artifacts
436 uses: actions/upload-artifact@v4
437 with:
438 name: "Latex documentation artifacts"
439 path: build/latex/doxygen_manual.pdf
440 if: matrix.config.name == 'Ubuntu Latest GCC Release (Intel)'
441
442 - name: Generate Internal documentation
443 shell: cmake -P {0}
444 run: |
445 execute_process(
446 COMMAND cmake --build build --target docs_internal
447 RESULT_VARIABLE result
448 )
449 if (NOT result EQUAL 0)
450 message(FATAL_ERROR "Building internal documentation failed")
451 endif()
452 if: matrix.config.name == 'Ubuntu Latest GCC Release (Intel)'
453
454 - name: Publish Internal documentation to Github pages
455 uses: peaceiris/actions-gh-pages@v4
456 with:
457 deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
458 external_repository: doxygen/doxygen-docs
459 publish_dir: build/doxygen_docs/html
460 force_orphan: true
461 if: ${{ github.event_name == 'push' && matrix.config.name == 'Ubuntu Latest GCC Release (Intel)' }}
462
463