diff --git a/.github/workflows/VerifyChanges.yaml b/.github/workflows/VerifyChanges.yaml index 54cac41..cbd8bbd 100644 --- a/.github/workflows/VerifyChanges.yaml +++ b/.github/workflows/VerifyChanges.yaml @@ -7,6 +7,9 @@ on: push: branches: ["main"] +env: + XCODE_VERSION: 26.0.1 + jobs: lint: name: Lint @@ -14,12 +17,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Select Xcode 26.0.0 - run: | - sudo xcode-select -s /Applications/Xcode_26.0.0.app + - name: Select Xcode ${{ env.XCODE_VERSION }} + run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app - name: Lint - run: | - Scripts/lint + run: Scripts/lint build-and-test: name: Build and Test (${{ matrix.platform }}) needs: lint @@ -68,9 +69,8 @@ jobs: sourcepackages-directory: .build/DerivedData/SourcePackages swiftpm-package-resolved-file: Package.resolved verbose: true - - name: Select Xcode 26.0 - run: | - sudo xcode-select -s /Applications/Xcode_26.0.0.app + - name: Select Xcode ${{ env.XCODE_VERSION }} + run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app - name: Build for Testing run: | "$DEV_BUILDS"/build_and_test.sh --action build-for-testing diff --git a/Scripts/format b/Scripts/format new file mode 100755 index 0000000..d762974 --- /dev/null +++ b/Scripts/format @@ -0,0 +1,13 @@ +#!/bin/bash + +# Get the directory where this script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Go to the repository root (one level up from Scripts) +REPO_ROOT="$(dirname "$SCRIPT_DIR")" + +# Run swift format with --in-place to fix formatting issues +swift format --in-place --recursive \ + "$REPO_ROOT/Packages/" \ + "$REPO_ROOT/Sources/" \ + "$REPO_ROOT/Tests/" diff --git a/Scripts/test-all-platforms b/Scripts/test-all-platforms index 2e1df9e..c11b8fb 100755 --- a/Scripts/test-all-platforms +++ b/Scripts/test-all-platforms @@ -23,7 +23,7 @@ print_error() { # Platforms to test PLATFORMS=( - "iOS Simulator,name=iPhone 16 Pro" + "iOS Simulator,name=iPhone 17 Pro" "macOS" "tvOS Simulator,name=Apple TV 4K" ) diff --git a/Sources/DevColorExtraction/MostCommonColors.swift b/Sources/DevColorExtraction/MostCommonColors.swift index deb4c0c..197d4e2 100644 --- a/Sources/DevColorExtraction/MostCommonColors.swift +++ b/Sources/DevColorExtraction/MostCommonColors.swift @@ -22,7 +22,7 @@ extension CGImage { public func mostCommonColors( count: Int, passes: Int = 5, - edges: EdgeSet = .none + edges: EdgeSet = .none, ) -> [(color: CGColor, weight: CGFloat)]? { // Create a CIImage from which to extract the most common colors let ciImage: CIImage @@ -128,7 +128,7 @@ extension CGContext { bitsPerComponent: 8, bytesPerRow: width * 4, space: CGColorSpace(name: CGColorSpace.sRGB)!, - bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue + bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue, ) } } @@ -148,7 +148,7 @@ extension CIImage { fileprivate func mostCommonColors( count: Int, extent: CGRect, - passes: Int + passes: Int, ) -> [(color: CGColor, weight: CGFloat)]? { // Run the k-means filter. let filter = CIFilter.kMeans() @@ -182,7 +182,7 @@ extension CIImage { let bitmapSize = count * 4 let bitmap = UnsafeMutableRawPointer.allocate( byteCount: bitmapSize, - alignment: MemoryLayout.alignment + alignment: MemoryLayout.alignment, ) defer { bitmap.deallocate() } @@ -194,7 +194,7 @@ extension CIImage { rowBytes: bitmapSize, bounds: CGRect(x: 0, y: 0, width: count, height: 1), format: .RGBA8, - colorSpace: CGColorSpace(name: CGColorSpace.sRGB) + colorSpace: CGColorSpace(name: CGColorSpace.sRGB), ) // Extract the RGBA values, with weight corresponding to the alpha value. @@ -205,9 +205,9 @@ extension CIImage { srgbRed: CGFloat(rgbaBuffer[4 * i + 0]) / 255.0, green: CGFloat(rgbaBuffer[4 * i + 1]) / 255.0, blue: CGFloat(rgbaBuffer[4 * i + 2]) / 255.0, - alpha: 1.0 + alpha: 1.0, ), - weight: CGFloat(rgbaBuffer[4 * i + 3]) / 255.0 + weight: CGFloat(rgbaBuffer[4 * i + 3]) / 255.0, ) } } diff --git a/Tests/DevColorExtractionTests/MostCommonColorsTests.swift b/Tests/DevColorExtractionTests/MostCommonColorsTests.swift index 5c7c268..22d3290 100644 --- a/Tests/DevColorExtractionTests/MostCommonColorsTests.swift +++ b/Tests/DevColorExtractionTests/MostCommonColorsTests.swift @@ -126,7 +126,7 @@ struct MostCommonColorsTests { expectEqualColors( result[0].color, CGColor(srgbRed: red, green: green, blue: blue, alpha: 1.0), - tolerance: 0.15 + tolerance: 0.15, ) } @@ -359,7 +359,7 @@ struct MostCommonColorsTests { fileID: String = #fileID, filePath: String = #filePath, line: Int = #line, - column: Int = #column + column: Int = #column, ) { let sourceLocation = SourceLocation(fileID: fileID, filePath: filePath, line: line, column: column) @@ -375,7 +375,7 @@ struct MostCommonColorsTests { #expect( actualComponent.isApproximatelyEqual(to: expectedComponent, absoluteTolerance: tolerance), "Color component \(actualComponent) not within tolerance \(tolerance) of \(expectedComponent)", - sourceLocation: sourceLocation + sourceLocation: sourceLocation, ) } }