blob: d418468b9882c89094b6391d716fe7f380fcdca9 (
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
140
141
142
143
144
145
146
147
148
149
150
|
name: Generate and Deploy Documentation
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch: # Allow manual triggering
permissions:
contents: read
pages: write
id-token: write
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz ghostscript
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install jinja2 Pygments
- name: Clone Doxygen Awesome
run: |
git clone https://github.com/jothepro/doxygen-awesome-css.git
- name: Generate Doxyfile
run: |
doxygen -g Doxyfile
- name: Customize Doxyfile
run: |
# Project details
sed -i 's/PROJECT_NAME = "My Project"/PROJECT_NAME = "FBGL"/' Doxyfile
sed -i 's/PROJECT_BRIEF = /PROJECT_BRIEF = "Fast and Lightweight Framebuffer Graphics Library"/' Doxyfile
# Output and input configuration
sed -i 's/OUTPUT_DIRECTORY = /OUTPUT_DIRECTORY = docs/' Doxyfile
sed -i 's/INPUT = /INPUT = fbgl.h README.md/' Doxyfile
sed -i 's/RECURSIVE = NO/RECURSIVE = YES/' Doxyfile
# Documentation generation options
sed -i 's/GENERATE_HTML = NO/GENERATE_HTML = YES/' Doxyfile
sed -i 's/HAVE_DOT = NO/HAVE_DOT = YES/' Doxyfile
sed -i 's/DOT_IMAGE_FORMAT = png/DOT_IMAGE_FORMAT = svg/' Doxyfile
# Doxygen Awesome specific configurations
echo "HTML_EXTRA_STYLESHEET = $GITHUB_WORKSPACE/doxygen-awesome-css/doxygen-awesome.css" >> Doxyfile
echo "HTML_COLORSTYLE = LIGHT" >> Doxyfile
# Additional configuration
echo "GENERATE_LATEX = NO" >> Doxyfile
echo "INTERACTIVE_SVG = YES" >> Doxyfile
echo "EXTRACT_ALL = YES" >> Doxyfile
echo "EXTRACT_PRIVATE = NO" >> Doxyfile
echo "CASE_SENSE_NAMES = NO" >> Doxyfile
echo "SEARCHENGINE = YES" >> Doxyfile
echo "USE_MDFILE_AS_MAINPAGE = README.md" >> Doxyfile
echo "MARKDOWN_SUPPORT = YES" >> Doxyfile
# Dark mode support
echo "HTML_EXTRA_STYLESHEET += $GITHUB_WORKSPACE/doxygen-awesome-css/doxygen-awesome-darkmode.css" >> Doxyfile
# Interactive tabs and fragment copy buttons
echo "HTML_EXTRA_FILES += $GITHUB_WORKSPACE/doxygen-awesome-css/doxygen-awesome-fragment-copy-button.js" >> Doxyfile
echo "HTML_EXTRA_FILES += $GITHUB_WORKSPACE/doxygen-awesome-css/doxygen-awesome-interactive-toc.js" >> Doxyfile
- name: Generate Documentation with Doxygen
run: |
doxygen Doxyfile
- name: Fallback Documentation Strategy
shell: bash
run: |
set -e
if [ -d "docs/html" ] && [ "$(ls -A docs/html)" ]; then
echo "Documentation generated successfully"
else
echo "Documentation generation failed. Creating fallback documentation."
mkdir -p docs/html
cat > docs/html/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>FBGL Documentation</title>
<style>
body { font-family: sans-serif; line-height: 1.6; max-width: 800px; margin: 0 auto; padding: 1rem; background-color: #f4f4f4; }
h1 { color: #333; border-bottom: 2px solid #666; padding-bottom: 10px; }
p { color: #666; }
.error { color: #d9534f; font-weight: bold; }
</style>
</head>
<body>
<h1>FBGL Documentation</h1>
<p class="error">Documentation generation failed.</p>
<p>Possible reasons:</p>
<ul>
<li>Doxygen configuration issue</li>
<li>Missing source files</li>
<li>Unexpected build error</li>
</ul>
<p>Please check the repository and GitHub Actions workflow for more details.</p>
</body>
</html>
EOF
fi
- name: List Documentation Contents
run: |
echo "Documentation directory contents:"
ls -R docs/html
- name: Setup GitHub Pages
uses: actions/configure-pages@v3
- name: Upload Documentation Artifact
uses: actions/upload-pages-artifact@v2
with:
path: './docs/html'
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: generate-docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
|