@@ -256,10 +256,55 @@ jobs:
256256 path : ${{ env.dir }}_img/img/**
257257
258258
259+ cad_postprocess :
260+ name : " CAD postprocess"
261+ runs-on : ubuntu-latest
262+ needs : [graphics]
263+ steps :
264+ - uses : actions/download-artifact@v4
265+ with :
266+ name : doc_cad
267+ path : doc_cad
268+
269+ - name : Install CAD postprocess tools
270+ run : |
271+ sudo apt-get update
272+ sudo apt-get install -y admesh
273+
274+ - name : Convert STL to binary STL and compress large STEP
275+ run : |
276+ threshold=$((50 * 1024 * 1024))
277+
278+ find doc_cad -type f -name '*.stl' | while read -r f; do
279+ tmp="${f}.tmp"
280+ admesh --write-binary-stl="$tmp" "$f"
281+ mv "$tmp" "$f"
282+ done
283+
284+ find doc_cad -type f -name '*.step' | while read -r f; do
285+ size=$(stat -c%s "$f")
286+ if [ "$size" -gt "$threshold" ]; then
287+ gzip -9 "$f"
288+ fi
289+ done
290+
291+ - name : Diagnostic output sizes
292+ run : |
293+ echo "STL files:"
294+ find doc_cad -type f -name '*.stl' -exec stat -c '%n %s bytes' {} \;
295+ echo "STEP/STEP.GZ files:"
296+ find doc_cad -type f \( -name '*.step' -o -name '*.step.gz' \) -exec stat -c '%n %s bytes' {} \;
297+
298+ - uses : actions/upload-artifact@v4
299+ with :
300+ name : doc_cad_processed
301+ path : doc_cad/**
302+
303+
259304 UPDATE_REPO :
260305 runs-on : ubuntu-latest
261306 name : Update repository
262- needs : [graphics , gerbers, schematics, placement, report, ibom]
307+ needs : [cad_postprocess , gerbers, schematics, placement, report, ibom]
263308 steps :
264309 - uses : actions/checkout@v4
265310 with :
@@ -294,7 +339,7 @@ jobs:
294339 mkdir hw/cam_profi/ibom || true
295340
296341 cp -r doc_img/* doc/gen/img || true
297- cp -r doc_cad /cad/* doc/gen || true
342+ cp -r doc_cad_processed /cad/* doc/gen || true
298343 cp -r hw_cam_profi/* hw/cam_profi/gbr || true
299344 cp -r doc_sch/docs/* doc/gen || true
300345 cp -r doc_xml/* hw/cam_profi || true
@@ -308,6 +353,7 @@ jobs:
308353
309354 rm -r doc_img || true
310355 rm -r doc_cad || true
356+ rm -r doc_cad_processed || true
311357 rm -r hw_cam_profi || true
312358 rm -r doc_sch || true
313359 rm -r doc_placement || true
0 commit comments