forked from lthn/blockchain
Dev 12 documentation overhaul (#13)
Introduces a 'docs' submodule for project documentation and integrates MkDocs build steps via CMake and Makefile.
This commit is contained in:
parent
2f1011e27c
commit
bf22a89733
10 changed files with 124 additions and 30 deletions
3
.github/workflows/_on-pr-fast.yml
vendored
3
.github/workflows/_on-pr-fast.yml
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
name: PR Fast
|
name: PR Fast
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
on:
|
on:
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
|
||||||
3
.github/workflows/_on-pr.yml
vendored
3
.github/workflows/_on-pr.yml
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
name: PR
|
name: PR
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
on:
|
on:
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
|
||||||
6
.github/workflows/_on-push.yml
vendored
6
.github/workflows/_on-push.yml
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
name: Push Full Build
|
name: Push Full Build
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
on:
|
on:
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
@ -38,3 +39,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-docs:
|
||||||
|
name: Docs
|
||||||
|
uses: ./.github/workflows/build-docs.yml
|
||||||
|
|
|
||||||
3
.github/workflows/_on-release.yml
vendored
3
.github/workflows/_on-release.yml
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
name: Push Full Build
|
name: Push Full Build
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
on:
|
on:
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
|
||||||
44
.github/workflows/build-docs.yml
vendored
Normal file
44
.github/workflows/build-docs.yml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
name: docs
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- name: Install Conan
|
||||||
|
uses: conan-io/setup-conan@v1
|
||||||
|
with:
|
||||||
|
home: ${{ github.workspace }}/build/sdk
|
||||||
|
cache_packages: true
|
||||||
|
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: ${{ github.ref }}
|
||||||
|
path: .cache
|
||||||
|
- run: sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||||
|
- run: pip install mkdocs-git-revision-date-localized-plugin cairosvg mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging]
|
||||||
|
|
||||||
|
- name: Build Offline Version
|
||||||
|
run: make docs
|
||||||
|
|
||||||
|
- name: Zip Build
|
||||||
|
run: |
|
||||||
|
cd build/docs
|
||||||
|
zip -qq -r ../documentation.zip *
|
||||||
|
|
||||||
|
- name: Upload Artifacts
|
||||||
|
uses: actions/upload-artifact@v4.6.2
|
||||||
|
with:
|
||||||
|
name: Documentation
|
||||||
|
path: build/documentation.zip
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -7,3 +7,6 @@
|
||||||
[submodule "contrib/tor-connect"]
|
[submodule "contrib/tor-connect"]
|
||||||
path = contrib/tor-connect
|
path = contrib/tor-connect
|
||||||
url = https://github.com/hyle-team/tor-connect.git
|
url = https://github.com/hyle-team/tor-connect.git
|
||||||
|
[submodule "docs"]
|
||||||
|
path = docs
|
||||||
|
url = https://github.com/letheanVPN/documentation.git
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}")
|
||||||
|
|
||||||
list(INSERT CMAKE_MODULE_PATH 0
|
list(INSERT CMAKE_MODULE_PATH 0
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
include(DocBuilder)
|
||||||
|
|
||||||
if(POLICY CMP0043)
|
if(POLICY CMP0043)
|
||||||
cmake_policy(SET CMP0043 NEW)
|
cmake_policy(SET CMP0043 NEW)
|
||||||
|
|
|
||||||
43
Makefile
43
Makefile
|
|
@ -1,3 +1,4 @@
|
||||||
|
# Copyright (c) 2017-2025 Lethean https://lt.hn
|
||||||
# Copyright (c) 2014-2019 Zano Project
|
# Copyright (c) 2014-2019 Zano Project
|
||||||
# Copyright (c) 2014 The Cryptonote developers
|
# Copyright (c) 2014 The Cryptonote developers
|
||||||
# Distributed under the MIT/X11 software license, see the accompanying
|
# Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
|
@ -53,37 +54,15 @@ CPU_CORES := $(or $(CPU_CORES),1)
|
||||||
CPU_CORES := $(shell expr $(CPU_CORES) + 0 2>/dev/null || echo 1)
|
CPU_CORES := $(shell expr $(CPU_CORES) + 0 2>/dev/null || echo 1)
|
||||||
CONAN_CPU_COUNT=$(CPU_CORES)
|
CONAN_CPU_COUNT=$(CPU_CORES)
|
||||||
|
|
||||||
ifneq ($(OS),Windows_NT)
|
|
||||||
system := $(shell uname)
|
|
||||||
ifneq (, $(findstring MINGW, $(system)))
|
|
||||||
cmake_gen = -G 'MSYS Makefiles'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
PROFILES := $(patsubst cmake/profiles/%,%,$(wildcard cmake/profiles/*))
|
PROFILES := $(patsubst cmake/profiles/%,%,$(wildcard cmake/profiles/*))
|
||||||
SORTED_PROFILES := $(sort $(PROFILES))
|
SORTED_PROFILES := $(sort $(PROFILES))
|
||||||
CONAN_CACHE := $(CURDIR)/build/sdk
|
CONAN_CACHE := $(CURDIR)/build/sdk
|
||||||
DEFAULT_CONAN_PROFILE := $(CONAN_CACHE)/cmake/profiles/default
|
DEFAULT_CONAN_PROFILE := $(CONAN_CACHE)/cmake/profiles/default
|
||||||
|
|
||||||
cmake = cmake $(cmake_gen)
|
|
||||||
|
|
||||||
cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug
|
|
||||||
cmake_release = $(cmake) -D CMAKE_BUILD_TYPE=Release
|
|
||||||
|
|
||||||
cmake_gui = -D BUILD_GUI=ON
|
|
||||||
cmake_static = -D STATIC=ON
|
|
||||||
cmake_tests = -D BUILD_TESTS=ON
|
|
||||||
|
|
||||||
# Helper macro
|
|
||||||
define CMAKE
|
|
||||||
mkdir -p $1 && cd $1 && $2 ../../
|
|
||||||
endef
|
|
||||||
|
|
||||||
build = build
|
|
||||||
dir_debug = $(build)/debug
|
|
||||||
dir_release = $(build)/release
|
|
||||||
|
|
||||||
all: help
|
all: help
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
release: conan-profile-detect
|
release: conan-profile-detect
|
||||||
@echo "Building profile: release"
|
@echo "Building profile: release"
|
||||||
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=Release
|
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=Release
|
||||||
|
|
@ -146,10 +125,24 @@ test-debug:
|
||||||
cmake --build build/test-debug --config=Debug --parallel=$(CPU_CORES)
|
cmake --build build/test-debug --config=Debug --parallel=$(CPU_CORES)
|
||||||
$(MAKE) test
|
$(MAKE) test
|
||||||
|
|
||||||
|
configure:
|
||||||
|
@echo "Running Config: release"
|
||||||
|
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=Release
|
||||||
|
cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
|
docs: configure
|
||||||
|
@echo "Building Documentation"
|
||||||
|
cmake --build build/release --target=docs --config=Release --parallel=$(CPU_CORES)
|
||||||
|
|
||||||
|
docs-dev: configure
|
||||||
|
@echo "Building Documentation"
|
||||||
|
cmake --build build/release --target=serve_docs --config=Release
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
||||||
|
|
||||||
.PHONY: all release debug static static-release gui gui-release gui-static gui-release-static gui-debug test test-release test-debug clean tags conan-profile-detect $(PROFILES)
|
.PHONY: all release debug docs docs-dev configure static static-release test test-release test-debug clean tags conan-profile-detect $(PROFILES)
|
||||||
|
|
|
||||||
46
cmake/DocBuilder.cmake
Normal file
46
cmake/DocBuilder.cmake
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
set(MKDOCS_SRC "${CMAKE_SOURCE_DIR}/docs")
|
||||||
|
set(MKDOCS_OUT "${CMAKE_BINARY_DIR}/../docs")
|
||||||
|
|
||||||
|
message("MKDocs src: ${MKDOCS_SRC} > ${MKDOCS_OUT}")
|
||||||
|
|
||||||
|
file(MAKE_DIRECTORY "${MKDOCS_OUT}")
|
||||||
|
|
||||||
|
add_custom_target(docs
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env PYTHONUNBUFFERED=1
|
||||||
|
mkdocs build
|
||||||
|
--clean
|
||||||
|
--site-dir "${MKDOCS_OUT}"
|
||||||
|
--config-file "${MKDOCS_SRC}/mkdocs.yml"
|
||||||
|
WORKING_DIRECTORY "${MKDOCS_SRC}"
|
||||||
|
COMMENT "Generating documentation with MkDocs"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
# Optional install step
|
||||||
|
install(DIRECTORY "${MKDOCS_OUT}/"
|
||||||
|
DESTINATION "share/doc/${PROJECT_NAME}"
|
||||||
|
COMPONENT docs)
|
||||||
|
|
||||||
|
add_custom_target(install-docs
|
||||||
|
DEPENDS docs
|
||||||
|
COMMAND "${CMAKE_COMMAND}" --install . --component docs
|
||||||
|
COMMENT "Installing documentation")
|
||||||
|
|
||||||
|
# Name of the target that launches the dev server
|
||||||
|
add_custom_target(
|
||||||
|
serve_docs # ← invoke with `make serve_docs`
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env PYTHONUNBUFFERED=1
|
||||||
|
# On Windows we need to run the command through the shell
|
||||||
|
# so that the `&&` operator works correctly.
|
||||||
|
${CMAKE_COMMAND} -E env
|
||||||
|
mkdocs serve
|
||||||
|
--dev-addr "127.0.0.1:8000" # optional – explicit bind address
|
||||||
|
--watch "${MKDOCS_SRC}" # watch source files for changes
|
||||||
|
--config-file "${MKDOCS_SRC}/mkdocs.yml"
|
||||||
|
WORKING_DIRECTORY "${MKDOCS_SRC}"
|
||||||
|
USES_TERMINAL # tells CMake to attach the child process to the console
|
||||||
|
COMMENT "Starting MkDocs live‑preview server (Ctrl‑C to stop)"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
add_dependencies(serve_docs docs) # ensures the static site is up‑to‑date before serving
|
||||||
1
docs
Submodule
1
docs
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit eb47d517d3ddb2751fc5645d1e06b423588f6cb9
|
||||||
Loading…
Add table
Reference in a new issue