Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/replace-path-backslashes.py
Original file line number Diff line number Diff line change
@@ -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 <file_to_process>
# 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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

## This comment illustrates how the script works.
## Below are the pairs of lines. The first line (which is commented) in each pair is an original line with back slashes "\". It was not be affected by the script
## The second line (which is not commented) in each pair is the result illustrating how the script processed the line above it

#\ \asdf \asdf\ asdf\ asdf\asdf \
\ /asdf /asdf/ asdf/ asdf/asdf \

# \ \asdf \asdf\ asdf\ asdf\asdf \
 \ /asdf /asdf/ asdf/ asdf/asdf \

#\asdf \asdf\ asdf\ asdf\asdf
/asdf /asdf/ asdf/ asdf/asdf

#\asdf \asdf\ asdf\ asdf\asdf\
/asdf /asdf/ asdf/ asdf/asdf/

#\asdf \asdf\ asdf\ asdf \asdf
/asdf /asdf/ asdf/ asdf /asdf

#\asdf \asdf\ asdf\ asdf \asdf\
/asdf /asdf/ asdf/ asdf /asdf/

# \" \asdf \asdf\" asdf\ asdf\asdf \
 \" /asdf /asdf\" asdf/ asdf/asdf \

#\" \asdf \asdf\" asdf\ asdf\asdf \
\" /asdf /asdf\" asdf/ asdf/asdf \

# HTML_FOOTER            = devops\docs\doxygen-dark-theme\html_footer.html
HTML_FOOTER            = devops/docs/doxygen-dark-theme/html_footer.html

# HTML_EXTRA_FILES       = devops\docs\doxygen_theme_flat_design\src\img\closed-folder.png \
# devops\docs\doxygen_theme_flat_design\src\img\opened-folder.png
HTML_EXTRA_FILES       = devops/docs/doxygen_theme_flat_design/src/img/closed-folder.png \
devops/docs/doxygen_theme_flat_design/src/img/opened-folder.png

line = re.sub(r'(?<!\\)\\(?!["\s]|$)', '/', line)
line = re.sub(r'(?<=\S)\\(?=\s|$)', '/', line)
return line

def process_file(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()

with open(file_path, 'w') as file:
for line in lines:
file.write(process_line(line))

if __name__ == "__main__":
if len(sys.argv) != 2:
print("Expected usage: python replace-backslashes.py <file_to_process>")
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)
85 changes: 85 additions & 0 deletions github_workflows/workflows/doxygen-linux.yml
Original file line number Diff line number Diff line change
@@ -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