Skip to content

Commit e59c2b4

Browse files
authored
Merge pull request #6434 from hjmjohnson/add-doxygen-warnings-gha
ENH: Add a warnings-only Doxygen CI check
2 parents fcfd098 + 593fab6 commit e59c2b4

4 files changed

Lines changed: 5406 additions & 118 deletions

File tree

.github/workflows/doxygen.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: ITK.Doxygen.Warnings
2+
3+
# pull_request intentionally has no paths-ignore: the check always runs, so it
4+
# can safely be made a required status without stranding filtered PRs.
5+
on:
6+
push:
7+
branches:
8+
- main
9+
- 'release*'
10+
paths-ignore:
11+
- '*.md'
12+
- LICENSE
13+
- NOTICE
14+
- 'Utilities/Debugger/**'
15+
- 'Utilities/ITKv5Preparation/**'
16+
- 'Utilities/Maintenance/**'
17+
pull_request:
18+
19+
concurrency:
20+
group: '${{ github.workflow }}@${{ github.head_ref || github.ref }}'
21+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
doxygen-warnings:
28+
runs-on: ubuntu-26.04
29+
timeout-minutes: 30
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v5
34+
35+
- name: Set up Pixi
36+
uses: prefix-dev/setup-pixi@v0.9.5
37+
38+
- name: Restore Doxygen build tree
39+
uses: actions/cache@v5
40+
with:
41+
path: build-doxygen
42+
key: doxygen-build-${{ hashFiles('CMakeLists.txt', 'CMake/**', 'Utilities/Doxygen/**', 'pyproject.toml', 'pixi.lock') }}
43+
restore-keys: |
44+
doxygen-build-
45+
46+
- name: Run warnings-only Doxygen pass
47+
run: pixi run doxygen-ci
48+
49+
- name: Upload warnings log and effective configuration
50+
if: failure()
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: doxygen-warnings
54+
path: |
55+
build-doxygen/doxygen-warnings.log
56+
build-doxygen/Utilities/Doxygen/Doxyfile.Documentation
57+
if-no-files-found: ignore

Utilities/Doxygen/CMakeLists.txt

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ cmake_dependent_option(
106106
OFF
107107
)
108108

109+
cmake_dependent_option(
110+
ITK_DOXYGEN_WARNINGS_ONLY
111+
"Doxygen emits warnings as errors without generating output formats or implicit graphs"
112+
OFF
113+
"ITK_BUILD_DOCUMENTATION"
114+
OFF
115+
)
116+
109117
mark_as_advanced(
110118
ITK_DOXYGEN_HTML
111119
ITK_DOXYGEN_DOCSET
@@ -116,6 +124,7 @@ mark_as_advanced(
116124
ITK_DOXYGEN_RTF
117125
ITK_DOXYGEN_XML
118126
ITK_DOXYGEN_SERVER_BASED_SEARCH
127+
ITK_DOXYGEN_WARNINGS_ONLY
119128
)
120129

121130
# -------------------------------------------------------------
@@ -166,6 +175,11 @@ if(ITK_BUILD_DOCUMENTATION)
166175
"${ITK_SOURCE_DIR}/Examples"
167176
"${ITK_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake"
168177
)
178+
add_custom_target(
179+
ITKDoxygenExamplesDox
180+
DEPENDS
181+
"${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox"
182+
)
169183

170184
set(
171185
ITK_DOXYGEN_INPUT
@@ -181,6 +195,40 @@ if(ITK_BUILD_DOCUMENTATION)
181195
# The DoxygenConfig.cmake is a replacement for configuring a doxygen.config.in file
182196
# https://cmake.org/cmake/help/v3.16/module/FindDoxygen.html
183197
include(${CMAKE_CURRENT_LIST_DIR}/DoxygenConfig.cmake)
198+
if(ITK_DOXYGEN_WARNINGS_ONLY)
199+
foreach(
200+
_format
201+
ITEMS
202+
HTML
203+
DOCSET
204+
CHM
205+
QHP
206+
ECLIPSEHELP
207+
LATEX
208+
RTF
209+
XML
210+
)
211+
set(DOXYGEN_GENERATE_${_format} "NO")
212+
endforeach()
213+
# Explicit \dot commands still render; only the implicit graph classes are disabled.
214+
foreach(
215+
_graph
216+
ITEMS
217+
CLASS_GRAPH
218+
COLLABORATION_GRAPH
219+
INCLUDE_GRAPH
220+
INCLUDED_BY_GRAPH
221+
CALL_GRAPH
222+
CALLER_GRAPH
223+
GRAPHICAL_HIERARCHY
224+
DIRECTORY_GRAPH
225+
)
226+
set(DOXYGEN_${_graph} "NO")
227+
endforeach()
228+
set(DOXYGEN_WARN_AS_ERROR "FAIL_ON_WARNINGS")
229+
set(DOXYGEN_WARN_LOGFILE "${ITK_BINARY_DIR}/doxygen-warnings.log")
230+
# GENERATE_TAGFILE stays: doxygen requires at least one output and the tag file is the cheapest.
231+
endif()
184232
doxygen_add_docs(
185233
Documentation
186234
${ITK_DOXYGEN_INPUT}
@@ -190,6 +238,7 @@ if(ITK_BUILD_DOCUMENTATION)
190238
COMMENT "-- Building ITK Doxygen."
191239
)
192240
unset(ITK_DOXYGEN_INPUT)
241+
add_dependencies(Documentation ITKDoxygenExamplesDox)
193242

194243
# add_custom_target(Documentation ALL
195244
# COMMAND ${DOXYGEN_EXECUTABLE} ${ITK_BINARY_DIR}/Utilities/Doxygen/doxygen.config
@@ -202,14 +251,16 @@ if(ITK_BUILD_DOCUMENTATION)
202251
# Somehow the logo image is not copied into the html folder.
203252
# Here we ensure that the logo image ends up in the right directory
204253
# where html pages could find it.
205-
add_custom_command(
206-
TARGET Documentation
207-
POST_BUILD
208-
COMMAND
209-
${CMAKE_COMMAND} -E copy
210-
${ITK_SOURCE_DIR}/Documentation/Art/itkLogoSmall.png # logo
211-
${ITK_DOXYGEN_OUTPUT_DIR}/html # output doxygen directory
212-
)
254+
if(DOXYGEN_GENERATE_HTML STREQUAL "YES")
255+
add_custom_command(
256+
TARGET Documentation
257+
POST_BUILD
258+
COMMAND
259+
${CMAKE_COMMAND} -E copy
260+
${ITK_SOURCE_DIR}/Documentation/Art/itkLogoSmall.png # logo
261+
${ITK_DOXYGEN_OUTPUT_DIR}/html # output doxygen directory
262+
)
263+
endif()
213264

214265
message(
215266
STATUS

0 commit comments

Comments
 (0)