1- name : Generate Images from PlantUML and drawio
1+ name : Generate Images from PlantUML and drawio (Debug Edition)
22
33on :
44 push :
@@ -27,43 +27,111 @@ jobs:
2727 timeout-minutes : 30
2828
2929 steps :
30- - name : Checkout repository
30+ - name : 📋 Debug - Environment Info
31+ run : |
32+ echo "🐧 Runner OS: $(lsb_release -d)"
33+ echo "💾 Memory: $(free -h | grep Mem)"
34+ echo "💿 Disk: $(df -h /)"
35+ echo "🏃 Runner: $RUNNER_NAME"
36+ echo "📅 Date: $(date)"
37+
38+ - name : 📥 Checkout repository
3139 uses : actions/checkout@v4
3240 with :
3341 fetch-depth : 2
42+
43+ - name : 📋 Debug - Repository Info
44+ run : |
45+ echo "📁 Repository: ${{ github.repository }}"
46+ echo "🌿 Branch: ${{ github.ref_name }}"
47+ echo "📝 Commit: ${{ github.sha }}"
48+ echo "🎯 Event: ${{ github.event_name }}"
49+ echo "🔄 Regenerate all: '${{ github.event.inputs.regenerate_all }}'"
50+ echo "📂 Working directory: $(pwd)"
3451
35- - name : Create output directory
52+ - name : 📁 Create output directory
3653 run : |
3754 mkdir -p ${{ env.OUTPUT_DIR }}
3855 echo "📁 Output directory: ${{ env.OUTPUT_DIR }}"
39- echo "🔄 Regenerate all: '${{ github.event.inputs.regenerate_all }}'"
40- echo "🔄 Event name: '${{ github.event_name }}'"
56+ echo "📊 Prefixes: PlantUML='${{ env.PLANTUML_PREFIX }}' | Draw.io='${{ env.DRAWIO_PREFIX }}'"
57+
58+ - name : 📋 Debug - Repository Structure
59+ run : |
60+ echo "=== Repository structure ==="
61+ find . -name "*.puml" -o -name "*.plantuml" -o -name "*.drawio" -o -name "*.dio" | head -20 || echo "No diagram files found"
62+ echo ""
63+ echo "=== src/plantuml contents ==="
64+ if [ -d "src/plantuml" ]; then
65+ ls -la src/plantuml/
66+ echo "PlantUML file count: $(find src/plantuml -name "*.puml" -o -name "*.plantuml" | wc -l)"
67+ else
68+ echo "❌ src/plantuml directory not found"
69+ fi
70+ echo ""
71+ echo "=== src/drawio contents ==="
72+ if [ -d "src/drawio" ]; then
73+ ls -la src/drawio/
74+ echo "Draw.io file count: $(find src/drawio -name "*.drawio" -o -name "*.dio" | wc -l)"
75+ else
76+ echo "❌ src/drawio directory not found"
77+ fi
4178
42- - name : Set up JDK 11
79+ - name : ☕ Set up JDK 11
4380 uses : actions/setup-java@v4
4481 with :
4582 distribution : ' temurin'
4683 java-version : ' 11'
4784
48- - name : Install Graphviz (for PlantUML)
85+ - name : 📋 Debug - Java Info
4986 run : |
87+ echo "☕ Java version: $(java -version 2>&1 | head -1)"
88+ echo "🏠 JAVA_HOME: $JAVA_HOME"
89+ echo "📁 Java location: $(which java)"
90+
91+ - name : ⚡ Install dependencies (optimized)
92+ run : |
93+ echo "🔄 Starting optimized package installation..."
94+
95+ # Disable man-db auto-update to save 3-5 minutes!
96+ sudo rm -f /var/lib/man-db/auto-update
97+ echo "🚫 Disabled man-db auto-update"
98+
99+ # Update package list
50100 sudo apt-get update
51- sudo apt-get install -y graphviz
101+ echo "📦 Package list updated"
102+
103+ # Install Graphviz without recommendations (faster)
104+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
105+ --no-install-recommends \
106+ --no-install-suggests \
107+ graphviz
108+ echo "🎨 Graphviz installed successfully"
109+
110+ # Verify installation
111+ dot -V 2>&1 || echo "❌ Graphviz verification failed"
52112
53- - name : Download and setup PlantUML
113+ - name : 📥 Download and setup PlantUML
54114 run : |
55- wget https://github.com/plantuml/plantuml/releases/latest/download/plantuml.jar -O /tmp/plantuml.jar
56- echo "PlantUML downloaded successfully"
115+ echo "📥 Downloading PlantUML..."
116+ wget --progress=dot:giga \
117+ https://github.com/plantuml/plantuml/releases/latest/download/plantuml.jar \
118+ -O /tmp/plantuml.jar
119+
120+ echo "📊 PlantUML file size: $(ls -lh /tmp/plantuml.jar | awk '{print $5}')"
121+ echo "✅ PlantUML downloaded successfully"
122+
123+ echo "🧪 Testing PlantUML installation..."
57124 java -jar /tmp/plantuml.jar -version
58125
59- - name : Generate PlantUML images (smart mode)
126+ - name : 🎨 Generate PlantUML images (debug mode)
60127 continue-on-error : true
61128 run : |
62- echo "=== Generating PlantUML images ==="
129+ echo "=== 🎨 Generating PlantUML images ==="
63130
64131 output_abs=$(pwd)/${{ env.OUTPUT_DIR }}
132+ echo "📁 Output directory: $output_abs"
65133
66- # Determine if we should process all files or just changed ones
134+ # Determine processing mode
67135 if [ "${{ github.event.inputs.regenerate_all }}" = "true" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
68136 echo "🔄 FULL REGENERATION MODE - Processing all files"
69137 puml_files=$(find $(pwd)/src/plantuml -name "*.puml" -o -name "*.plantuml" 2>/dev/null)
@@ -73,168 +141,27 @@ jobs:
73141 exit 0
74142 fi
75143
76- echo "Found PlantUML files:"
144+ echo "📋 Found PlantUML files:"
77145 echo "$puml_files"
78146 else
79147 echo "⚡ INCREMENTAL MODE - Processing only changed files"
80- # Get list of changed .puml files in this commit
81148 changed_puml_files=$(git diff --name-only HEAD~1 HEAD | grep -E '\.(puml|plantuml)$' | grep '^src/plantuml/' || true)
82149
83150 if [ -z "$changed_puml_files" ]; then
84- echo "No PlantUML files changed in this commit"
151+ echo "ℹ️ No PlantUML files changed in this commit"
85152 exit 0
86153 fi
87154
88- echo "Changed PlantUML files:"
155+ echo "📋 Changed PlantUML files:"
89156 echo "$changed_puml_files"
90157 puml_files="$changed_puml_files"
91158 fi
92159
93- for file in $puml_files; do
94- # Convert relative path to absolute if needed
95- if [[ "$file" != /* ]]; then
96- file="$(pwd)/$file"
97- fi
98-
99- # Only process if file still exists (not deleted)
100- if [ -f "$file" ]; then
101- echo "Processing: $file"
102- base=$(basename "$file" | sed 's/\.[^.]*$//')
103-
104- # Generate PNG
105- echo "Generating PNG for: $file"
106- java -jar /tmp/plantuml.jar -tpng "$file" -o "$output_abs" 2>&1
107-
108- if [ -f "$output_abs/${base}.png" ]; then
109- mv "$output_abs/${base}.png" "$output_abs/${{ env.PLANTUML_PREFIX }}_${base}.png"
110- echo "✅ Generated PNG: ${{ env.PLANTUML_PREFIX }}_${base}.png"
111- else
112- echo "❌ PNG not created for $file"
113- fi
114-
115- # Generate SVG
116- echo "Generating SVG for: $file"
117- java -jar /tmp/plantuml.jar -tsvg "$file" -o "$output_abs" 2>&1
118-
119- if [ -f "$output_abs/${base}.svg" ]; then
120- mv "$output_abs/${base}.svg" "$output_abs/${{ env.PLANTUML_PREFIX }}_${base}.svg"
121- echo "✅ Generated SVG: ${{ env.PLANTUML_PREFIX }}_${base}.svg"
122- else
123- echo "❌ SVG not created for $file"
124- fi
125- else
126- # File was deleted - remove corresponding images
127- base=$(basename "$file" | sed 's/\.[^.]*$//')
128- rm -f "$output_abs/${{ env.PLANTUML_PREFIX }}_${base}.png"
129- rm -f "$output_abs/${{ env.PLANTUML_PREFIX }}_${base}.svg"
130- echo "🗑️ Removed images for deleted file: $file"
131- fi
132-
133- echo "--- Next file ---"
134- done
135-
136- - name : Generate Draw.io images (smart mode)
137- continue-on-error : true
138- run : |
139- echo "=== Generating drawio images ==="
140-
141- # Determine if we should process all files or just changed ones
142- if [ "${{ github.event.inputs.regenerate_all }}" = "true" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
143- echo "🔄 FULL REGENERATION MODE - Processing all files"
144- drawio_files=$(find src/drawio -name "*.drawio" -o -name "*.dio" 2>/dev/null)
145-
146- if [ -z "$drawio_files" ]; then
147- echo "No drawio files found in src/drawio/"
148- exit 0
149- fi
150-
151- echo "Found drawio files:"
152- echo "$drawio_files"
153- else
154- echo "⚡ INCREMENTAL MODE - Processing only changed files"
155- # Get list of changed .drawio files in this commit
156- changed_drawio_files=$(git diff --name-only HEAD~1 HEAD | grep -E '\.(drawio|dio)$' | grep '^src/drawio/' || true)
157-
158- if [ -z "$changed_drawio_files" ]; then
159- echo "No drawio files changed in this commit"
160- exit 0
161- fi
162-
163- echo "Changed drawio files:"
164- echo "$changed_drawio_files"
165- drawio_files="$changed_drawio_files"
166- fi
167-
168- for file in $drawio_files; do
169- if [ -f "$file" ]; then
170- echo "Processing: $file"
171- base=$(basename "$file" | sed 's/\.[^.]*$//')
172-
173- # Generate PNG
174- docker run --rm \
175- -v $(pwd):/data \
176- rlespinasse/drawio-export:4.4.0 \
177- --format png \
178- --output "${{ env.OUTPUT_DIR }}" \
179- "$file"
180-
181- # Rename with prefix
182- if [ -f "${{ env.OUTPUT_DIR }}/${base}.png" ]; then
183- mv "${{ env.OUTPUT_DIR }}/${base}.png" "${{ env.OUTPUT_DIR }}/${{ env.DRAWIO_PREFIX }}_${base}.png"
184- echo "✅ Generated PNG: ${{ env.DRAWIO_PREFIX }}_${base}.png"
185- fi
186-
187- # Generate SVG
188- docker run --rm \
189- -v $(pwd):/data \
190- rlespinasse/drawio-export:4.4.0 \
191- --format svg \
192- --output "${{ env.OUTPUT_DIR }}" \
193- "$file"
194-
195- # Rename with prefix
196- if [ -f "${{ env.OUTPUT_DIR }}/${base}.svg" ]; then
197- mv "${{ env.OUTPUT_DIR }}/${base}.svg" "${{ env.OUTPUT_DIR }}/${{ env.DRAWIO_PREFIX }}_${base}.svg"
198- echo "✅ Generated SVG: ${{ env.DRAWIO_PREFIX }}_${base}.svg"
199- fi
200- else
201- # File was deleted - remove corresponding images
202- base=$(basename "$file" | sed 's/\.[^.]*$//')
203- rm -f "${{ env.OUTPUT_DIR }}/${{ env.DRAWIO_PREFIX }}_${base}.png"
204- rm -f "${{ env.OUTPUT_DIR }}/${{ env.DRAWIO_PREFIX }}_${base}.svg"
205- echo "🗑️ Removed images for deleted file: $file"
206- fi
207- done
208-
209- - name : Show results
210- run : |
211- echo "=== Generated files ==="
212- ls -la ${{ env.OUTPUT_DIR }}/ 2>/dev/null || echo "No images directory"
213- echo "=== Git Status ==="
214- git status
215-
216- - name : Commit generated images
217- run : |
218- git config --global user.name 'GitHub Actions'
219- git config --global user.email 'actions@github.com'
160+ echo "📊 Processing $(echo "$puml_files" | wc -l) PlantUML file(s)..."
220161
221- if [ -d "${{ env.OUTPUT_DIR }}" ] && [ "$(ls -A ${{ env.OUTPUT_DIR }})" ]; then
222- git add ${{ env.OUTPUT_DIR }}/
223-
224- # Count changes
225- changed_count=$(git diff --staged --name-only | wc -l)
162+ for file in $puml_files; do
163+ echo "===================="
164+ echo "🔄 Processing: $file"
226165
227- if [ "$changed_count" -gt 0 ]; then
228- if [ "${{ github.event.inputs.regenerate_all }}" = "true" ]; then
229- git commit -m "🔄 Regenerate all images from PlantUML and drawio files"
230- else
231- git commit -m "⚡ Auto-update images for changed PlantUML/drawio files ($changed_count files)"
232- fi
233- git push
234- echo "✅ $changed_count image files committed and pushed"
235- else
236- echo "No changes to commit"
237- fi
238- else
239- echo "❌ No images to commit"
240- fi
166+ # Convert relative path to absolute if needed
167+ if [[ "$file" !=
0 commit comments