Skip to content

Commit

Permalink
Update CI to Xcode 15.1 & run builds for iOS, watchOS, tvOS (#231)
Browse files Browse the repository at this point in the history
- 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 #227 and
related to #226.
  • Loading branch information
rebello95 authored Jan 9, 2024
1 parent ed50994 commit 2c9e0b9
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 31 deletions.
77 changes: 58 additions & 19 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,84 @@ on:
permissions:
contents: read
jobs:
build-connect-library:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
- name: Build Connect library
run: make buildpackage
build-eliza-cocoapods-example:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- name: Install xcbeautify
run: brew install xcbeautify
- name: Build Eliza CocoaPods example
run: |
cd Examples/ElizaCocoaPodsApp
pod install
xcodebuild -workspace ElizaCocoaPodsApp.xcworkspace -scheme ElizaCocoaPodsApp build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
set -o pipefail && xcodebuild -workspace ElizaCocoaPodsApp.xcworkspace -scheme ElizaCocoaPodsApp build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcbeautify
build-eliza-swiftpm-example:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- name: Install xcbeautify
run: brew install xcbeautify
- name: Build Eliza Swift PM example
run: |
cd Examples/ElizaSwiftPackageApp
xcodebuild -scheme ElizaSwiftPackageApp build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
set -o pipefail && xcodebuild -scheme ElizaSwiftPackageApp build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcbeautify
build-library-ios:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- name: Install xcbeautify
run: brew install xcbeautify
- name: Build Connect iOS library
run: set -o pipefail && xcodebuild -scheme Connect-Package -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' | xcbeautify
build-library-macos:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- name: Install xcbeautify
run: brew install xcbeautify
- name: Build Connect macOS library
run: set -o pipefail && xcodebuild -scheme Connect-Package -destination 'platform=macOS' | xcbeautify
build-library-tvos:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- name: Install xcbeautify
run: brew install xcbeautify
- name: Build Connect tvOS library
run: set -o pipefail && xcodebuild -scheme Connect-Package -destination 'platform=tvOS Simulator,name=Apple TV,OS=17.2' | xcbeautify
build-library-watchos:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- name: Install xcbeautify
run: brew install xcbeautify
- name: Build Connect watchOS library
run: set -o pipefail && xcodebuild -scheme Connect-Package -destination 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=10.2' | xcbeautify
build-plugin-and-generate:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}
Expand All @@ -63,8 +102,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- name: Set up docker (missing on macOS GitHub runners)
# https://github.com/actions/runner-images/issues/2150
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
# https://github.com/actions/runner-images/releases/tag/macos-13%2F20231218.2
run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ConnectMocks/MockBidirectionalStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import SwiftProtobuf
/// or by subclassing the type and overriding functions such as `send()`.
///
/// To return data over the stream, outputs can be specified using `init(outputs: ...)`.
@available(iOS 13.0, *)
@available(iOS 13, *)
open class MockBidirectionalStream<
Input: ProtobufMessage,
Output: ProtobufMessage
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ConnectMocks/MockClientOnlyStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import SwiftProtobuf
/// or by subclassing the type and overriding functions such as `send()`.
///
/// To return data over the stream, outputs can be specified using `init(outputs: ...)`.
@available(iOS 13.0, *)
@available(iOS 13, *)
open class MockClientOnlyStream<
Input: ProtobufMessage,
Output: ProtobufMessage
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ConnectMocks/MockServerOnlyStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import SwiftProtobuf
/// or by subclassing the type and overriding functions such as `send()`.
///
/// To return data over the stream, outputs can be specified using `init(outputs: ...)`.
@available(iOS 13.0, *)
@available(iOS 13, *)
open class MockServerOnlyStream<
Input: ProtobufMessage,
Output: ProtobufMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ final class CallbackConformanceTests: XCTestCase {
}

// Minimum requirements for runtime support for parameterized protocol types
@available(iOS 16, *)
@available(macOS 13, *)
@available(tvOS 16, *)
@available(watchOS 9, *)
@available(macOS 13, iOS 16, watchOS 9, tvOS 16, *)
func testPingPong() {
func createPayload(
requestSize: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
import SwiftProtobuf
import XCTest

@available(iOS 16, *)
@available(tvOS 16, *)
@available(watchOS 9, *)
@available(iOS 13, *)
final class InterceptorIntegrationTests: XCTestCase {
func testUnaryInterceptorSuccess() async {
let trackedSteps = Locked([InterceptorStep]())
Expand Down Expand Up @@ -112,6 +110,7 @@ final class InterceptorIntegrationTests: XCTestCase {
])
}

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

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

0 comments on commit 2c9e0b9

Please sign in to comment.