From aa89cfaff515e0b36691d97ff4c34ca115e2c3c5 Mon Sep 17 00:00:00 2001 From: HanifKoh <76276251+HanifKoh@users.noreply.github.com> Date: Thu, 22 Oct 2026 12:51:37 +0800 Subject: [PATCH] Give macOS DMG Images an Explicit Size (#16736) hdiutil create -srcfolder sizes the image from the source folder and sometimes leaves too little room, failing every retry with "No space left on device" while packaging the profile validator DMG. Pass -size as the source size plus 20% and 50 MB; the free space compresses away in UDZO. --- .github/workflows/build_orca.yml | 14 ++++++++------ scripts/create_dmg.sh | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 scripts/create_dmg.sh diff --git a/.github/workflows/build_orca.yml b/.github/workflows/build_orca.yml index e9c4603bc8..8880009c19 100644 --- a/.github/workflows/build_orca.yml +++ b/.github/workflows/build_orca.yml @@ -264,8 +264,9 @@ jobs: KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} CERTIFICATE_ID: ${{ secrets.MACOS_CERTIFICATE_ID }} run: | - # Load the `retry` helper (retries flaky commands such as `hdiutil create`). + # Load the `retry` and `create_dmg` helpers. source ${{ github.workspace }}/scripts/retry.sh + source ${{ github.workspace }}/scripts/create_dmg.sh CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH @@ -319,7 +320,7 @@ jobs: rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/* cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/ ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications - retry hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg + create_dmg "OrcaSlicer" ${{ github.workspace }}/build/universal/OrcaSlicer_dmg OrcaSlicer_Mac_universal_${{ env.ver }}.dmg codesign --deep --force --verbose --options runtime --timestamp --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE_ID" OrcaSlicer_Mac_universal_${{ env.ver }}.dmg # Create separate OrcaSlicer_profile_validator DMG if the app exists @@ -328,7 +329,7 @@ jobs: rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/* cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/ ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications - retry hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg + create_dmg "OrcaSlicer Profile Validator" ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg codesign --deep --force --verbose --options runtime --timestamp --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE_ID" OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg fi @@ -346,13 +347,14 @@ jobs: if: github.ref != 'refs/heads/main' && runner.os == 'macOS' && inputs.macos-combine-only working-directory: ${{ github.workspace }} run: | - # Load the `retry` helper (retries flaky commands such as `hdiutil create`). + # Load the `retry` and `create_dmg` helpers. source ${{ github.workspace }}/scripts/retry.sh + source ${{ github.workspace }}/scripts/create_dmg.sh mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/* cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/ ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications - retry hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg + create_dmg "OrcaSlicer" ${{ github.workspace }}/build/universal/OrcaSlicer_dmg OrcaSlicer_Mac_universal_${{ env.ver }}.dmg # Create separate OrcaSlicer_profile_validator DMG if the app exists if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then @@ -360,7 +362,7 @@ jobs: rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/* cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/ ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications - retry hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg + create_dmg "OrcaSlicer Profile Validator" ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg fi # Delete the per-arch bundles only after signing/DMG creation succeeded, so a diff --git a/scripts/create_dmg.sh b/scripts/create_dmg.sh new file mode 100644 index 0000000000..81804b7542 --- /dev/null +++ b/scripts/create_dmg.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Sourceable helper: `create_dmg ` builds a +# compressed DMG, retrying via `retry` (source retry.sh first). +# hdiutil sizes the image from -srcfolder itself and sometimes leaves too +# little room, failing with "No space left on device" on every attempt. An +# explicit -size of the source plus 20% and 50 MB avoids that; the free space +# compresses away in UDZO. +create_dmg() { + local volname="$1" srcfolder="$2" output="$3" + local src_mb + src_mb=$(( $(du -sk "$srcfolder" | cut -f1) / 1024 )) + retry hdiutil create -volname "$volname" -srcfolder "$srcfolder" \ + -size "$(( src_mb + src_mb / 5 + 50 ))m" -ov -format UDZO "$output" +}