-
Notifications
You must be signed in to change notification settings - Fork 4
167 lines (139 loc) · 5.82 KB
/
automatic_image_genration.yml
File metadata and controls
167 lines (139 loc) · 5.82 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Generate Images from PlantUML and drawio (Debug Edition)
on:
push:
paths:
- 'src/plantuml/**'
- 'src/drawio/**'
branches:
- main
- github_action_test
workflow_dispatch:
inputs:
regenerate_all:
description: 'Regenerate all images (not just changed ones)'
required: false
default: false
type: boolean
env:
OUTPUT_DIR: images
PLANTUML_PREFIX: uml
DRAWIO_PREFIX: diagram
jobs:
generate_images:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: 📋 Debug - Environment Info
run: |
echo "🐧 Runner OS: $(lsb_release -d)"
echo "💾 Memory: $(free -h | grep Mem)"
echo "💿 Disk: $(df -h /)"
echo "🏃 Runner: $RUNNER_NAME"
echo "📅 Date: $(date)"
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: 📋 Debug - Repository Info
run: |
echo "📁 Repository: ${{ github.repository }}"
echo "🌿 Branch: ${{ github.ref_name }}"
echo "📝 Commit: ${{ github.sha }}"
echo "🎯 Event: ${{ github.event_name }}"
echo "🔄 Regenerate all: '${{ github.event.inputs.regenerate_all }}'"
echo "📂 Working directory: $(pwd)"
- name: 📁 Create output directory
run: |
mkdir -p ${{ env.OUTPUT_DIR }}
echo "📁 Output directory: ${{ env.OUTPUT_DIR }}"
echo "📊 Prefixes: PlantUML='${{ env.PLANTUML_PREFIX }}' | Draw.io='${{ env.DRAWIO_PREFIX }}'"
- name: 📋 Debug - Repository Structure
run: |
echo "=== Repository structure ==="
find . -name "*.puml" -o -name "*.plantuml" -o -name "*.drawio" -o -name "*.dio" | head -20 || echo "No diagram files found"
echo ""
echo "=== src/plantuml contents ==="
if [ -d "src/plantuml" ]; then
ls -la src/plantuml/
echo "PlantUML file count: $(find src/plantuml -name "*.puml" -o -name "*.plantuml" | wc -l)"
else
echo "❌ src/plantuml directory not found"
fi
echo ""
echo "=== src/drawio contents ==="
if [ -d "src/drawio" ]; then
ls -la src/drawio/
echo "Draw.io file count: $(find src/drawio -name "*.drawio" -o -name "*.dio" | wc -l)"
else
echo "❌ src/drawio directory not found"
fi
- name: ☕ Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: 📋 Debug - Java Info
run: |
echo "☕ Java version: $(java -version 2>&1 | head -1)"
echo "🏠 JAVA_HOME: $JAVA_HOME"
echo "📁 Java location: $(which java)"
- name: ⚡ Install dependencies (optimized)
run: |
echo "🔄 Starting optimized package installation..."
# Disable man-db auto-update to save 3-5 minutes!
sudo rm -f /var/lib/man-db/auto-update
echo "🚫 Disabled man-db auto-update"
# Update package list
sudo apt-get update
echo "📦 Package list updated"
# Install Graphviz without recommendations (faster)
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
--no-install-recommends \
--no-install-suggests \
graphviz
echo "🎨 Graphviz installed successfully"
# Verify installation
dot -V 2>&1 || echo "❌ Graphviz verification failed"
- name: 📥 Download and setup PlantUML
run: |
echo "📥 Downloading PlantUML..."
wget --progress=dot:giga \
https://github.com/plantuml/plantuml/releases/latest/download/plantuml.jar \
-O /tmp/plantuml.jar
echo "📊 PlantUML file size: $(ls -lh /tmp/plantuml.jar | awk '{print $5}')"
echo "✅ PlantUML downloaded successfully"
echo "🧪 Testing PlantUML installation..."
java -jar /tmp/plantuml.jar -version
- name: 🎨 Generate PlantUML images (debug mode)
continue-on-error: true
run: |
echo "=== 🎨 Generating PlantUML images ==="
output_abs=$(pwd)/${{ env.OUTPUT_DIR }}
echo "📁 Output directory: $output_abs"
# Determine processing mode
if [ "${{ github.event.inputs.regenerate_all }}" = "true" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "🔄 FULL REGENERATION MODE - Processing all files"
puml_files=$(find $(pwd)/src/plantuml -name "*.puml" -o -name "*.plantuml" 2>/dev/null)
if [ -z "$puml_files" ]; then
echo "❌ No PlantUML files found in src/plantuml/"
exit 0
fi
echo "📋 Found PlantUML files:"
echo "$puml_files"
else
echo "⚡ INCREMENTAL MODE - Processing only changed files"
changed_puml_files=$(git diff --name-only HEAD~1 HEAD | grep -E '\.(puml|plantuml)$' | grep '^src/plantuml/' || true)
if [ -z "$changed_puml_files" ]; then
echo "ℹ️ No PlantUML files changed in this commit"
exit 0
fi
echo "📋 Changed PlantUML files:"
echo "$changed_puml_files"
puml_files="$changed_puml_files"
fi
echo "📊 Processing $(echo "$puml_files" | wc -l) PlantUML file(s)..."
for file in $puml_files; do
echo "===================="
echo "🔄 Processing: $file"
# Convert relative path to absolute if needed
if [[ "$file" !=