Fix Doxygen workflow (#4372)

This commit is contained in:
John Freeman
2022-12-21 12:41:16 -06:00
committed by GitHub
parent d8a84e9530
commit fda9e9a7ee
4 changed files with 93 additions and 83 deletions

View File

@@ -1,4 +1,5 @@
name: Build and publish Doxygen documentation name: Build and publish Doxygen documentation
# To test this workflow, push your changes to your fork's `develop` branch.
on: on:
push: push:
branches: branches:
@@ -11,12 +12,18 @@ jobs:
image: docker://rippleci/rippled-ci-builder:2944b78d22db image: docker://rippleci/rippled-ci-builder:2944b78d22db
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: check environment
run: |
echo ${PATH} | tr ':' '\n'
cmake --version
doxygen --version
env
- name: build - name: build
run: | run: |
mkdir build mkdir build
cd build cd build
cmake -DBoost_NO_BOOST_CMAKE=ON .. cmake -Donly_docs=TRUE ..
cmake --build . --target docs --parallel $(nproc) cmake --build . --target docs --parallel $(nproc)
- name: publish - name: publish
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3

View File

@@ -74,7 +74,7 @@ jobs:
run: | run: |
mkdir ${build_dir} mkdir ${build_dir}
cd ${build_dir} cd ${build_dir}
conan install .. --build missing --settings build_type=${{ matrix.configuration }} --profile:build default --profile:host default conan install .. --build missing --settings build_type=${{ matrix.configuration }}
- name: configure - name: configure
run: | run: |
cd ${build_dir} cd ${build_dir}

View File

@@ -2,85 +2,83 @@
docs target (optional) docs target (optional)
#]===================================================================] #]===================================================================]
# Early return if the `docs` directory is missing, option(with_docs "Include the docs target?" FALSE)
# e.g. when we are building a Conan package.
if(NOT EXISTS docs) if(NOT (with_docs OR only_docs))
return() return()
endif() endif()
if (tests) find_package(Doxygen)
find_package (Doxygen) if(NOT TARGET Doxygen::doxygen)
if (NOT TARGET Doxygen::doxygen) message(STATUS "doxygen executable not found -- skipping docs target")
message (STATUS "doxygen executable not found -- skipping docs target") return()
return () endif()
endif ()
set(doxygen_output_directory "${CMAKE_BINARY_DIR}/docs")
set (doxygen_output_directory "${CMAKE_BINARY_DIR}/docs") set(doxygen_include_path "${CMAKE_CURRENT_SOURCE_DIR}/src")
set (doxygen_include_path "${CMAKE_CURRENT_SOURCE_DIR}/src") set(doxygen_index_file "${doxygen_output_directory}/html/index.html")
set (doxygen_index_file "${doxygen_output_directory}/html/index.html") set(doxyfile "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile")
set (doxyfile "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile")
file(GLOB_RECURSE doxygen_input
file (GLOB_RECURSE doxygen_input docs/*.md
docs/*.md src/ripple/*.h
src/ripple/*.h src/ripple/*.cpp
src/ripple/*.cpp src/ripple/*.md
src/ripple/*.md src/test/*.h
src/test/*.h src/test/*.md
src/test/*.md Builds/*/README.md)
Builds/*/README.md) list(APPEND doxygen_input
list (APPEND doxygen_input README.md
README.md RELEASENOTES.md
RELEASENOTES.md src/README.md)
src/README.md) set(dependencies "${doxygen_input}" "${doxyfile}")
set (dependencies "${doxygen_input}" "${doxyfile}")
function(verbose_find_path variable name)
function (verbose_find_path variable name) # find_path sets a CACHE variable, so don't try using a "local" variable.
# find_path sets a CACHE variable, so don't try using a "local" variable. find_path(${variable} "${name}" ${ARGN})
find_path (${variable} "${name}" ${ARGN}) if(NOT ${variable})
if (NOT ${variable}) message(NOTICE "could not find ${name}")
message (NOTICE "could not find ${name}") else()
else () message(STATUS "found ${name}: ${${variable}}/${name}")
message (STATUS "found ${name}: ${${variable}}/${name}") endif()
endif () endfunction()
endfunction ()
verbose_find_path(doxygen_plantuml_jar_path plantuml.jar PATH_SUFFIXES share/plantuml)
verbose_find_path (doxygen_plantuml_jar_path plantuml.jar PATH_SUFFIXES share/plantuml) verbose_find_path(doxygen_dot_path dot)
verbose_find_path (doxygen_dot_path dot)
# https://en.cppreference.com/w/Cppreference:Archives
# https://en.cppreference.com/w/Cppreference:Archives # https://stackoverflow.com/questions/60822559/how-to-move-a-file-download-from-configure-step-to-build-step
# https://stackoverflow.com/questions/60822559/how-to-move-a-file-download-from-configure-step-to-build-step set(download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake")
set (download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake") file(WRITE
file (WRITE "${download_script}"
"${download_script}" "file(DOWNLOAD \
"file (DOWNLOAD \ http://upload.cppreference.com/mwiki/images/b/b2/html_book_20190607.zip \
http://upload.cppreference.com/mwiki/images/b/b2/html_book_20190607.zip \ ${CMAKE_BINARY_DIR}/docs/cppreference.zip \
${CMAKE_BINARY_DIR}/docs/cppreference.zip \ EXPECTED_HASH MD5=82b3a612d7d35a83e3cb1195a63689ab \
EXPECTED_HASH MD5=82b3a612d7d35a83e3cb1195a63689ab \ )\n \
)\n \ execute_process( \
execute_process ( \ COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \ )\n"
)\n" )
) set(tagfile "${CMAKE_BINARY_DIR}/docs/cppreference-doxygen-web.tag.xml")
set (tagfile "${CMAKE_BINARY_DIR}/docs/cppreference-doxygen-web.tag.xml") add_custom_command(
add_custom_command ( OUTPUT "${tagfile}"
OUTPUT "${tagfile}" COMMAND "${CMAKE_COMMAND}" -P "${download_script}"
COMMAND "${CMAKE_COMMAND}" -P "${download_script}" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs" )
) set(doxygen_tagfiles "${tagfile}=http://en.cppreference.com/w/")
set (doxygen_tagfiles "${tagfile}=http://en.cppreference.com/w/")
add_custom_command(
add_custom_command ( OUTPUT "${doxygen_index_file}"
OUTPUT "${doxygen_index_file}" COMMAND "${CMAKE_COMMAND}" -E env
COMMAND "${CMAKE_COMMAND}" -E env "DOXYGEN_OUTPUT_DIRECTORY=${doxygen_output_directory}"
"DOXYGEN_OUTPUT_DIRECTORY=${doxygen_output_directory}" "DOXYGEN_INCLUDE_PATH=${doxygen_include_path}"
"DOXYGEN_INCLUDE_PATH=${doxygen_include_path}" "DOXYGEN_TAGFILES=${doxygen_tagfiles}"
"DOXYGEN_TAGFILES=${doxygen_tagfiles}" "DOXYGEN_PLANTUML_JAR_PATH=${doxygen_plantuml_jar_path}"
"DOXYGEN_PLANTUML_JAR_PATH=${doxygen_plantuml_jar_path}" "DOXYGEN_DOT_PATH=${doxygen_dot_path}"
"DOXYGEN_DOT_PATH=${doxygen_dot_path}" "${DOXYGEN_EXECUTABLE}" "${doxyfile}"
"${DOXYGEN_EXECUTABLE}" "${doxyfile}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" DEPENDS "${dependencies}" "${tagfile}")
DEPENDS "${dependencies}" "${tagfile}") add_custom_target(docs
add_custom_target (docs DEPENDS "${doxygen_index_file}"
DEPENDS "${doxygen_index_file}" SOURCES "${dependencies}")
SOURCES "${dependencies}")
endif ()

View File

@@ -58,6 +58,12 @@ endif ()
include(RippledCompiler) include(RippledCompiler)
include(RippledInterface) include(RippledInterface)
option(only_docs "Include only the docs target?" FALSE)
include(RippledDocs)
if(only_docs)
return()
endif()
### ###
include(deps/Boost) include(deps/Boost)
@@ -119,5 +125,4 @@ include(RippledCore)
include(RippledInstall) include(RippledInstall)
include(RippledCov) include(RippledCov)
include(RippledMultiConfig) include(RippledMultiConfig)
include(RippledDocs)
include(RippledValidatorKeys) include(RippledValidatorKeys)