diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index dccdfdef..07a49a13 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -6,7 +6,7 @@ agents: queue: "mac" env: - IMAGE_ID: $IMAGE_ID + IMAGE_ID: $CURRENT_IMAGE_ID steps: ################# @@ -21,20 +21,56 @@ steps: ################# # Build and Test ################# - - label: "📦 Build and Test Swift Package" - key: "test" - command: | - validate_swift_package - plugins: [$CI_TOOLKIT] + - group: "📦 Build and Test Swift Package" + steps: + - label: "📦 Build and Test Swift Package (Swift {{matrix.swift_version}})" + key: "test" + command: | + validate_swift_package test device_model:"{{matrix.device_model}}" os:"{{matrix.device_os}}" + plugins: [$CI_TOOLKIT] + env: + IMAGE_ID: "{{matrix.image_id}}" + matrix: + setup: # Specify the current version of Xcode, Swift, a device, and the required version of iOS + image_id: $CURRENT_IMAGE_ID + swift_version: $CURRENT_SWIFT_VERSION + device_model: $CURRENT_DEVICE + device_os: $CURRENT_OS + adjustments: # Specify additional versions of Xcode, Swift, a device, and the required version of iOS + - with: # Swift 5.9 + image_id: $SWIFT_5_9_IMAGE_ID + swift_version: $SWIFT_5_9_VERSION + device_model: $SWIFT_5_9_DEVICE + device_os: $SWIFT_5_9_OS + - with: # Swift 6.0 + image_id: $SWIFT_6_0_IMAGE_ID + swift_version: $SWIFT_6_0_VERSION + device_model: $SWIFT_6_0_DEVICE + device_os: $SWIFT_6_0_OS ################### # Validate Podspec ################### - - label: "🔬 Validate Podspecs" - key: "validate" - command: | - .buildkite/commands/validate-pods.sh - plugins: [$CI_TOOLKIT] + - group: "🔬 Validate Podspecs" + steps: + - label: "🔬 Validate Podspecs (Swift {{matrix.swift_version}})" + key: "validate" + command: | + .buildkite/commands/validate-pods.sh + plugins: [$CI_TOOLKIT] + env: + IMAGE_ID: "{{matrix.image_id}}" + matrix: + setup: # Specify the current version of Xcode and Swift + image_id: $CURRENT_IMAGE_ID + swift_version: $CURRENT_SWIFT_VERSION + adjustments: # Specify additional versions of Xcode and Swift + - with: + image_id: $SWIFT_5_9_IMAGE_ID + swift_version: $SWIFT_5_9_VERSION + - with: + image_id: $SWIFT_6_0_IMAGE_ID + swift_version: $SWIFT_6_0_VERSION ####################### # Publish the Podspecs (if we're building a tag) diff --git a/.buildkite/shared-pipeline-vars b/.buildkite/shared-pipeline-vars index c388d1a1..da2f5415 100644 --- a/.buildkite/shared-pipeline-vars +++ b/.buildkite/shared-pipeline-vars @@ -3,6 +3,29 @@ # This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used # to set up some variables that will be interpolated in the `.yml` pipeline before uploading it. -export IMAGE_ID=$(echo "xcode-$(cat .xcode-version)") - export CI_TOOLKIT="automattic/a8c-ci-toolkit#3.2.2" + +## Supported versions of Swift +# Swift 6.0 +export SWIFT_6_0_IMAGE_ID="xcode-16.0-v7" +export SWIFT_6_0_VERSION="6_0" # Use `_` instead of `.` since these are used in labels +export SWIFT_6_0_DEVICE="default" # Use the default value in Fastlane +export SWIFT_6_0_OS="18.0" + +# Swift 5.10 +export SWIFT_5_10_IMAGE_ID="xcode-15.4" +export SWIFT_5_10_VERSION="5_10" # Use `_` instead of `.` since these are used in labels +export SWIFT_5_10_DEVICE="default" +export SWIFT_5_10_OS="17.5" + +# Swift 5.9 +export SWIFT_5_9_IMAGE_ID="xcode-15.2-xl" +export SWIFT_5_9_VERSION="5_9" # Use `_` instead of `.` since these are used in labels +export SWIFT_5_9_DEVICE="default" # Use the default value in Fastlane +export SWIFT_5_9_OS="17.2" + +# Current Development Environment +export CURRENT_IMAGE_ID=$SWIFT_5_10_IMAGE_ID +export CURRENT_SWIFT_VERSION=$SWIFT_5_10_VERSION +export CURRENT_DEVICE=$SWIFT_5_10_DEVICE +export CURRENT_OS="default" # Use the default value in Fastlane diff --git a/.xcode-version b/.xcode-version deleted file mode 100644 index 232a7fc1..00000000 --- a/.xcode-version +++ /dev/null @@ -1 +0,0 @@ -15.4 diff --git a/Package.resolved b/Package.resolved index f1e5bd25..be720318 100644 --- a/Package.resolved +++ b/Package.resolved @@ -38,5 +38,5 @@ } } ], - "version" : 3 + "version" : 2 } diff --git a/Package.swift b/Package.swift index 375317e6..85415080 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.10 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/Sources/GravatarUI/Base/AssociatedObject.swift b/Sources/GravatarUI/Base/AssociatedObject.swift index 308e6cf2..e2af192a 100644 --- a/Sources/GravatarUI/Base/AssociatedObject.swift +++ b/Sources/GravatarUI/Base/AssociatedObject.swift @@ -2,9 +2,11 @@ import Foundation func getAssociatedObject(_ object: Any, _ key: UnsafeRawPointer) -> T? { if #available(iOS 14, *) { // swift 5.3 fixed this issue (https://github.com/apple/swift/issues/46456) - objc_getAssociatedObject(object, key) as? T + // swiftformat:disable:next --redundantReturn + return objc_getAssociatedObject(object, key) as? T } else { - objc_getAssociatedObject(object, key) as AnyObject as? T + // swiftformat:disable:next --redundantReturn + return objc_getAssociatedObject(object, key) as AnyObject as? T } } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 94459d49..f6ba2938 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -3,7 +3,8 @@ default_platform(:ios) OS = '17.5' -IPHONE_DEVICE = "iPhone SE (3rd generation) (#{OS})".freeze +IPHONE_MODEL = 'iPhone SE (3rd generation)' +IPHONE_DEVICE = "#{IPHONE_MODEL} (#{OS})".freeze PROJECT_ROOT_FOLDER = File.join(File.dirname(File.expand_path(__dir__)), 'Demo') BUILD_FOLDER = File.join(__dir__, '.build') @@ -50,12 +51,15 @@ end platform :ios do desc 'Builds the project and runs tests' - lane :test do + lane :test do |device_model: "default", os: "default"| + device_model = IPHONE_MODEL if device_model == "default" + os = OS if os == "default" + run_tests( package_path: '.', scheme: 'Gravatar-Package', xcargs: COMMON_XCARGS, - device: IPHONE_DEVICE, + device: "#{device_model} (#{os})", prelaunch_simulator: true, clean: true, buildlog_path: LOGS_FOLDER,