From 7421a4c9b86a1c34bce61c1d7a03e3a1ce86e2c1 Mon Sep 17 00:00:00 2001 From: Andreas Kuhner Date: Fri, 6 Sep 2024 10:32:36 +0200 Subject: [PATCH] docs: Using github actions to build docu --- .github/workflows/doxygen.yml | 50 +++++++++++++++++++++++++++++++++++ CMakeLists.txt | 17 +++++++----- doc/Doxyfile.in | 2 +- 3 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/doxygen.yml diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml new file mode 100644 index 00000000..47ed3cd9 --- /dev/null +++ b/.github/workflows/doxygen.yml @@ -0,0 +1,50 @@ +name: Generate Doxygen documentation + +on: + push: + tags: + - '*' + pull_request: + branches: + - main + +jobs: + doxygen: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Doxygen + run: sudo apt-get install doxygen graphviz -y + + - name: Generate Doxygen configuration and build it + run: | + TAG_NAME=$(echo $GITHUB_REF | sed 's/refs\/tags\///') + echo $TAG_NAME + mkdir -p build/doc/docs/$TAG_NAME && cd build && cmake -D BUILD_DOCUMENTATION=ON -D SKIP_CXX_BUILD=ON .. && make doc + ls doc/docs + + - name: Move contents of html folder one level up + run: | + TAG_NAME=$(echo $GITHUB_REF | sed 's/refs\/tags\///') + mv build/doc/docs/$TAG_NAME/html/* build/doc/docs/$TAG_NAME/ + ls build/doc/docs/$TAG_NAME + + - name: Create index.html for redirect + run: | + TAG_NAME=$(echo $GITHUB_REF | sed 's/refs\/tags\///') + URL="https://frankaemika.github.io/libfranka/${TAG_NAME}/" + echo $URL + ls build + ls build/doc + ls build/doc/docs + echo "" > build/doc/docs/index.html + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: build/doc/docs diff --git a/CMakeLists.txt b/CMakeLists.txt index de42cb88..e4ed0f93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,13 +2,23 @@ cmake_minimum_required(VERSION 3.4) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -set(libfranka_VERSION 0.14.0) +set(libfranka_VERSION 0.14.1) project(libfranka VERSION ${libfranka_VERSION} LANGUAGES CXX ) +option(BUILD_DOCUMENTATION "Build documentation" OFF) +option(SKIP_CXX_BUILD "Skips the c++ build" OFF) +if(BUILD_DOCUMENTATION) + add_subdirectory(doc) + + if(SKIP_CXX_BUILD) + return() + endif() +endif() + list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_CXX_STANDARD 17) @@ -190,11 +200,6 @@ if(BUILD_EXAMPLES) add_subdirectory(examples) endif() -option(BUILD_DOCUMENTATION "Build documentation" OFF) -if(BUILD_DOCUMENTATION) - add_subdirectory(doc) -endif() - ## Packaging set(CPACK_PACKAGE_VENDOR "Franka Robotics GmbH") set(CPACK_GENERATOR "DEB;TGZ") diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 848559b5..6856dced 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -58,7 +58,7 @@ PROJECT_LOGO = @CMAKE_CURRENT_SOURCE_DIR@/Logo_FRANKA_ROBOTICS_dark.pn # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = +OUTPUT_DIRECTORY = "docs/@PROJECT_VERSION@" # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and