Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub workflow to publish docs on GitHub #3302

Closed
wants to merge 13 commits into from
Closed
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and publish documentation
on:
push:
branches:
- develop

jobs:
job:
runs-on: ubuntu-18.04
steps:
- name: checkout
uses: actions/checkout@v2
- name: set OUTPUT_DIRECTORY
run: echo 'OUTPUT_DIRECTORY = html' >> docs/Doxyfile
- name: build
uses: mattnotmitt/doxygen-action@v1
with:
doxyfile-path: 'docs/Doxyfile'
- name: publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./html
89 changes: 65 additions & 24 deletions Builds/CMake/RippledDocs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,70 @@
#]===================================================================]

find_package (Doxygen)
if (TARGET Doxygen::doxygen)
set (doc_srcs docs/source.dox)
file (GLOB_RECURSE other_docs docs/*.md)
list (APPEND doc_srcs "${other_docs}")
# read the source config and make a modified one
# that points the output files to our build directory
file (READ "${CMAKE_CURRENT_SOURCE_DIR}/docs/source.dox" dox_content)
string (REGEX REPLACE "[\t ]*OUTPUT_DIRECTORY[\t ]*=(.*)"
"OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}\n\\1"
new_config "${dox_content}")
file (WRITE "${CMAKE_BINARY_DIR}/source.dox" "${new_config}")
add_custom_target (docs
COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/source.dox"
BYPRODUCTS "${CMAKE_BINARY_DIR}/html_doc/index.html"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs"
SOURCES "${doc_srcs}")
if (is_multiconfig)
set_property (
SOURCE ${doc_srcs}
APPEND
PROPERTY HEADER_FILE_ONLY
true)
endif ()
else ()
if (NOT TARGET Doxygen::doxygen)
message (STATUS "doxygen executable not found -- skipping docs target")
return ()
endif ()

set (doxygen_output_directory "${CMAKE_BINARY_DIR}/docs/html")
set (doxygen_index_file "${doxygen_output_directory}/index.html")
set (doxyfile "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile")

file (GLOB_RECURSE doxygen_input
docs/*.md
src/ripple/*.h
src/ripple/*.md
src/test/*.h
src/test/*.md
Builds/*/README.md)
list (APPEND doxygen_input
README.md
RELEASENOTES.md
src/README.md)
set (dependencies "${doxygen_input}" "${doxyfile}")

find_path (doxygen_plantuml_jar_path plantuml.jar PATH_SUFFIXES share/plantuml)
if (NOT doxygen_plantuml_jar_path)
set (doxygen_plantuml_jar_path)
endif ()

# https://en.cppreference.com/w/Cppreference:Archives
# https://stackoverflow.com/questions/60822559/how-to-move-a-file-download-from-configure-step-to-build-step
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice comment!

set (download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake")
file (WRITE
"${download_script}"
"file (DOWNLOAD \
http://upload.cppreference.com/mwiki/images/b/b2/html_book_20190607.zip \
${CMAKE_BINARY_DIR}/docs/cppreference.zip \
EXPECTED_HASH MD5=82b3a612d7d35a83e3cb1195a63689ab \
)\n \
execute_process ( \
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
)\n"
)
set (tagfile "${CMAKE_BINARY_DIR}/docs/cppreference-doxygen-web.tag.xml")
add_custom_command (
OUTPUT "${tagfile}"
COMMAND "${CMAKE_COMMAND}" -P "${download_script}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs"
)
set (doxygen_tagfiles "${tagfile}=http://en.cppreference.com/w/")

add_custom_command (
OUTPUT "${doxygen_index_file}"
COMMAND "${CMAKE_COMMAND}" -E env
"DOXYGEN_OUTPUT_DIRECTORY=${doxygen_output_directory}"
"DOXYGEN_TAGFILES=${doxygen_tagfiles}"
"DOXYGEN_PLANTUML_JAR_PATH=${doxygen_plantuml_jar_path}"
"${DOXYGEN_EXECUTABLE}" "${doxyfile}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS "${dependencies}" "${tagfile}")
add_custom_target (docs
DEPENDS "${doxygen_index_file}"
SOURCES "${dependencies}")
if (is_multiconfig)
set_property (
SOURCE ${dependencies}
APPEND PROPERTY
HEADER_FILE_ONLY true)
endif ()
2 changes: 1 addition & 1 deletion bin/ci/ubuntu/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ${time} eval cmake --build . ${BUILDARGS} -- ${BUILDTOOLARGS}
if [[ ${TARGET} == "docs" ]]; then
## mimic the standard test output for docs build
## to make controlling processes like jenkins happy
if [ -f html_doc/index.html ]; then
if [ -f docs/html/index.html ]; then
echo "1 case, 1 test total, 0 failures"
else
echo "1 case, 1 test total, 1 failures"
Expand Down
5 changes: 3 additions & 2 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ RUN rm -rf /tmp/doxygen-1.8.14

RUN mkdir -p /opt/plantuml
RUN wget -O /opt/plantuml/plantuml.jar http://sourceforge.net/projects/plantuml/files/plantuml.jar/download
ENV PLANTUML_JAR=/opt/plantuml/plantuml.jar
ENV DOXYGEN_PLANTUML_JAR_PATH=/opt/plantuml/plantuml.jar

CMD cd /opt/rippled/docs && doxygen source.dox
ENV DOXYGEN_OUTPUT_DIRECTORY=html
CMD cd /opt/rippled && doxygen docs/Doxyfile
94 changes: 20 additions & 74 deletions docs/source.dox → docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PROJECT_NUMBER =
PROJECT_BRIEF = C++ Library
PROJECT_LOGO =
PROJECT_LOGO = images/LogoForDocumentation.png
OUTPUT_DIRECTORY =
OUTPUT_DIRECTORY = $(DOXYGEN_OUTPUT_DIRECTORY)
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
Expand All @@ -17,7 +17,7 @@ ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH = ../src/
STRIP_FROM_PATH = src/
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
Expand Down Expand Up @@ -83,7 +83,7 @@ ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
SHOW_FILES = NO
SHOW_NAMESPACES = NO
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
Expand All @@ -104,71 +104,17 @@ WARN_LOGFILE =
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = \
\
../src/ripple/app/misc/TxQ.h \
../src/ripple/app/tx/apply.h \
../src/ripple/app/tx/applySteps.h \
../src/ripple/protocol/STObject.h \
../src/ripple/protocol/JsonFields.h \
../src/test/jtx/AbstractClient.h \
../src/test/jtx/JSONRPCClient.h \
../src/test/jtx/WSClient.h \
../src/ripple/consensus/Consensus.h \
../src/ripple/consensus/ConsensusProposal.h \
../src/ripple/consensus/ConsensusTypes.h \
../src/ripple/consensus/DisputedTx.h \
../src/ripple/consensus/LedgerTiming.h \
../src/ripple/consensus/LedgerTrie.h \
../src/ripple/consensus/Validations.h \
../src/ripple/consensus/ConsensusParms.h \
../src/ripple/app/consensus/RCLCxTx.h \
../src/ripple/app/consensus/RCLCxLedger.h \
../src/ripple/app/consensus/RCLConsensus.h \
../src/ripple/app/consensus/RCLCxPeerPos.h \
../src/ripple/app/tx/apply.h \
../src/ripple/app/tx/applySteps.h \
../src/ripple/app/tx/impl/InvariantCheck.h \
../src/ripple/app/consensus/RCLValidations.h \
../src/README.md \
../src/ripple/README.md \
../README.md \
../RELEASENOTES.md \
../docs/CodingStyle.md \
../docs/CheatSheet.md \
../docs/README.md \
../docs/sample_chart.doc \
../docs/HeapProfiling.md \
../docs/Docker.md \
../docs/consensus.md \
../Builds/macos/README.md \
../Builds/linux/README.md \
../Builds/VisualStudio2017/README.md \
../src/ripple/consensus/README.md \
../src/ripple/app/consensus/README.md \
../src/test/csf/README.md \
../src/ripple/basics/README.md \
../src/ripple/crypto/README.md \
../src/ripple/peerfinder/README.md \
../src/ripple/app/misc/README.md \
../src/ripple/app/misc/FeeEscalation.md \
../src/ripple/app/ledger/README.md \
../src/ripple/app/paths/README.md \
../src/ripple/app/tx/README.md \
../src/ripple/proto/README.md \
../src/ripple/shamap/README.md \
../src/ripple/protocol/README.md \
../src/ripple/json/README.md \
../src/ripple/json/TODO.md \
../src/ripple/resource/README.md \
../src/ripple/rpc/README.md \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these READMEs still included in the documentation? I can't seem to find them at https://thejohnfreeman.github.io/rippled/. For instance, where do I find src/ripple/rpc/README.md?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're all under Related Pages: https://thejohnfreeman.github.io/rippled/pages.html

To find a given document, you need to know its title. I'd like to go through and re-title them all to make them easier to find in the Related Pages list. src/ripple/rpc/README.md is at https://thejohnfreeman.github.io/rippled/md_ripple_rpc_README.html

../src/ripple/overlay/README.md \
../src/ripple/nodestore/README.md \
../src/ripple/nodestore/Benchmarks.md \
docs \
src/ripple \
src/test \
src/README.md \
README.md \
RELEASENOTES.md \


INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
FILE_PATTERNS = *.h *.cpp *.md
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
Expand All @@ -177,20 +123,20 @@ EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = \
./images/ \
./images/consensus/ \
../src/test/csf/ \
docs/images/ \
docs/images/consensus/ \
src/test/csf/ \

INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE = ../src/README.md
USE_MDFILE_AS_MAINPAGE = src/README.md

#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
Expand All @@ -213,7 +159,7 @@ IGNORE_PREFIX =
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html_doc
HTML_OUTPUT = .
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
Expand Down Expand Up @@ -340,7 +286,7 @@ ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH = ../
INCLUDE_PATH = ./
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN \
GENERATING_DOCS \
Expand All @@ -353,7 +299,7 @@ SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
TAGFILES = $(DOXYGEN_TAGFILES)
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
Expand Down Expand Up @@ -390,7 +336,7 @@ DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH = $(PLANTUML_JAR)
PLANTUML_JAR_PATH = $(DOXYGEN_PLANTUML_JAR_PATH)
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
Expand Down
31 changes: 15 additions & 16 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Building documentation

## Specifying Files

To specify the source files for which to build documentation, modify `INPUT`
and its related fields in `docs/source.dox`. Note that the `INPUT` paths are
relative to the `docs/` directory.

## Install Dependencies

### Windows
Expand All @@ -30,7 +24,7 @@ Install these dependencies:

### [Optional] Install Plantuml (all platforms)

Doxygen supports the optional use of [plantuml](http://plantuml.com) to
Doxygen supports the optional use of [plantuml](http://plantuml.com) to
generate diagrams from `@startuml` sections. We don't currently rely on this
functionality for docs, so it's largely optional. Requirements:

Expand All @@ -40,22 +34,28 @@ functionality for docs, so it's largely optional. Requirements:
Set a system environment variable named `PLANTUML_JAR` with a value of the fullpath
to the file system location of the `plantuml.jar` file you downloaded.

## Do it

### all platforms
## Configuration

You should set these environment variables:

- `DOXYGEN_OUTPUT_DIRECTORY`
- `DOXYGEN_PLANTUML_JAR_PATH`

## Build

From the rippled root folder:

```
cd docs
mkdir -p html_doc
doxygen source.dox
doxygen docs/Doxyfile
```
The output will be in `docs/html_doc`.

The output will be wherever you chose for `DOXYGEN_OUTPUT_DIRECTORY`.

## Docker

(applicable to all platforms)

Instead of installing the doxygen tools locally, you can use the provided `Dockerfile` to create
an ubuntu based image for running the tools:

Expand All @@ -72,5 +72,4 @@ Then to run the image, from the rippled root folder:
sudo docker run -v $PWD:/opt/rippled --rm rippled-docs
```

The output will be in `docs/html_doc`.

The output will be in `html`.