Skip to content

Commit 2c9e0b9

Browse files
authored
Update CI to Xcode 15.1 & run builds for iOS, watchOS, tvOS (connectrpc#231)
- Adds new CI jobs to build the library against macOS, iOS, tvOS, and watchOS rather than only the default environment (macOS) - Updates `@available` annotations to properly accommodate these additional platforms - Updates CI to use Xcode 15.1 Originally the intent was to run tests on each platform, but for some reason GitHub runners are refusing to cooperate and jobs are stalling. Instead, we'll continue running `swift test` which runs tests on the host environment (macOS) and will use `xcodebuild` to build for each platform since it allows for specifying a target SDK/environment (see [this question](https://stackoverflow.com/questions/60245159/how-can-i-build-a-swift-package-for-ios-over-command-line) and [these notes](https://www.jessesquires.com/blog/2021/11/03/swift-package-ios-tests/)). Follow-up to connectrpc#227 and related to connectrpc#226.
1 parent ed50994 commit 2c9e0b9

File tree

7 files changed

+67
-31
lines changed

7 files changed

+67
-31
lines changed

.github/workflows/ci.yaml

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,84 @@ on:
88
permissions:
99
contents: read
1010
jobs:
11-
build-connect-library:
12-
runs-on: macos-13
13-
steps:
14-
- uses: actions/checkout@v4
15-
- name: Select Xcode version
16-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
17-
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
18-
- name: Build Connect library
19-
run: make buildpackage
2011
build-eliza-cocoapods-example:
2112
runs-on: macos-13
2213
steps:
2314
- uses: actions/checkout@v4
2415
- name: Select Xcode version
25-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
26-
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
16+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
17+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
18+
- name: Install xcbeautify
19+
run: brew install xcbeautify
2720
- name: Build Eliza CocoaPods example
2821
run: |
2922
cd Examples/ElizaCocoaPodsApp
3023
pod install
31-
xcodebuild -workspace ElizaCocoaPodsApp.xcworkspace -scheme ElizaCocoaPodsApp build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
24+
set -o pipefail && xcodebuild -workspace ElizaCocoaPodsApp.xcworkspace -scheme ElizaCocoaPodsApp build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcbeautify
3225
build-eliza-swiftpm-example:
3326
runs-on: macos-13
3427
steps:
3528
- uses: actions/checkout@v4
3629
- name: Select Xcode version
37-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
38-
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
30+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
31+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
32+
- name: Install xcbeautify
33+
run: brew install xcbeautify
3934
- name: Build Eliza Swift PM example
4035
run: |
4136
cd Examples/ElizaSwiftPackageApp
42-
xcodebuild -scheme ElizaSwiftPackageApp build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
37+
set -o pipefail && xcodebuild -scheme ElizaSwiftPackageApp build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcbeautify
38+
build-library-ios:
39+
runs-on: macos-13
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Select Xcode version
43+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
44+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
45+
- name: Install xcbeautify
46+
run: brew install xcbeautify
47+
- name: Build Connect iOS library
48+
run: set -o pipefail && xcodebuild -scheme Connect-Package -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' | xcbeautify
49+
build-library-macos:
50+
runs-on: macos-13
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Select Xcode version
54+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
55+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
56+
- name: Install xcbeautify
57+
run: brew install xcbeautify
58+
- name: Build Connect macOS library
59+
run: set -o pipefail && xcodebuild -scheme Connect-Package -destination 'platform=macOS' | xcbeautify
60+
build-library-tvos:
61+
runs-on: macos-13
62+
steps:
63+
- uses: actions/checkout@v4
64+
- name: Select Xcode version
65+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
66+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
67+
- name: Install xcbeautify
68+
run: brew install xcbeautify
69+
- name: Build Connect tvOS library
70+
run: set -o pipefail && xcodebuild -scheme Connect-Package -destination 'platform=tvOS Simulator,name=Apple TV,OS=17.2' | xcbeautify
71+
build-library-watchos:
72+
runs-on: macos-13
73+
steps:
74+
- uses: actions/checkout@v4
75+
- name: Select Xcode version
76+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
77+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
78+
- name: Install xcbeautify
79+
run: brew install xcbeautify
80+
- name: Build Connect watchOS library
81+
run: set -o pipefail && xcodebuild -scheme Connect-Package -destination 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=10.2' | xcbeautify
4382
build-plugin-and-generate:
4483
runs-on: macos-13
4584
steps:
4685
- uses: actions/checkout@v4
4786
- name: Select Xcode version
48-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
49-
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
87+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
88+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
5089
- uses: bufbuild/buf-setup-action@v1.28.1
5190
with:
5291
github_token: ${{ github.token }}
@@ -63,8 +102,8 @@ jobs:
63102
steps:
64103
- uses: actions/checkout@v4
65104
- name: Select Xcode version
66-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
67-
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
105+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
106+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
68107
- name: Set up docker (missing on macOS GitHub runners)
69108
# https://github.com/actions/runner-images/issues/2150
70109
run: |

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: Select Xcode version
15-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
16-
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
15+
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
16+
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
1717
- uses: bufbuild/buf-setup-action@v1.28.1
1818
with:
1919
github_token: ${{ github.token }}

Libraries/ConnectMocks/MockBidirectionalStream.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import SwiftProtobuf
2323
/// or by subclassing the type and overriding functions such as `send()`.
2424
///
2525
/// To return data over the stream, outputs can be specified using `init(outputs: ...)`.
26-
@available(iOS 13.0, *)
26+
@available(iOS 13, *)
2727
open class MockBidirectionalStream<
2828
Input: ProtobufMessage,
2929
Output: ProtobufMessage

Libraries/ConnectMocks/MockClientOnlyStream.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import SwiftProtobuf
2222
/// or by subclassing the type and overriding functions such as `send()`.
2323
///
2424
/// To return data over the stream, outputs can be specified using `init(outputs: ...)`.
25-
@available(iOS 13.0, *)
25+
@available(iOS 13, *)
2626
open class MockClientOnlyStream<
2727
Input: ProtobufMessage,
2828
Output: ProtobufMessage

Libraries/ConnectMocks/MockServerOnlyStream.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import SwiftProtobuf
2323
/// or by subclassing the type and overriding functions such as `send()`.
2424
///
2525
/// To return data over the stream, outputs can be specified using `init(outputs: ...)`.
26-
@available(iOS 13.0, *)
26+
@available(iOS 13, *)
2727
open class MockServerOnlyStream<
2828
Input: ProtobufMessage,
2929
Output: ProtobufMessage

Tests/ConnectLibraryTests/ConnectConformance/CallbackConformanceTests.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,7 @@ final class CallbackConformanceTests: XCTestCase {
180180
}
181181

182182
// Minimum requirements for runtime support for parameterized protocol types
183-
@available(iOS 16, *)
184-
@available(macOS 13, *)
185-
@available(tvOS 16, *)
186-
@available(watchOS 9, *)
183+
@available(macOS 13, iOS 16, watchOS 9, tvOS 16, *)
187184
func testPingPong() {
188185
func createPayload(
189186
requestSize: Int,

Tests/ConnectLibraryTests/ConnectTests/InterceptorIntegrationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
import SwiftProtobuf
1717
import XCTest
1818

19-
@available(iOS 16, *)
20-
@available(tvOS 16, *)
21-
@available(watchOS 9, *)
19+
@available(iOS 13, *)
2220
final class InterceptorIntegrationTests: XCTestCase {
2321
func testUnaryInterceptorSuccess() async {
2422
let trackedSteps = Locked([InterceptorStep]())
@@ -112,6 +110,7 @@ final class InterceptorIntegrationTests: XCTestCase {
112110
])
113111
}
114112

113+
@available(macOS 13, iOS 16, watchOS 9, tvOS 16, *) // Required for .contains()
115114
func testUnaryInterceptorIsCalledWithMetrics() async {
116115
let trackedSteps = Locked([InterceptorStep]())
117116
let client = self.createClient(interceptors: [
@@ -139,6 +138,7 @@ final class InterceptorIntegrationTests: XCTestCase {
139138
))
140139
}
141140

141+
@available(macOS 13, iOS 16, watchOS 9, tvOS 16, *) // Required for .contains()
142142
func testStreamInterceptorIsCalledWithMetrics() async throws {
143143
let trackedSteps = Locked([InterceptorStep]())
144144
let client = self.createClient(interceptors: [

0 commit comments

Comments
 (0)