From aba18e865e59e29445858d6446c80815ae7e2786 Mon Sep 17 00:00:00 2001 From: Ky Northstar Date: Sun, 23 Mar 2025 20:13:34 -0600 Subject: [PATCH] Updating workflows to work on current GitHub stack - Also added watchOS tests - Also preparing for Swift 6 --- .github/workflows/iOS.yml | 23 ++++++++++---- .github/workflows/macOS.yml | 14 +++++++-- .github/workflows/watchOS.yml | 30 +++++++++++++++++++ Package.swift | 4 +-- .../CIVector + DualTwoDimensional.swift | 2 ++ Tests/RectangleToolsTests/Point Tests.swift | 2 ++ 6 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/watchOS.yml diff --git a/.github/workflows/iOS.yml b/.github/workflows/iOS.yml index a074b01..4cbeaef 100644 --- a/.github/workflows/iOS.yml +++ b/.github/workflows/iOS.yml @@ -5,13 +5,26 @@ on: [pull_request] jobs: build: - timeout-minutes: 5 + timeout-minutes: 6 runs-on: macOS-latest steps: - - uses: actions/checkout@v1 - - name: Generate iOS xcodeproj - run: swift package generate-xcodeproj + - name: Set up Swift 6 + uses: SwiftyLab/setup-swift@latest + with: + swift-version: '6.0' + + - name: Swift version + run: swift --version + + - uses: actions/checkout@v3 + + - name: Build + run: swift build + + - name: What schemes? + run: xcodebuild build test -list + - name: Run iOS tests - run: xcodebuild build test -destination 'name=iPhone 11' -scheme 'RectangleTools-Package' + run: xcodebuild build test -destination 'name=iPhone 16' -scheme 'RectangleTools' diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 14c9a99..6c4862f 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -5,12 +5,22 @@ on: [pull_request] jobs: build: - timeout-minutes: 5 + timeout-minutes: 2 runs-on: macOS-latest steps: - - uses: actions/checkout@v1 + - name: Set up Swift 6 + uses: SwiftyLab/setup-swift@latest + with: + swift-version: '6.0' + + - name: Swift version + run: swift --version + + - uses: actions/checkout@v3 + - name: Build run: swift build -v + - name: Run tests run: swift test -v diff --git a/.github/workflows/watchOS.yml b/.github/workflows/watchOS.yml new file mode 100644 index 0000000..7977853 --- /dev/null +++ b/.github/workflows/watchOS.yml @@ -0,0 +1,30 @@ +name: watchOS + +on: [pull_request] + +jobs: + build: + + timeout-minutes: 4 + runs-on: macOS-latest + + steps: + - name: Set up Swift 6 + uses: SwiftyLab/setup-swift@latest + with: + swift-version: '6.0' + + - name: Swift version + run: swift --version + + - uses: actions/checkout@v3 + + - name: Build + run: swift build + + - name: What schemes? + run: xcodebuild build test -list + + - name: Run watchOS tests + run: xcodebuild build test -destination 'name=Apple Watch Ultra 2 (49mm)' -scheme 'RectangleTools' + diff --git a/Package.swift b/Package.swift index 161242b..ea26862 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.1 +// swift-tools-version:5.10 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -21,7 +21,7 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/RougeWare/Swift-MultiplicativeArithmetic.git", from: "1.4.1"), + .package(name: "MultiplicativeArithmetic", url: "https://github.com/RougeWare/Swift-MultiplicativeArithmetic.git", from: "1.4.1"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/Sources/RectangleTools/Default Conformances/CIVector + DualTwoDimensional.swift b/Sources/RectangleTools/Default Conformances/CIVector + DualTwoDimensional.swift index a5944f4..db2f76f 100644 --- a/Sources/RectangleTools/Default Conformances/CIVector + DualTwoDimensional.swift +++ b/Sources/RectangleTools/Default Conformances/CIVector + DualTwoDimensional.swift @@ -5,6 +5,7 @@ // Created by The Northstar✨ System on 2023-11-16. // +#if canImport(CoreImage) import CoreImage @@ -38,3 +39,4 @@ public extension DualTwoDimensional where Self: CIVector { w: secondDimensionPair.y) } } +#endif diff --git a/Tests/RectangleToolsTests/Point Tests.swift b/Tests/RectangleToolsTests/Point Tests.swift index 778005d..182f465 100644 --- a/Tests/RectangleToolsTests/Point Tests.swift +++ b/Tests/RectangleToolsTests/Point Tests.swift @@ -65,6 +65,8 @@ final class Point_Tests: XCTestCase { func testMagnitude() { // https://www.wolframalpha.com/input?i=distance+from+%28-2%2C-1%29+to+%285%2C6%29 + #if canImport(CoreImage) XCTAssertEqual(CIVector(x: -2, y: -1, z: 5, w: 6).magnitude, 7 * sqrt(2)) + #endif } }