Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Checks build Peel for release and hold the package to warnings as errors

Țugui Dragoșc8e02bec0abb
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index a1162e1f..e1b093f9 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -17,10 +17,12 @@ concurrency:
jobs:
test:
if: github.event_name == 'workflow_dispatch' || !github.event.repository.private
- # Peel needs Swift 6.4, which comes with Xcode 27.
+ # Peel needs Swift 6.4, which comes with Xcode 27. GitHub offers Xcode 27 only on this preview image, on Apple
+ # silicon, so the Release build below is what compiles Peel for Intel Macs.
runs-on: xcode-27
steps:
- - uses: actions/checkout@v7
+ # Pinned to the commit of v7.0.1, so a tag moved by someone else changes nothing here.
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Show the toolchain
run: |
@@ -38,14 +40,28 @@ jobs:
exit 1
fi
+ # The app's targets treat warnings as errors in the project; the package is held to the same here.
- name: Test PeelCore
- run: swift test --package-path Packages/PeelCore
+ run: swift test --package-path Packages/PeelCore -Xswiftc -warnings-as-errors
- name: Build the app
run: |
xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Debug \
-derivedDataPath build/DerivedData CODE_SIGNING_ALLOWED=NO build
+ # Release builds every binary for Apple silicon and Intel alike, with the optimizer a Debug build leaves off.
+ - name: Build the app for release
+ run: |
+ xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Release \
+ -derivedDataPath build/Release CODE_SIGNING_ALLOWED=NO build
+ for binary in MacOS/Peel MacOS/PeelHelper Helpers/peel PlugIns/PeelFinder.appex/Contents/MacOS/PeelFinder; do
+ archs=$(lipo -archs "build/Release/Build/Products/Release/Peel.app/Contents/$binary")
+ case "$archs" in
+ *x86_64*arm64*|*arm64*x86_64*) ;;
+ *) echo "::error::$binary is built for $archs only."; exit 1 ;;
+ esac
+ done
+
# The accessibility audit drives the pointer, so it runs by hand before a release. Here it is only built.
- name: Build the accessibility audit
run: |
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/TextEditingTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/TextEditingTests.swift
index cd1a000f..6b61c3c9 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/TextEditingTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/TextEditingTests.swift
@@ -35,19 +35,19 @@ struct TextEditingTests {
window.contentView?.addSubview(field)
window.makeFirstResponder(field)
let completions = NSPanel(contentRect: NSRect(x: 0, y: 0, width: 100, height: 100), styleMask: [], backing: .buffered, defer: true)
- var key: NSWindow? = window
- let editing = TextEditing(keyWindow: { key })
+ let key = KeyWindow(window)
+ let editing = TextEditing(keyWindow: { key.window })
editing.start()
#expect(editing.isEditing)
NotificationCenter.default.post(name: NSWindow.didBecomeKeyNotification, object: completions)
#expect(editing.isEditing)
- key = completions
+ key.window = completions
NotificationCenter.default.post(name: NSWindow.didBecomeKeyNotification, object: completions)
#expect(!editing.isEditing)
- key = nil
+ key.window = nil
NotificationCenter.default.post(name: NSWindow.didResignKeyNotification, object: completions)
#expect(!editing.isEditing)
}
@@ -64,3 +64,13 @@ struct TextEditingTests {
#expect(!TextEditing.edits(nil))
}
}
+
+/// The window a test says is key, read by `TextEditing` each time a window says it became key.
+@MainActor
+private final class KeyWindow {
+ var window: NSWindow?
+
+ init(_ window: NSWindow?) {
+ self.window = window
+ }
+}