4242 key : compiled-binaries-consolidated-${{ github.sha }}
4343 restore-keys : |
4444 compiled-binaries-consolidated-
45- compiled-binaries-Linux-${{ github.sha }}-
46- compiled-binaries-Linux-
4745 path : compiled_binaries
4846 lookup-only : false
4947
@@ -55,32 +53,145 @@ jobs:
5553 path : compiled_binaries
5654 continue-on-error : true
5755
58- - name : Copy cached binaries to local directory
56+ - name : Debug - List cached binaries structure
5957 run : |
58+ echo "=========================================="
59+ echo "Debugging cached binaries structure"
60+ echo "=========================================="
6061 if [ -d "compiled_binaries" ]; then
61- echo "Found cached binaries, copying to local workspace..."
62- mkdir -p local_binaries
63- cp -r compiled_binaries/* local_binaries/ || true
64- echo "Available binaries:"
65- find local_binaries -type f -name "*.bin" -o -name "*.elf" | head -20
66- echo "Total binary files found: $(find local_binaries -type f \( -name "*.bin" -o -name "*.elf" \) | wc -l)"
67-
68- echo "Contents of compiled_binaries directory:"
69- find compiled_binaries -type f | head -20
62+ echo "✓ compiled_binaries directory exists"
63+ echo ""
64+ echo "Directory tree (first 50 entries):"
65+ find compiled_binaries -type f | head -50 | sort
66+ echo ""
67+ echo "Binary files (.bin):"
68+ find compiled_binaries -type f -name "*.bin" | head -30
69+ echo ""
70+ echo "ELF files:"
71+ find compiled_binaries -type f -name "*.elf" | head -30
72+ echo ""
73+ echo "Total binary files: $(find compiled_binaries -type f -name "*.bin" | wc -l)"
74+ echo "Total ELF files: $(find compiled_binaries -type f -name "*.elf" | wc -l)"
75+ echo ""
76+ echo "Sample directory structure:"
77+ ls -la compiled_binaries/ || true
7078 else
71- echo "No cached binaries found, will build fresh"
79+ echo "✗ compiled_binaries directory NOT found"
80+ echo "WARNING: No cached binaries available!"
7281 fi
82+ echo "=========================================="
7383
74- - name : Build Examples
84+ - name : Copy cached binaries to docs/_static/binaries/
7585 run : |
76- source .github/scripts/install-arduino-cli.sh
77- source .github/scripts/install-arduino-core-esp32.sh
78- python3 .github/scripts/docs_build_examples.py -ai $ARDUINO_IDE_PATH -au $ARDUINO_USR_PATH -d
86+ echo "Copying cached binaries to docs/_static/binaries/"
87+ mkdir -p docs/_static/binaries
88+
89+ if [ ! -d "compiled_binaries" ]; then
90+ echo "ERROR: No compiled_binaries directory found!"
91+ echo "Cannot proceed without binaries. Exiting."
92+ exit 1
93+ fi
94+
95+ # Find all .bin files in compiled_binaries
96+ echo "Processing binary files..."
97+ bin_count=0
98+ skip_count=0
99+
100+ # Binaries are stored in structure like:
101+ # compiled_binaries/{home}/.arduino/tests/{target}/{SketchName}/build.tmp/{SketchName}.ino.bin
102+ # We need to:
103+ # 1. Extract sketch name and target from path
104+ # 2. Find the sketch in libraries/ directory
105+ # 3. Copy to docs/_static/binaries/libraries/{LibraryName}/examples/{SketchName}/{target}/
106+
107+ find compiled_binaries -type f -name "*.bin" | while read -r bin_file; do
108+ echo "Processing: $bin_file"
109+
110+ # Extract the binary filename (e.g., WiFiClientSecure.ino.bin)
111+ bin_name=$(basename "$bin_file")
112+
113+ # Extract sketch name (remove .ino.bin or .bin extension)
114+ sketch_name="${bin_name%.ino.bin}"
115+ if [ "$sketch_name" == "$bin_name" ]; then
116+ sketch_name="${bin_name%.bin}"
117+ fi
118+
119+ # Extract target from path (esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c5)
120+ if [[ "$bin_file" =~ /(esp32[a-z0-9]*)/ ]]; then
121+ target="${BASH_REMATCH[1]}"
122+ else
123+ echo " ⚠ Could not determine target from path: $bin_file"
124+ skip_count=$((skip_count + 1))
125+ continue
126+ fi
127+
128+ # Search for the sketch in libraries directory
129+ sketch_ino_file=$(find libraries -type f -name "${sketch_name}.ino" 2>/dev/null | head -1)
130+
131+ if [ -z "$sketch_ino_file" ]; then
132+ echo " ⚠ Could not find sketch '${sketch_name}.ino' in libraries/"
133+ skip_count=$((skip_count + 1))
134+ continue
135+ fi
136+
137+ # Extract the relative path from libraries/
138+ # e.g., libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino
139+ # becomes: NetworkClientSecure/examples/WiFiClientSecure
140+ sketch_dir=$(dirname "$sketch_ino_file")
141+ relative_path="${sketch_dir#libraries/}"
142+
143+ echo " ✓ Found sketch at: $sketch_ino_file"
144+ echo " ✓ Target: $target"
145+ echo " ✓ Relative path: $relative_path"
146+
147+ # Create output directory
148+ output_dir="docs/_static/binaries/libraries/${relative_path}/${target}"
149+ mkdir -p "$output_dir"
150+
151+ # Copy the binary
152+ cp "$bin_file" "$output_dir/"
153+ echo " → Copied to: $output_dir/$bin_name"
154+ bin_count=$((bin_count + 1))
155+ done
156+
157+ echo ""
158+ echo "=========================================="
159+ echo "Binary copy completed!"
160+ echo " Binaries copied: $bin_count"
161+ echo " Binaries skipped: $skip_count"
162+ echo "=========================================="
163+ echo ""
164+ echo "Final structure in docs/_static/binaries/:"
165+ find docs/_static/binaries -type f -name "*.bin" | head -30
166+ echo ""
167+ echo "Total binaries in docs/_static/binaries/: $(find docs/_static/binaries -type f -name "*.bin" | wc -l)"
79168
80169 - name : Cleanup Binaries
81170 run : |
82171 python3 .github/scripts/docs_build_examples.py -c
83172
173+ - name : Debug - Final binaries structure after cleanup
174+ run : |
175+ echo "=========================================="
176+ echo "Final structure in docs/_static/binaries/ (after cleanup)"
177+ echo "=========================================="
178+ if [ -d "docs/_static/binaries" ]; then
179+ echo "Directory tree:"
180+ find docs/_static/binaries -type f | sort
181+ echo ""
182+ echo "Files by type:"
183+ echo " .bin files: $(find docs/_static/binaries -type f -name "*.bin" | wc -l)"
184+ echo " .elf files: $(find docs/_static/binaries -type f -name "*.elf" | wc -l)"
185+ echo " .json files: $(find docs/_static/binaries -type f -name "*.json" | wc -l)"
186+ echo " .toml files: $(find docs/_static/binaries -type f -name "*.toml" | wc -l)"
187+ echo ""
188+ echo "Example of final structure (first 20 files):"
189+ find docs/_static/binaries -type f | head -20
190+ else
191+ echo "WARNING: docs/_static/binaries/ directory not found!"
192+ fi
193+ echo "=========================================="
194+
84195 - name : Build
85196 run : |
86197 sudo apt update
0 commit comments