From 7e9d94030c7ad80958adbbab1abfba190765f97f Mon Sep 17 00:00:00 2001 From: Michael Beliaev <98290889+MichaelBCG@users.noreply.github.com> Date: Thu, 28 Mar 2024 18:59:08 +0100 Subject: [PATCH] Add Doxygen functionality on Linux GitHub Workflow --- docs/replace-path-backslashes.py | 45 +++++++++++ github_workflows/workflows/doxygen-linux.yml | 85 ++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 docs/replace-path-backslashes.py create mode 100644 github_workflows/workflows/doxygen-linux.yml diff --git a/docs/replace-path-backslashes.py b/docs/replace-path-backslashes.py new file mode 100644 index 0000000..c4886bd --- /dev/null +++ b/docs/replace-path-backslashes.py @@ -0,0 +1,45 @@ +# This script is designed to replace back slashes ("\") with forward slashes ("/") in file paths in a Doxygen config file (Doxyfile). +# Back slashes are used in Windows paths, while forward slashes are used in Linux paths. +# Use this script if you are running Doxygen on a Linux system. + +# Usage: python replace-backslashes.py +# Example of usage: +# py replace-path-backslashes.py Doxyfile + +# Example of usage in GitHub Workflow: +# - name: Replace back slashes +# run: | +# py devops_ue/docs/replace-path-backslashes.py devops_data/Doxyfile +# working-directory: ${{ github.workspace }} + +import sys +import os +import re + +def process_line(line): + # Check if the line is a comment + if line.startswith('#'): + return line + + # Replace "\" with "/" except in specified cases + line = re.sub(r'(?") + sys.exit(1) + + file_path = sys.argv[1] + # Construct the absolute path based on the current working directory + file_path = os.path.abspath(file_path) + process_file(file_path) diff --git a/github_workflows/workflows/doxygen-linux.yml b/github_workflows/workflows/doxygen-linux.yml new file mode 100644 index 0000000..89f1bdf --- /dev/null +++ b/github_workflows/workflows/doxygen-linux.yml @@ -0,0 +1,85 @@ +## Uncomment/add the branches to run this Workflow on them +name: Game Documentation (Linux workflow) +on: + push: + branches: + #- main + - not-existing-branch + pull_request: + branches: + #- main + - not-existing-branch + +## This is for deploy-pages +permissions: + pages: write + deployments: write + id-token: write + +jobs: + docs: + runs-on: ubuntu-latest + + ## This is for deploy-pages + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Check Installed Software + run: | + python --version + pip --version + git --version + + - name: Determine Python path + id: find_python_path + run: | + # Find the path to Python executable + PYTHON_EXEC=$(command -v python) + echo "PYTHON_EXEC=$PYTHON_EXEC" >> $GITHUB_ENV + + ## py command is used in Doxyfile tags + - name: Create symbolic link for py command + run: | + # Create symbolic link named "py" pointing to Python executable + sudo ln -s $PYTHON_EXEC /usr/bin/py + + - name: Verify py command + run: | + # Verify py command by checking its version + py --version + + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Install Doxygen + run: | + sudo apt-get update + sudo apt-get install -y doxygen + + - name: Verify Doxygen installation + run: doxygen --version + + ## Path tags in Doxyfile must have forward slashes on Linux + - name: Replace back slashes + run: | + py devops_ue/docs/replace-path-backslashes.py devops_data/Doxyfile + working-directory: ${{ github.workspace }} + + - name: Run Doxygen + run: doxygen devops_data/Doxyfile + + - name: Upload Docs to GitHub Pages + uses: actions/upload-pages-artifact@v3 + with: + path: Documentation/html + + - name: Setup GitHub Pages + uses: actions/configure-pages@v4 + + - name: Deploy To GitHub Pages + id: deployment + uses: actions/deploy-pages@v4