Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ec040d9
Revert swift-tools-version support to 5.9
andrewdmontgomery Oct 16, 2024
7c3bdac
Use a build matrix to validate on multiple versions of Xcode
andrewdmontgomery Oct 16, 2024
daefb44
Specify the correct IMAGE_ID
andrewdmontgomery Oct 16, 2024
c5f84a6
Try including a separate `[email protected]`
andrewdmontgomery Oct 16, 2024
7d0a0e3
Update "Build and Test" label to include matrix build name
andrewdmontgomery Oct 16, 2024
4aeaf93
Revert "pins" version from 3 to 2 in Package.resolved
andrewdmontgomery Oct 16, 2024
a280108
Revert "Try including a separate `[email protected]`"
andrewdmontgomery Oct 16, 2024
4260fb5
Refactor testing to support passing the device to the test
andrewdmontgomery Oct 16, 2024
6d0dbe6
Fix matrix setup, references
andrewdmontgomery Oct 16, 2024
495b8c1
Use env variables instead of passing parameters
andrewdmontgomery Oct 16, 2024
7877527
Attempt fix for Swift 5.9 build error
andrewdmontgomery Oct 16, 2024
0f95d01
Add support for validating podspecs for Swift 5.9 and Swift 5.10
andrewdmontgomery Oct 16, 2024
05025f3
Group matrix builds
andrewdmontgomery Oct 17, 2024
c51d45a
Pass the device as an argument instead of using ENV
andrewdmontgomery Oct 17, 2024
9132be5
TRY: remove `matrix.setup` and specify all configs with `matrix.adjus…
andrewdmontgomery Oct 17, 2024
5f8e661
TRY: adding `matrix.setup` with empty values
andrewdmontgomery Oct 17, 2024
a4acef4
TRY: setting null values in `matrix.setup`
andrewdmontgomery Oct 17, 2024
e34d6e0
TRY: setting values to empty strings
andrewdmontgomery Oct 17, 2024
b2c7460
Revert "TRY: setting values to empty strings"
andrewdmontgomery Oct 17, 2024
a90ec77
Revert "TRY: setting null values in `matrix.setup`"
andrewdmontgomery Oct 17, 2024
c7d7437
Revert "TRY: adding `matrix.setup` with empty values"
andrewdmontgomery Oct 17, 2024
fdd0a52
Revert "TRY: remove `matrix.setup` and specify all configs with `matr…
andrewdmontgomery Oct 17, 2024
c094892
Clean up the `matrix.setup` instances, include clarifying comments
andrewdmontgomery Oct 17, 2024
5c7946c
TRY: setting a blank `matrix.setup` set to null
andrewdmontgomery Oct 17, 2024
d6eba0c
TRY: setting a blank `matrix.setup` by setting to `{}`
andrewdmontgomery Oct 17, 2024
612b281
Revert "TRY: setting a blank `matrix.setup` by setting to `{}`"
andrewdmontgomery Oct 17, 2024
6b75175
Revert "TRY: setting a blank `matrix.setup` set to null"
andrewdmontgomery Oct 17, 2024
f14bc5b
Refactor fastlane `test` to use defaults where possible
andrewdmontgomery Oct 17, 2024
070180d
Remove unused properties in matrix for pod validation
andrewdmontgomery Oct 17, 2024
fb4efe8
Fix logic for generating the `device` string
andrewdmontgomery Oct 17, 2024
98b21fa
Add support for testing Xcode 16.0
andrewdmontgomery Oct 17, 2024
541a4c4
Fix Xcode 16 string
andrewdmontgomery Oct 17, 2024
3388ffe
Use Xcode 15.2 instead of 15.1 for the Swift 5.9 checks
andrewdmontgomery Oct 18, 2024
15fbebf
Add swift version to matrix builds, use in label
andrewdmontgomery Oct 18, 2024
b00cc5d
Move source of truth for Xcode version to `shared-pipeline-vars`
andrewdmontgomery Oct 18, 2024
4482a62
Extract Swift versions into `shared-pipeline-vars`
andrewdmontgomery Oct 18, 2024
abb0aec
Use '_' instead of '.' for strings that appear in step labels
andrewdmontgomery Oct 18, 2024
815446a
Refactor matrix into steps
andrewdmontgomery Oct 18, 2024
4d0c4b0
Refactor validate podspecs from matrix to steps
andrewdmontgomery Oct 18, 2024
6d384d6
Remove keys from pod validation with previous versions of Swift
andrewdmontgomery Oct 18, 2024
0b32a3f
Build demos in all versions of Swift
andrewdmontgomery Oct 18, 2024
5fead37
Use YAML anchors to de-duplicate demo builds
andrewdmontgomery Oct 19, 2024
226e741
Revert change to `build_demo` lane
andrewdmontgomery Oct 19, 2024
bf7f4cf
Use YAML anchors to de-duplicate podspec validations
andrewdmontgomery Oct 19, 2024
79a6d4a
Add comments
andrewdmontgomery Oct 21, 2024
acc23cf
Rename key "test" to "test_swift_current"
andrewdmontgomery Oct 21, 2024
5ab2a8f
Reorganize
andrewdmontgomery Oct 21, 2024
85ef52c
Add "Swift" to CI step labels for clarity
andrewdmontgomery Dec 18, 2024
2e80fb1
Merge branch 'trunk' into andrewdmontgomery/introduce-swift-version-t…
andrewdmontgomery Dec 19, 2024
d19d028
Rubocop: fix Fastfile
andrewdmontgomery Dec 19, 2024
1671bd1
Updated supported versions of Swift
andrewdmontgomery Dec 19, 2024
85f2274
Reorganize pipeline
andrewdmontgomery Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 63 additions & 20 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@
agents:
queue: "mac"
env:
IMAGE_ID: $IMAGE_ID
IMAGE_ID: $SWIFT_6_0_IMAGE_ID

##################
# Reusabled Blocks
##################
validate_pods: &validate_pods
command: |
.buildkite/commands/validate-pods.sh
plugins: [$CI_TOOLKIT]

demo_build: &demo_build
plugins: [$CI_TOOLKIT]
command: |
install_gems
BUILD_NUMBER=$BUILDKITE_BUILD_NUMBER make build-demo-for-distribution

steps:
#################
Expand All @@ -31,20 +45,39 @@ 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 $SWIFT_6_0_VERSION)"
command: |
validate_swift_package test device_model:"$SWIFT_6_0_DEVICE" os:"$SWIFT_6_0_OS"
key: "test_swift_current"
env:
IMAGE_ID: "$SWIFT_6_0_IMAGE_ID"
plugins: [$CI_TOOLKIT]

- label: "📦 Build and Test Swift Package (Swift $SWIFT_5_10_VERSION)"
command: |
validate_swift_package test device_model:"$SWIFT_5_10_DEVICE" os:"$SWIFT_5_10_OS"
key: "test_swift_5_10"
env:
IMAGE_ID: "$SWIFT_5_10_IMAGE_ID"
plugins: [$CI_TOOLKIT]

###################
# Validate Podspec
###################
- label: "🔬 Validate Podspecs"
key: "validate"
command: |
.buildkite/commands/validate-pods.sh
plugins: [$CI_TOOLKIT]
- group: "🔬 Validate Podspecs"
steps:
- <<: *validate_pods
label: "🔬 Validate Podspecs (Swift $SWIFT_6_0_VERSION)"
key: "validate"
env:
IMAGE_ID: "$SWIFT_6_0_IMAGE_ID"

- <<: *validate_pods
label: "🔬 Validate Podspecs (Swift $SWIFT_5_10_VERSION)"
env:
IMAGE_ID: "$SWIFT_5_10_IMAGE_ID"

#######################
# Publish the Podspecs (if we're building a tag)
Expand All @@ -56,24 +89,24 @@ steps:
.buildkite/commands/publish-pod.sh "GravatarUI.podspec"
plugins: [$CI_TOOLKIT]
depends_on:
- "test"
- "test_swift_current"
- "validate"
- "lint"
if: build.tag != null

###################
# Prototype Builds of Demo Projects
###################
- group: ":appcenter: Prototype Builds"
- group: "🛠️ Build SwiftUI Demo"
steps:
- label: "🛠️ Build Demo"
###################
# Build/Upload Demo
###################
- <<: *demo_build
label: "🛠️ Build Demo (Swift $SWIFT_6_0_VERSION)"
key: build_demo
depends_on: test
plugins: [$CI_TOOLKIT]
command: |
install_gems
BUILD_NUMBER=$BUILDKITE_BUILD_NUMBER make build-demo-for-distribution
artifact_paths:
depends_on: test_swift_current
artifact_paths: # Archive artifacts only for the production version of Swift
- ".build/artifacts/*.ipa"
- ".build/artifacts/*.dSYM.zip"

Expand All @@ -82,3 +115,13 @@ steps:
plugins: [$CI_TOOLKIT]
command: .buildkite/commands/upload-to-appcenter.sh
if: build.pull_request.id != null

###################
# Build Demo Distribution for older supported versions of Swift
###################
- <<: *demo_build
label: "🛠️ Build Demo (Swift $SWIFT_5_10_VERSION)"
key: build_swift_5_10
depends_on: test_swift_5_10
env:
IMAGE_ID: "$SWIFT_5_10_IMAGE_ID"
15 changes: 13 additions & 2 deletions .buildkite/shared-pipeline-vars
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
# 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="xcode-16.2-macos-14.7.1-v1"

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.2-macos-14.7.1-v1"
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.2"

# 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" # Use the default value in Fastlane
export SWIFT_5_10_OS="17.5"
2 changes: 1 addition & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions Sources/GravatarUI/Base/AssociatedObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import Foundation

func getAssociatedObject<T>(_ 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
}
}

Expand Down
10 changes: 7 additions & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
default_platform(:ios)

OS = '18.2'
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')
Expand Down Expand Up @@ -49,12 +50,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,
Expand Down