From 88cfa8fc91bdbf1b615c6fde399ed3ed55bcebcd Mon Sep 17 00:00:00 2001 From: "Takuto NAKAMURA (Kyome)" Date: Wed, 6 Nov 2024 16:57:34 +0900 Subject: [PATCH 1/5] =?UTF-8?q?AnyHashable=E3=81=ABkeyEquivalent=E3=82=92?= =?UTF-8?q?=E7=94=9F=E3=82=84=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Domain/Service/ShortcutService.swift | 4 ++-- ShiftWindowPackages/Sources/Domain/String+Extension.swift | 4 +++- .../Sources/Presentation/Scene/ShortcutPanelScene.swift | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ShiftWindowPackages/Sources/Domain/Service/ShortcutService.swift b/ShiftWindowPackages/Sources/Domain/Service/ShortcutService.swift index e3694b9..76b1244 100644 --- a/ShiftWindowPackages/Sources/Domain/Service/ShortcutService.swift +++ b/ShiftWindowPackages/Sources/Domain/Service/ShortcutService.swift @@ -58,7 +58,7 @@ public actor ShortcutService { PanelSceneMessenger.request( panelAction: .open, with: .shortcutPanel, - userInfo: [String.keyEquivalent: keyCombo.string] + userInfo: [.keyEquivalent: keyCombo.string] ) } await shiftService.shiftWindow(shiftType: pattern.shiftType) @@ -83,7 +83,7 @@ public actor ShortcutService { PanelSceneMessenger.request( panelAction: .open, with: .shortcutPanel, - userInfo: [String.keyEquivalent: keyCombo.string] + userInfo: [.keyEquivalent: keyCombo.string] ) } await shiftService.shiftWindow(shiftType: pattern.shiftType) diff --git a/ShiftWindowPackages/Sources/Domain/String+Extension.swift b/ShiftWindowPackages/Sources/Domain/String+Extension.swift index b651334..74448aa 100644 --- a/ShiftWindowPackages/Sources/Domain/String+Extension.swift +++ b/ShiftWindowPackages/Sources/Domain/String+Extension.swift @@ -22,7 +22,9 @@ import Foundation extension String { public static let shortcutPanel = "shortcutPanel" - public static let keyEquivalent = "keyEquivalent" public static let kAXFullScreen = "AXFullScreen" } +extension AnyHashable { + public static let keyEquivalent = "keyEquivalent" +} diff --git a/ShiftWindowPackages/Sources/Presentation/Scene/ShortcutPanelScene.swift b/ShiftWindowPackages/Sources/Presentation/Scene/ShortcutPanelScene.swift index 7bd0247..27db1a7 100644 --- a/ShiftWindowPackages/Sources/Presentation/Scene/ShortcutPanelScene.swift +++ b/ShiftWindowPackages/Sources/Presentation/Scene/ShortcutPanelScene.swift @@ -32,8 +32,9 @@ public struct ShortcutPanelScene: Scene { public var body: some Scene { PanelScene(isPresented: $isPresented, type: ShortcutPanel.self) { userInfo in - let keyEquivalent = (userInfo?[String.keyEquivalent] as? String) ?? "" - ShortcutView(keyEquivalent: keyEquivalent) + if let keyEquivalent = userInfo?[.keyEquivalent] as? String { + ShortcutView(keyEquivalent: keyEquivalent) + } } } } From e9a618e34e6cc52d8b85378d3ae526f6873fa840 Mon Sep 17 00:00:00 2001 From: "Takuto NAKAMURA (Kyome)" Date: Wed, 6 Nov 2024 22:09:22 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E7=B0=A1=E5=8D=98=E3=81=AB=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E3=81=A7=E3=81=8D=E3=82=8B=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=92=E6=9B=B8=E3=81=84=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShiftWindowPackages/Package.swift | 5 +- .../Dependency/CGDirectDisplayClient.swift | 33 +++++ .../Sources/Domain/AppDependency.swift | 8 +- .../Sources/Domain/Service/ShiftService.swift | 7 +- .../Tests/DomainTests/DomainTests.swift | 7 - .../DomainTests/LoggerServiceTests.swift | 20 +++ .../Tests/DomainTests/ShiftServiceTests.swift | 130 ++++++++++++++++++ .../DomainTests/ShortcutServiceTests.swift | 24 ++++ 8 files changed, 224 insertions(+), 10 deletions(-) create mode 100644 ShiftWindowPackages/Sources/DataLayer/Dependency/CGDirectDisplayClient.swift delete mode 100644 ShiftWindowPackages/Tests/DomainTests/DomainTests.swift create mode 100644 ShiftWindowPackages/Tests/DomainTests/LoggerServiceTests.swift create mode 100644 ShiftWindowPackages/Tests/DomainTests/ShiftServiceTests.swift create mode 100644 ShiftWindowPackages/Tests/DomainTests/ShortcutServiceTests.swift diff --git a/ShiftWindowPackages/Package.swift b/ShiftWindowPackages/Package.swift index 9d7c379..657f222 100644 --- a/ShiftWindowPackages/Package.swift +++ b/ShiftWindowPackages/Package.swift @@ -52,7 +52,10 @@ let package = Package( ), .testTarget( name: "DomainTests", - dependencies: ["Domain"], + dependencies: [ + "DataLayer", + "Domain", + ], swiftSettings: swiftSettings ), .target( diff --git a/ShiftWindowPackages/Sources/DataLayer/Dependency/CGDirectDisplayClient.swift b/ShiftWindowPackages/Sources/DataLayer/Dependency/CGDirectDisplayClient.swift new file mode 100644 index 0000000..10e8454 --- /dev/null +++ b/ShiftWindowPackages/Sources/DataLayer/Dependency/CGDirectDisplayClient.swift @@ -0,0 +1,33 @@ +/* + CGDirectDisplayClient.swift + DataLayer + + Created by Takuto Nakamura on 2024/11/06. + Copyright 2022 Takuto Nakamura (Kyome22) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +import CoreGraphics + +public struct CGDirectDisplayClient: DependencyClient { + public var bounds: @Sendable (CGDirectDisplayID) -> CGRect + + public static let liveValue = Self( + bounds: { CGDisplayBounds($0) } + ) + + public static let testValue = Self( + bounds: { _ in CGRect.zero } + ) +} diff --git a/ShiftWindowPackages/Sources/Domain/AppDependency.swift b/ShiftWindowPackages/Sources/Domain/AppDependency.swift index e4cc253..9bf9153 100644 --- a/ShiftWindowPackages/Sources/Domain/AppDependency.swift +++ b/ShiftWindowPackages/Sources/Domain/AppDependency.swift @@ -34,6 +34,7 @@ public final class AppDependency: Sendable { public let shortcutService: ShortcutService public nonisolated init( + cgDirectDisplayClient: CGDirectDisplayClient = .liveValue, executeClient: ExecuteClient = .liveValue, hiServicesClient: HIServicesClient = .liveValue, loggingSystemClient: LoggingSystemClient = .liveValue, @@ -51,13 +52,18 @@ public final class AppDependency: Sendable { userDefaultsRepository = .init(userDefaultsClient, reset: needsResetUserDefaults) launchAtLoginRepository = .init(smAppServiceClient) logService = .init(loggingSystemClient) - shiftService = .init(hiServicesClient, nsAppClient, nsScreenClient, nsWorkspaceClient) + shiftService = .init(cgDirectDisplayClient, + hiServicesClient, + nsAppClient, + nsScreenClient, + nsWorkspaceClient) shortcutService = .init(userDefaultsRepository, shiftService) } } struct AppDependencyKey: EnvironmentKey { static let defaultValue = AppDependency( + cgDirectDisplayClient: .testValue, executeClient: .testValue, hiServicesClient: .testValue, loggingSystemClient: .testValue, diff --git a/ShiftWindowPackages/Sources/Domain/Service/ShiftService.swift b/ShiftWindowPackages/Sources/Domain/Service/ShiftService.swift index b208ad1..2df6798 100644 --- a/ShiftWindowPackages/Sources/Domain/Service/ShiftService.swift +++ b/ShiftWindowPackages/Sources/Domain/Service/ShiftService.swift @@ -23,17 +23,20 @@ import DataLayer import Foundation public actor ShiftService { + private let cgDirectDisplayClient: CGDirectDisplayClient private let hiServicesClient: HIServicesClient private let nsAppClient: NSAppClient private let nsScreenClient: NSScreenClient private let nsWorkspaceClient: NSWorkspaceClient public init( + _ cgDirectDisplayClient: CGDirectDisplayClient, _ hiServicesClient: HIServicesClient, _ nsAppClient: NSAppClient, _ nsScreenClient: NSScreenClient, _ nsWorkspaceClient: NSWorkspaceClient ) { + self.cgDirectDisplayClient = cgDirectDisplayClient self.hiServicesClient = hiServicesClient self.nsAppClient = nsAppClient self.nsScreenClient = nsScreenClient @@ -61,7 +64,7 @@ public actor ShiftService { func getValidFrame() async -> CGRect? { guard let screen = nsScreenClient.mainScreen() else { return nil } - let bounds = CGDisplayBounds(screen.displayID) + let bounds = cgDirectDisplayClient.bounds(screen.displayID) let visibleFrame = screen.visibleFrame let menuBarHeight = await MainActor.run { nsAppClient.mainMenu()?.menuBarHeight @@ -125,6 +128,7 @@ public actor ShiftService { } // MARK: Get Attribute Names of an AXUIElement + #if DEBUG func getAttributeNames(element: AXUIElement) -> [String]? { var ref: CFArray? = nil guard hiServicesClient.copyAttributeNames(element, &ref) == .success, let ref else { @@ -132,6 +136,7 @@ public actor ShiftService { } return ref as [AnyObject] as? [String] } + #endif // MARK: Get Window Attributes func copyAttributeValue(_ element: AXUIElement, attribute: String) -> CFTypeRef? { diff --git a/ShiftWindowPackages/Tests/DomainTests/DomainTests.swift b/ShiftWindowPackages/Tests/DomainTests/DomainTests.swift deleted file mode 100644 index 6783b3c..0000000 --- a/ShiftWindowPackages/Tests/DomainTests/DomainTests.swift +++ /dev/null @@ -1,7 +0,0 @@ -import XCTest - -@testable import Domain - -final class DomainTests: XCTestCase { - func testExample() throws {} -} diff --git a/ShiftWindowPackages/Tests/DomainTests/LoggerServiceTests.swift b/ShiftWindowPackages/Tests/DomainTests/LoggerServiceTests.swift new file mode 100644 index 0000000..c6ca785 --- /dev/null +++ b/ShiftWindowPackages/Tests/DomainTests/LoggerServiceTests.swift @@ -0,0 +1,20 @@ +import DataLayer +import os +import XCTest + +@testable import Domain + +final class LoggerServiceTests: XCTestCase { + func test_bootstrapは一度しか実行されない() async throws { + let count = OSAllocatedUnfairLock(initialState: 0) + var mock: LoggingSystemClient = .testValue + mock.bootstrap = { _ in + count.withLock { $0 += 1 } + } + let sut = LogService(mock) + await sut.bootstrap() + await sut.bootstrap() + let actual = count.withLock { $0 } + XCTAssertEqual(actual, 1) + } +} diff --git a/ShiftWindowPackages/Tests/DomainTests/ShiftServiceTests.swift b/ShiftWindowPackages/Tests/DomainTests/ShiftServiceTests.swift new file mode 100644 index 0000000..abf2356 --- /dev/null +++ b/ShiftWindowPackages/Tests/DomainTests/ShiftServiceTests.swift @@ -0,0 +1,130 @@ +import DataLayer +import os +import XCTest + +@testable import Domain + +final class ShiftServiceTests: XCTestCase { + func test_getValidFrame_MainScreenが取得不能_nilが返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.getValidFrame() + XCTAssertNil(actual) + } + + func test_getValidFrame_MainScreenが取得可能_Dockが下部に存在_有効領域が返される() async { + var nsScreenClient = NSScreenClient.testValue + nsScreenClient.mainScreen = { NSScreenMock(x: 0, y: 0, width: 100, height: 95) } + var cgDirectDisplayClient = CGDirectDisplayClient.testValue + cgDirectDisplayClient.bounds = { _ in CGRect(x: 0, y: 0, width: 100, height: 100) } + var nsAppClient = NSAppClient.testValue + nsAppClient.mainMenu = { NSMenuMock() } + let sut = ShiftService(cgDirectDisplayClient, .testValue, nsAppClient, nsScreenClient, .testValue) + let actual = await sut.getValidFrame() + XCTAssertEqual(actual, CGRect(x: 0, y: 5, width: 100, height: 95)) + } + + func test_getValidFrame_MainScreenが取得可能_Dockが右側に存在_有効領域が返される() async { + var nsScreenClient = NSScreenClient.testValue + nsScreenClient.mainScreen = { NSScreenMock(x: 0, y: 0, width: 95, height: 95) } + var cgDirectDisplayClient = CGDirectDisplayClient.testValue + cgDirectDisplayClient.bounds = { _ in CGRect(x: 0, y: 0, width: 100, height: 100) } + var nsAppClient = NSAppClient.testValue + nsAppClient.mainMenu = { NSMenuMock() } + let sut = ShiftService(cgDirectDisplayClient, .testValue, nsAppClient, nsScreenClient, .testValue) + let actual = await sut.getValidFrame() + XCTAssertEqual(actual, CGRect(x: 0, y: 5, width: 94, height: 95)) + } + + func test_getValidFrame_MainScreenが取得可能_Dockが左側に存在_有効領域が返される() async { + var nsScreenClient = NSScreenClient.testValue + nsScreenClient.mainScreen = { NSScreenMock(x: 5, y: 0, width: 95, height: 95) } + var cgDirectDisplayClient = CGDirectDisplayClient.testValue + cgDirectDisplayClient.bounds = { _ in CGRect(x: 0, y: 0, width: 100, height: 100) } + var nsAppClient = NSAppClient.testValue + nsAppClient.mainMenu = { NSMenuMock() } + let sut = ShiftService(cgDirectDisplayClient, .testValue, nsAppClient, nsScreenClient, .testValue) + let actual = await sut.getValidFrame() + XCTAssertEqual(actual, CGRect(x: 6, y: 5, width: 94, height: 95)) + } + + func test_makeNewFrame_幅が負_nilが返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .maximize, validFrame: CGRect(x: 0, y: 0, width: -1, height: 0)) + XCTAssertNil(actual) + } + + func test_makeNewFrame_高さが負_nilが返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .maximize, validFrame: CGRect(x: 0, y: 0, width: 0, height: -1)) + XCTAssertNil(actual) + } + + func test_makeNewFrame_上側1/2_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .topHalf, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 0, y: 0, width: 100, height: 50)) + } + + func test_makeNewFrame_下側1/2_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .bottomHalf, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 0, y: 50, width: 100, height: 50)) + } + + func test_makeNewFrame_左側1/2_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .leftHalf, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 0, y: 0, width: 50, height: 100)) + } + + func test_makeNewFrame_右側1/2_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .rightHalf, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 50, y: 0, width: 50, height: 100)) + } + + func test_makeNewFrame_左側1/3_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .leftThird, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 0, y: 0, width: 33, height: 100)) + } + + func test_makeNewFrame_左側2/3_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .leftTwoThirds, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 0, y: 0, width: 66, height: 100)) + } + + func test_makeNewFrame_中央1/3_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .middleThird, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 33, y: 0, width: 33, height: 100)) + } + + func test_makeNewFrame_右側2/3_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .rightTwoThirds, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 33, y: 0, width: 67, height: 100)) + } + + func test_makeNewFrame_右側1/3_領域が返される() async { + let sut = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) + let actual = await sut.makeNewFrame(shiftType: .rightThird, validFrame: CGRect(x: 0, y: 0, width: 100, height: 100)) + XCTAssertEqual(actual, CGRect(x: 66, y: 0, width: 34, height: 100)) + } +} + +fileprivate class NSScreenMock: NSScreen { + let _visibleFrame: NSRect + + init(x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat) { + _visibleFrame = NSRect(x: x, y: y, width: width, height: height) + super.init() + } + + override var visibleFrame: NSRect { _visibleFrame } +} + +fileprivate class NSMenuMock: NSMenu { + override var menuBarHeight: CGFloat { 5 } +} diff --git a/ShiftWindowPackages/Tests/DomainTests/ShortcutServiceTests.swift b/ShiftWindowPackages/Tests/DomainTests/ShortcutServiceTests.swift new file mode 100644 index 0000000..98d417f --- /dev/null +++ b/ShiftWindowPackages/Tests/DomainTests/ShortcutServiceTests.swift @@ -0,0 +1,24 @@ +import os +import XCTest + +@testable import DataLayer +@testable import Domain + +final class ShortcutServiceTests: XCTestCase { + func test_Example() async { + var userDefaultsClient = UserDefaultsClient.testValue + userDefaultsClient.data = { _ in + try! JSONEncoder().encode([ + ShiftPattern(shiftType: .topHalf), + ShiftPattern(shiftType: .bottomHalf), + ShiftPattern(shiftType: .leftHalf), + ]) + } + let sut = ShortcutService( + .init(userDefaultsClient, reset: false), + .init(.testValue, .testValue, .testValue, .testValue, .testValue) + ) + let actual = await sut.getIndex(id: ShiftType.bottomHalf.id) + XCTAssertEqual(actual, 1) + } +} From b4369a5cae57597e4ffa32e244347310d1ca861d Mon Sep 17 00:00:00 2001 From: "Takuto NAKAMURA (Kyome)" Date: Wed, 6 Nov 2024 22:42:14 +0900 Subject: [PATCH 3/5] Update .gitignore --- .gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 73bbf19..41c6bc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,16 @@ +# Mac .DS_Store + +# Xcode xcuserdata/ *.xcuserstate *.xccheckout + +# Swift Package Manager +Packages.resolved +.swiftpm/ +.build/ +ShiftWindowPackages/Package.resolved + +# Test +TestResults/ From 03bf1e92d4fbb64bc927e09423899ef7d0ca056d Mon Sep 17 00:00:00 2001 From: "Takuto NAKAMURA (Kyome)" Date: Wed, 6 Nov 2024 22:59:18 +0900 Subject: [PATCH 4/5] Fix build error --- ShiftWindowPackages/Sources/Presentation/View/MenuView.swift | 2 +- .../Sources/Presentation/View/ShortcutSettingsView.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ShiftWindowPackages/Sources/Presentation/View/MenuView.swift b/ShiftWindowPackages/Sources/Presentation/View/MenuView.swift index 0d866ad..0ff5d01 100644 --- a/ShiftWindowPackages/Sources/Presentation/View/MenuView.swift +++ b/ShiftWindowPackages/Sources/Presentation/View/MenuView.swift @@ -81,7 +81,7 @@ struct MenuView: View { } #Preview { - let shiftService = ShiftService(.testValue, .testValue, .testValue, .testValue) + let shiftService = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) MenuView( executeClient: .testValue, nsAppClient: .testValue, diff --git a/ShiftWindowPackages/Sources/Presentation/View/ShortcutSettingsView.swift b/ShiftWindowPackages/Sources/Presentation/View/ShortcutSettingsView.swift index 0122be9..671f4e9 100644 --- a/ShiftWindowPackages/Sources/Presentation/View/ShortcutSettingsView.swift +++ b/ShiftWindowPackages/Sources/Presentation/View/ShortcutSettingsView.swift @@ -81,7 +81,7 @@ struct ShortcutSettingsView: View { #Preview { let userDefaultsRepository = UserDefaultsRepository(.testValue, reset: false) - let shiftService = ShiftService(.testValue, .testValue, .testValue, .testValue) + let shiftService = ShiftService(.testValue, .testValue, .testValue, .testValue, .testValue) ShortcutSettingsView( userDefaultsRepository: userDefaultsRepository, logService: .init(.testValue), From 6b76128c08166f80c0d1b2ab926c403d5a31f23e Mon Sep 17 00:00:00 2001 From: "Takuto NAKAMURA (Kyome)" Date: Wed, 6 Nov 2024 22:59:23 +0900 Subject: [PATCH 5/5] Create test.yml --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..39e3e00 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Test + +on: + workflow_dispatch: + push: + branches: + - "main" + paths-ignore: + - "**/README.md" + +jobs: + unit-test: + name: Unit Test + runs-on: macos-14 + env: + DEVELOPER_DIR: "/Applications/Xcode_16.app/Contents/Developer" + + steps: + - uses: actions/checkout@v4 + + - name: Show Xcode version + run: xcodebuild -version + + - name: Run Test + working-directory: ShiftWindowPackages + run: | + xcodebuild -scheme ShiftWindowPackages-Package test \ + -destination "platform=macOS,arch=arm64" \ + -resultBundlePath TestResults/result_bundle |\ + xcpretty -c && exit ${PIPESTATUS[0]} + + - name: Archive test results + if: success() || failure() + uses: kishikawakatsumi/xcresulttool@v1 + with: + path: TestResults/result_bundle.xcresult + show-passed-tests: false