diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b06ea1..c86ed05 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,18 +76,69 @@ jobs: path: dist/PDFApps-Linux.tar.gz # ── macOS ─────────────────────────────────────────────────── + - name: Free macOS disk space + if: runner.os == 'macOS' + # macos-latest ships with Xcode (~16 GB) which our pure-Python + # build doesn't use. Removing it plus dropping APFS local + # snapshots frees enough disk for hdiutil to create the DMG. + # We keep CommandLineTools because PyInstaller calls + # lipo / codesign / otool to slice and re-sign Mach-O binaries + # — without those, the build dies with "lipo command ... + # failed with error code 1". + run: | + echo "── before cleanup ──" + df -h / + sudo rm -rf /Applications/Xcode*.app + # Default xcode-select path points at the (now gone) Xcode + # bundle; redirect to CommandLineTools so /usr/bin/lipo and + # friends keep resolving. + sudo xcode-select -s /Library/Developer/CommandLineTools || true + # Without this, the bytes freed by `rm -rf Xcode` are still + # reserved by Time Machine local snapshots and df doesn't + # actually drop. + sudo tmutil deletelocalsnapshots / || true + echo "── after cleanup ──" + df -h / + - name: Build (macOS) if: runner.os == 'macOS' run: | + echo "── before PyInstaller ──" + df -h python -m PyInstaller --noconfirm pdfapps.spec - # Create DMG with the .app bundle and an Applications shortcut + echo "── after PyInstaller ──" + df -h + du -sh dist/PDFApps.app + # PyInstaller intermediates (~3-7 GB in build/ + the + # bootloader cache) and the loose Unix exe under dist/ are + # not needed for the DMG — only dist/PDFApps.app is. + rm -rf build/ + rm -rf "$HOME/Library/Application Support/pyinstaller" + rm -f dist/PDFApps + # Create DMG with the .app bundle and an Applications + # shortcut. `mv` (not cp -R) — we don't need to keep the + # source .app after the DMG is built. mkdir -p dist/dmg - cp -R dist/PDFApps.app dist/dmg/ + mv dist/PDFApps.app dist/dmg/ ln -s /Applications dist/dmg/Applications + du -sh dist/dmg + # The previous `hdiutil create -srcfolder` (no -size) + # auto-estimated the intermediate sparse image too tight and + # died with "No space left on device" while *copying into + # the new DMG* — i.e. the runner had 83 GB free, but the + # mounted image at /Volumes/PDFApps/ ran out of bytes mid- + # copy. The .app has thousands of tiny files (Qt + # frameworks, qtawesome fonts, etc.) so HFS+ slack space + # blows past the auto-estimate. Force the intermediate to + # 1 GB; UDZO compression makes the final .dmg much smaller. hdiutil create -volname "PDFApps" \ -srcfolder dist/dmg \ -ov -format UDZO \ + -size 1g \ dist/PDFApps-macOS.dmg + echo "── after DMG ──" + df -h + ls -lh dist/PDFApps-macOS.dmg - name: Upload (macOS) if: runner.os == 'macOS'