diff --git a/.github/workflows/_on-pr-fast.yml b/.github/workflows/_on-pr-fast.yml index 3e951953..a0cb7ec3 100644 --- a/.github/workflows/_on-pr-fast.yml +++ b/.github/workflows/_on-pr-fast.yml @@ -1,5 +1,6 @@ name: PR Fast - +permissions: + contents: read on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/.github/workflows/_on-pr.yml b/.github/workflows/_on-pr.yml index 518cbdb5..c465d570 100644 --- a/.github/workflows/_on-pr.yml +++ b/.github/workflows/_on-pr.yml @@ -1,5 +1,6 @@ name: PR - +permissions: + contents: read on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/.github/workflows/_on-push.yml b/.github/workflows/_on-push.yml index 4a5eb96d..f2684ffa 100644 --- a/.github/workflows/_on-push.yml +++ b/.github/workflows/_on-push.yml @@ -1,5 +1,6 @@ name: Push Full Build - +permissions: + contents: read on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -38,3 +39,6 @@ jobs: with: chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + build-docs: + name: Docs + uses: ./.github/workflows/build-docs.yml diff --git a/.github/workflows/_on-release.yml b/.github/workflows/_on-release.yml index 2ccb20ad..c89cace9 100644 --- a/.github/workflows/_on-release.yml +++ b/.github/workflows/_on-release.yml @@ -1,5 +1,6 @@ name: Push Full Build - +permissions: + contents: read on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 00000000..f5662733 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -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 diff --git a/.gitmodules b/.gitmodules index ec27910b..e522feeb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "contrib/tor-connect"] path = contrib/tor-connect url = https://github.com/hyle-team/tor-connect.git +[submodule "docs"] + path = docs + url = https://github.com/letheanVPN/documentation.git diff --git a/CMakeLists.txt b/CMakeLists.txt index aa29ef21..e72515a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}") list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - +include(DocBuilder) if(POLICY CMP0043) cmake_policy(SET CMP0043 NEW) diff --git a/Makefile b/Makefile index cb819a7d..0f5c7c87 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +# Copyright (c) 2017-2025 Lethean https://lt.hn # Copyright (c) 2014-2019 Zano Project # Copyright (c) 2014 The Cryptonote developers # 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) 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/*)) SORTED_PROFILES := $(sort $(PROFILES)) CONAN_CACHE := $(CURDIR)/build/sdk 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 + + release: conan-profile-detect @echo "Building profile: 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) $(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: rm -rf build tags: 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) diff --git a/cmake/DocBuilder.cmake b/cmake/DocBuilder.cmake new file mode 100644 index 00000000..c5b13c31 --- /dev/null +++ b/cmake/DocBuilder.cmake @@ -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 \ No newline at end of file diff --git a/docs b/docs new file mode 160000 index 00000000..eb47d517 --- /dev/null +++ b/docs @@ -0,0 +1 @@ +Subproject commit eb47d517d3ddb2751fc5645d1e06b423588f6cb9