summaryrefslogtreecommitdiff
path: root/.github/workflows/doxygen.yml
blob: 22896a0049898bc026f5b2072a5f1a5083f3475e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Generate and Deploy Doxygen Documentation
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      # Checkout the repository
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      # Install dependencies
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y doxygen graphviz python3-pip

      # Clone m.css and set up Python
      - name: Set up m.css
        run: |
          git clone --depth 1 https://github.com/mosra/m.css.git
          pip install pillow matplotlib
      
      # List contents to debug
      - name: Debug m.css directory
        run: |
          echo "Listing m.css contents:"
          find mcss -type f | grep -E "\.css$"

      # Prepare documentation configuration
      - name: Prepare Doxygen configuration
        run: |
          mkdir -p docs
          # Use Python to generate the CSS
          python3 mcss/documentation/css.py dark documentation

      # Generate Doxygen configuration file
      - name: Generate Doxyfile
        run: |
          cat > docs/Doxyfile << EOL
          # General configuration
          PROJECT_NAME           = fbgl
          PROJECT_NUMBER         = 0.1.0
          PROJECT_BRIEF          = "Documentation for the fbgl library"
          OUTPUT_DIRECTORY       = docs
          CREATE_SUBDIRS         = YES
          OPTIMIZE_OUTPUT_FOR_C  = YES
          GENERATE_HTML          = YES
          GENERATE_LATEX         = NO
          GENERATE_MAN           = NO
          GENERATE_RTF           = NO
          GENERATE_XML           = NO

          # Input sources
          INPUT                  = fbgl.h README.md
          FILE_PATTERNS          = *.h README.md
          RECURSIVE              = NO
          EXCLUDE_PATTERNS       = test/*

          # Markdown support
          USE_MDFILE_AS_MAINPAGE = README.md
          MARKDOWN_SUPPORT       = YES

          # Extract documentation
          EXTRACT_ALL            = YES
          EXTRACT_PRIVATE        = NO
          EXTRACT_STATIC         = YES
          EXTRACT_LOCAL_CLASSES  = YES
          EXTRACT_LOCAL_METHODS  = YES

          # Source browsing
          SOURCE_BROWSER         = YES
          INLINE_SOURCES         = YES
          REFERENCED_BY_RELATION = YES
          REFERENCES_RELATION    = YES

          # Documentation styling for m.css
          HTML_OUTPUT            = html
          HTML_EXTRA_STYLESHEET  = "\
              m.css/output/m-dark.compiled.css \
              m.css/output/m-documentation.compiled.css"
          HTML_DYNAMIC_SECTIONS  = YES
          GENERATE_TREEVIEW      = YES

          # Search functionality
          SEARCHENGINE           = YES
          SERVER_BASED_SEARCH    = NO
          EXTERNAL_SEARCH        = NO
          SEARCHDATA_FILE        = searchdata.xml

          # Warnings
          WARNINGS               = YES
          WARN_IF_UNDOCUMENTED   = YES
          WARN_NO_PARAMDOC       = YES
          WARN_FORMAT            = "\$file:\$line: \$text"

          # Extra configurations
          ALIASES                = "note=\par\textbf{Note:}"
          ALIASES               += "todo=\par\textbf{TODO:}"
          ALIASES               += "bug=\par\textbf{Bug:}"
          EXCLUDE_SYMBOLS        = "*Test*"

          # Graph and diagram support
          HAVE_DOT               = YES
          DOT_GRAPH_MAX_NODES    = 50
          DOT_TRANSPARENT        = YES
          DOT_IMAGE_FORMAT       = svg
          CALL_GRAPH             = YES
          CALLER_GRAPH           = YES
          CLASS_DIAGRAMS         = YES
          DOT_MULTI_TARGETS      = YES
          EOL

      # Generate Doxygen documentation
      - name: Generate Doxygen documentation
        run: |
          # Ensure output directory exists
          mkdir -p m.css/output
          # Generate CSS using m.css Python script
          python3 mcss/documentation/css.py dark documentation
          # Run Doxygen
          doxygen docs/Doxyfile

      # Deploy to GitHub Pages
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: docs/html
          force_orphan: true
          full_commit_message: Update documentation