Skip to content

Commit 1d9ddbb

Browse files
committed
refactor(ci): streamline documentation build workflow by removing debug steps and enhancing output clarity for collected binaries
1 parent a503d70 commit 1d9ddbb

File tree

2 files changed

+10
-124
lines changed

2 files changed

+10
-124
lines changed

.github/workflows/docs_build.yml

Lines changed: 6 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -57,157 +57,56 @@ jobs:
5757
path: docs_binaries
5858
lookup-only: false
5959

60-
# - name: Download docs binaries artifact (fallback)
61-
# if: steps.cache-restore.outputs.cache-hit != 'true'
62-
# uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
63-
# with:
64-
# name: docs-binaries-macos
65-
# path: docs_binaries
66-
# continue-on-error: true
67-
68-
- name: Debug - List cached binaries structure
69-
run: |
70-
echo "=========================================="
71-
echo "Debugging cached binaries structure (macOS builds)"
72-
echo "=========================================="
73-
if [ -d "docs_binaries" ]; then
74-
echo "✓ docs_binaries directory exists"
75-
echo ""
76-
echo "Directory tree (first 50 entries):"
77-
find docs_binaries -type f 2>/dev/null | head -50 | sort || true
78-
echo ""
79-
echo "Binary files (.bin):"
80-
find docs_binaries -type f -name "*.bin" 2>/dev/null | head -30 || true
81-
echo ""
82-
echo "ELF files:"
83-
find docs_binaries -type f -name "*.elf" 2>/dev/null | head -30 || true
84-
echo ""
85-
echo "Total binary files: $(find docs_binaries -type f -name "*.bin" 2>/dev/null | wc -l)"
86-
echo "Total ELF files: $(find docs_binaries -type f -name "*.elf" 2>/dev/null | wc -l)"
87-
echo ""
88-
echo "Sample directory structure:"
89-
ls -la docs_binaries/ || true
90-
else
91-
echo "✗ docs_binaries directory NOT found"
92-
echo "WARNING: No cached binaries available!"
93-
fi
94-
echo "=========================================="
95-
9660
- name: Copy cached binaries to docs/_static/binaries/
9761
run: |
98-
echo "Copying cached .merged.bin binaries to docs/_static/binaries/"
9962
mkdir -p docs/_static/binaries
10063
10164
if [ ! -d "docs_binaries" ]; then
102-
echo "WARNING: No docs_binaries directory found!"
103-
echo "Continuing anyway - docs will build without binaries."
65+
echo "WARNING: No docs_binaries directory found, continuing without binaries."
10466
exit 0
10567
fi
10668
107-
# Find only .merged.bin files in docs_binaries
108-
echo "Processing .merged.bin files from macOS builds..."
109-
110-
# Binaries are stored in structure like:
111-
# docs_binaries/{target}/{SketchName}/build.tmp/{SketchName}.ino.merged.bin
112-
# We need to:
113-
# 1. Extract sketch name and target from path
114-
# 2. Find the sketch in libraries/ directory
115-
# 3. Copy .merged.bin to docs/_static/binaries/libraries/{LibraryName}/examples/{SketchName}/{target}/
116-
11769
bin_count=0
118-
skip_count=0
11970
12071
while IFS= read -r bin_file; do
121-
echo "Processing: $bin_file"
122-
123-
# Extract the binary filename (e.g., WiFiClientSecure.ino.merged.bin)
12472
bin_name=$(basename "$bin_file")
125-
126-
# Extract sketch name (remove .ino.merged.bin extension)
12773
sketch_name="${bin_name%.ino.merged.bin}"
12874
129-
# Extract target from path (esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c5)
13075
if [[ "$bin_file" =~ /(esp32[a-z0-9]*)/ ]]; then
13176
target="${BASH_REMATCH[1]}"
13277
else
133-
echo " ⚠ Could not determine target from path: $bin_file"
134-
skip_count=$((skip_count + 1))
13578
continue
13679
fi
13780
138-
# Search for the sketch in libraries directory
13981
sketch_ino_file=$(find libraries -type f -name "${sketch_name}.ino" 2>/dev/null | head -1)
140-
14182
if [ -z "$sketch_ino_file" ]; then
142-
echo " ⚠ Could not find sketch '${sketch_name}.ino' in libraries/"
143-
skip_count=$((skip_count + 1))
14483
continue
14584
fi
14685
147-
# Extract the relative path from libraries/
148-
# e.g., libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino
149-
# becomes: NetworkClientSecure/examples/WiFiClientSecure
15086
sketch_dir=$(dirname "$sketch_ino_file")
15187
relative_path="${sketch_dir#libraries/}"
152-
153-
echo " ✓ Found sketch at: $sketch_ino_file"
154-
echo " ✓ Target: $target"
155-
echo " ✓ Relative path: $relative_path"
156-
157-
# Create output directory
15888
output_dir="docs/_static/binaries/libraries/${relative_path}/${target}"
15989
mkdir -p "$output_dir"
16090
161-
# Copy the .merged.bin file
16291
cp "$bin_file" "$output_dir/"
163-
echo " → Copied to: $output_dir/$bin_name"
16492
bin_count=$((bin_count + 1))
16593
166-
# Also copy ci.json if it exists in the same directory
16794
ci_json_file=$(dirname "$bin_file")/ci.json
16895
if [ -f "$ci_json_file" ]; then
16996
cp "$ci_json_file" "$output_dir/"
170-
echo " → Copied ci.json to: $output_dir/ci.json"
17197
fi
17298
done < <(find docs_binaries -type f -name "*.merged.bin")
173-
174-
echo ""
175-
echo "=========================================="
176-
echo ".merged.bin copy completed!"
177-
echo " .merged.bin files copied: $bin_count"
178-
echo " Files skipped: $skip_count"
179-
echo "=========================================="
180-
echo ""
181-
echo "Final structure in docs/_static/binaries/:"
182-
find docs/_static/binaries -type f -name "*.merged.bin" 2>/dev/null | head -30 || true
183-
echo ""
184-
echo "Total .merged.bin files in docs/_static/binaries/: $(find docs/_static/binaries -type f -name "*.merged.bin" 2>/dev/null | wc -l)"
18599
186100
- name: Cleanup Binaries
187101
run: |
188102
python3 .github/scripts/docs_build_examples.py -c
189103
190-
- name: Debug - Final binaries structure after cleanup
104+
- name: Show processed projects
191105
run: |
192-
echo "=========================================="
193-
echo "Final structure in docs/_static/binaries/ (after cleanup)"
194-
echo "=========================================="
195-
if [ -d "docs/_static/binaries" ]; then
196-
echo "Directory tree:"
197-
find docs/_static/binaries -type f 2>/dev/null | sort || true
198-
echo ""
199-
echo "Files by type:"
200-
echo " .merged.bin files: $(find docs/_static/binaries -type f -name "*.merged.bin" 2>/dev/null | wc -l)"
201-
echo " .json files: $(find docs/_static/binaries -type f -name "*.json" 2>/dev/null | wc -l)"
202-
echo " .toml files: $(find docs/_static/binaries -type f -name "*.toml" 2>/dev/null | wc -l)"
203-
echo " diagram.json files: $(find docs/_static/binaries -type f -name "diagram*.json" 2>/dev/null | wc -l)"
204-
echo ""
205-
echo "Example of final structure (first 20 files):"
206-
find docs/_static/binaries -type f 2>/dev/null | head -20 || true
207-
else
208-
echo "WARNING: docs/_static/binaries/ directory not found!"
209-
fi
210-
echo "=========================================="
106+
echo "Projects ready for documentation:"
107+
find docs/_static/binaries/libraries -type f -name "*.ino.merged.bin" 2>/dev/null | while read f; do
108+
basename "$f" .ino.merged.bin
109+
done | sort -u
211110
212111
- name: Build
213112
run: |

.github/workflows/push.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,10 @@ jobs:
217217
- name: Collect docs binaries (macOS only)
218218
if: matrix.os == 'macOS-latest'
219219
run: |
220-
echo "Collecting binaries and ci.json files for documentation from macOS build..."
221220
mkdir -p docs_binaries
222221
223222
# Find all compiled binaries from the build
224223
find "$HOME/.arduino/tests" -type f -name "*.bin" 2>/dev/null | while read -r bin_file; do
225-
echo "Found binary: $bin_file"
226-
227-
# Preserve directory structure
228224
rel_path="${bin_file#$HOME/.arduino/tests/}"
229225
target_dir="docs_binaries/$(dirname "$rel_path")"
230226
mkdir -p "$target_dir"
@@ -233,25 +229,16 @@ jobs:
233229
234230
# Also find and copy ci.json files
235231
find "$HOME/.arduino/tests" -type f -name "ci.json" 2>/dev/null | while read -r ci_file; do
236-
echo "Found ci.json: $ci_file"
237-
238-
# Preserve directory structure
239232
rel_path="${ci_file#$HOME/.arduino/tests/}"
240233
target_dir="docs_binaries/$(dirname "$rel_path")"
241234
mkdir -p "$target_dir"
242235
cp "$ci_file" "$target_dir/"
243236
done
244237
245-
echo ""
246-
echo "Collected files for docs:"
247-
echo " Binary files (.bin): $(find docs_binaries -type f -name "*.bin" 2>/dev/null | wc -l)"
248-
echo " Config files (ci.json): $(find docs_binaries -type f -name "ci.json" 2>/dev/null | wc -l)"
249-
echo ""
250-
echo "Sample binaries:"
251-
find docs_binaries -type f -name "*.bin" 2>/dev/null | head -10 || true
252-
echo ""
253-
echo "Sample ci.json files:"
254-
find docs_binaries -type f -name "ci.json" 2>/dev/null | head -10 || true
238+
echo "Projects stored for documentation:"
239+
find docs_binaries -type f -name "*.ino.merged.bin" 2>/dev/null | while read f; do
240+
basename "$f" .ino.merged.bin
241+
done | sort -u
255242
256243
- name: Save docs binaries to cache (macOS only)
257244
if: matrix.os == 'macOS-latest'

0 commit comments

Comments
 (0)