Skip to content

Commit 4984595

Browse files
committed
Improve gh pages
1 parent dfccffb commit 4984595

1 file changed

Lines changed: 93 additions & 32 deletions

File tree

Lines changed: 93 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Taken from:
2-
# - https://github.com/marketplace/actions/doxygen-github-pages-deploy-action
3-
# - https://github.com/DenverCoder1/doxygen-github-pages-action/blob/main/action.yml
4-
51
name: GH Doxygen
62

73
on:
@@ -11,71 +7,136 @@ on:
117
workflow_dispatch:
128

139
env:
14-
DOXYGEN_VERSION: 1.14.0
10+
DOXYGEN_VERSION: "1.14.0"
11+
CMAKE_VERSION: "4.0.3"
12+
GRAPHVIZ_VERSION: "13.1.1"
1513

1614
jobs:
17-
deploy:
15+
generate-docs:
1816
runs-on: ubuntu-latest
1917

2018
defaults:
2119
run:
2220
shell: bash
2321

2422
steps:
25-
- uses: actions/checkout@v3
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
2625
with:
2726
submodules: "true"
2827

29-
- name: Update Ubuntu package list
30-
run: sudo apt-get update
28+
##################################
29+
# 📦 Cache and Install CMake
30+
##################################
31+
- name: Cache CMake
32+
id: cache-cmake
33+
uses: actions/cache@v4
34+
with:
35+
path: cmake-install
36+
key: cmake-cache-${{ env.CMAKE_VERSION }}
3137

3238
- name: Install CMake
33-
run: sudo apt-get install -y cmake
34-
35-
- name: Install Graphviz (for doxygen 'dot' component)
36-
run: sudo apt-get install -y graphviz
37-
38-
- name: Prepare cache timestamp
39-
id: cache_timestamp
40-
shell: cmake -P {0}
39+
if: steps.cache-cmake.outputs.cache-hit != 'true'
4140
run: |
42-
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
43-
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
41+
mkdir -p cmake-install
42+
curl -LO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz
43+
tar -xf cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz --strip-components=1 -C cmake-install
44+
shell: bash
45+
46+
- name: Add CMake to PATH
47+
run: echo "${GITHUB_WORKSPACE}/cmake-install/bin" >> $GITHUB_PATH
4448

49+
##################################
50+
# 📦 Cache and Install Doxygen
51+
##################################
4552
- name: Cache Doxygen
4653
id: cache-doxygen
4754
uses: actions/cache@v4
4855
with:
4956
path: doxygen-${{ env.DOXYGEN_VERSION }}
50-
key: doxygen-cache-${{ steps.cache_timestamp.outputs.timestamp }}
51-
restore-keys: |
52-
doxygen-cache-
57+
key: doxygen-cache-${{ env.DOXYGEN_VERSION }}
5358

5459
- name: Install Doxygen from GitHub
5560
if: steps.cache-doxygen.outputs.cache-hit != 'true'
5661
run: |
57-
version_underscore=$(echo "$DOXYGEN_VERSION" | sed -r 's/\./_/g')
62+
version_underscore=$(echo "$DOXYGEN_VERSION" | sed 's/\./_/g')
5863
dirname=doxygen-$DOXYGEN_VERSION
5964
filename_tar=$dirname.linux.bin.tar
6065
filename_gz=$filename_tar.gz
6166
url=https://github.com/doxygen/doxygen/releases/download/Release_$version_underscore/$filename_gz
6267
wget $url
6368
gunzip $filename_gz
6469
tar xf $filename_tar
65-
echo "${GITHUB_WORKSPACE}/$dirname/bin" >> $GITHUB_PATH
70+
shell: bash
6671

72+
- name: Add Doxygen to PATH
73+
run: echo "${GITHUB_WORKSPACE}/doxygen-${{ env.DOXYGEN_VERSION }}/bin" >> $GITHUB_PATH
74+
75+
##################################
76+
# 📦 Build Graphviz (dot) from source
77+
##################################
78+
- name: Cache Graphviz (built)
79+
id: cache-graphviz
80+
uses: actions/cache@v4
81+
with:
82+
path: graphviz-install
83+
key: ${{ runner.os }}-graphviz-${{ env.GRAPHVIZ_VERSION }}
84+
85+
- name: Build & install Graphviz from source
86+
if: steps.cache-graphviz.outputs.cache-hit != 'true'
87+
run: |
88+
set -euo pipefail
89+
sudo apt-get update
90+
# Minimal toolchain + headers (gd/png/jpeg optional but nice to have)
91+
sudo apt-get install -y build-essential pkg-config libexpat1-dev \
92+
libgd-dev libpng-dev libjpeg-dev zlib1g-dev \
93+
libfreetype6-dev libfontconfig1-dev
94+
95+
curl -LO https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/${GRAPHVIZ_VERSION}/graphviz-${GRAPHVIZ_VERSION}.tar.gz
96+
tar -xf graphviz-${GRAPHVIZ_VERSION}.tar.gz
97+
cd graphviz-${GRAPHVIZ_VERSION}
98+
99+
# Keep it lean: disable language bindings to avoid extra deps
100+
./configure --prefix="${GITHUB_WORKSPACE}/graphviz-install" \
101+
--disable-swig --disable-guile --disable-java \
102+
--disable-lua --disable-perl --disable-php \
103+
--disable-python --disable-r --disable-ruby
104+
105+
make -j"$(nproc)"
106+
make install
107+
108+
- name: Add Graphviz to PATH (and lib path)
109+
run: |
110+
echo "${GITHUB_WORKSPACE}/graphviz-install/bin" >> $GITHUB_PATH
111+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/graphviz-install/lib:${LD_LIBRARY_PATH:-}" >> $GITHUB_ENV
112+
113+
- name: Check Graphviz/Doxygen
114+
run: |
115+
dot -V
116+
which dot
117+
doxygen --version
118+
119+
##################################
120+
# 📚 Generate Doxygen Documentation
121+
##################################
67122
- name: Generate Doxygen Documentation
68123
run: |
69124
mkdir build && cd build
70125
cmake .. -DBUILD_SOURCE=OFF -DDOXYGEN_GENERATE_LATEX=FALSE
71126
cmake --build . --target doxygen
72127
73-
- name: Create .nojekyll (ensures pages with underscores work on gh pages)
74-
run: touch docs/doxygen/build/html/.nojekyll
75-
76-
- name: Deploy to GitHub Pages
77-
uses: JamesIves/github-pages-deploy-action@v4.4.1
128+
##################################
129+
# 🚀 Deploy to GitHub Pages
130+
##################################
131+
- name: Upload documentation to GitHub Pages
132+
uses: peaceiris/actions-gh-pages@v4
78133
with:
79-
branch: gh-pages
80-
folder: docs/doxygen/build/html
81-
134+
github_token: ${{ secrets.GITHUB_TOKEN }}
135+
publish_dir: ./docs/doxygen/build/html
136+
publish_branch: gh-pages # explicit (default)
137+
keep_files: false # remove anything that isn't in publish_dir
138+
force_orphan: true # recreate gh-pages as a single clean commit
139+
# In the repository settings, go to Actions -> General -> Workflow permissions
140+
# and enable Read and write permissions.
141+
# After the workflow runs successfully, go to Settings -> Pages -> Branch
142+
# select `gh-pages` and click "Save".

0 commit comments

Comments
 (0)