Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow library to build and run tests on visionOS, and add github action runner for visionOS #32

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 32 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
DEVELOPER_DIR: "/Applications/Xcode_15.2.app/Contents/Developer"

jobs:
build-mac:
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Update Tools
run: gem update cocoapods
- name: Print Versions
run: |
xcodebuild -version
swift --version
pod --version
- name: Build
run: swift build --build-tests
- name: Run tests
Expand All @@ -33,46 +43,61 @@ jobs:
run: carthage build --no-skip-current --verbose --use-xcframeworks --platform macOS

build-ios:
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Test
run: |
set -o pipefail && xcodebuild \
-scheme CombineCoreBluetooth \
-workspace ./CombineCoreBluetooth.xcworkspace/ \
-destination "platform=iOS Simulator,OS=latest,name=iPhone 14" \
-destination "platform=iOS Simulator,OS=latest,name=iPhone 15" \
-sdk iphonesimulator \
-enableCodeCoverage YES \
-disableAutomaticPackageResolution \
test | xcpretty -c

build-tvos:
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Test
run: |
set -o pipefail && xcodebuild \
-scheme CombineCoreBluetooth \
-workspace ./CombineCoreBluetooth.xcworkspace/ \
-destination "platform=tvOS Simulator,OS=16.1,name=Apple TV" \
-destination "platform=tvOS Simulator,OS=latest,name=Apple TV" \
-sdk appletvsimulator \
-enableCodeCoverage YES \
-disableAutomaticPackageResolution \
test | xcpretty -c

build-watchos:
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Test
run: |
set -o pipefail && xcodebuild \
-scheme CombineCoreBluetooth \
-workspace ./CombineCoreBluetooth.xcworkspace/ \
-destination "platform=watchOS Simulator,OS=9.1,name=Apple Watch Ultra (49mm)" \
-destination "platform=watchOS Simulator,OS=latest,name=Apple Watch Ultra (49mm)" \
-sdk watchsimulator \
-enableCodeCoverage YES \
-disableAutomaticPackageResolution \
test | xcpretty -c

build-visionos:
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Test
run: |
set -o pipefail && xcodebuild \
-scheme CombineCoreBluetooth \
-workspace ./CombineCoreBluetooth.xcworkspace/ \
-destination "platform=visionOS Simulator,OS=latest,name=Apple Vision Pro" \
-sdk xrsimulator \
-enableCodeCoverage YES \
-disableAutomaticPackageResolution \
test | xcpretty -c
3 changes: 2 additions & 1 deletion CombineCoreBluetooth.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'CombineCoreBluetooth'
spec.version = '0.7.1'
spec.version = '0.7.2'
spec.summary = 'A wrapper API for CoreBluetooth using Combine Publishers.'
spec.homepage = 'https://github.com/StarryInternet/CombineCoreBluetooth'
spec.author = { 'Kevin Lundberg' => '[email protected]' }
Expand All @@ -10,6 +10,7 @@ Pod::Spec.new do |spec|
spec.osx.deployment_target = '10.15'
spec.tvos.deployment_target = '13.0'
spec.watchos.deployment_target = '6.0'
spec.visionos.deployment_target = '1.0'

spec.swift_version = '5.6'
spec.source = { :git => 'https://github.com/StarryInternet/CombineCoreBluetooth.git', :tag => "#{spec.version}" }
Expand Down
30 changes: 29 additions & 1 deletion CombineCoreBluetooth.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
00371A0127EE588C00C2F766 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
00371A2227F02B1900C2F766 /* CentralView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CentralView.swift; sourceTree = "<group>"; };
00482BE728308A4D0053B7C1 /* PeripheralTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeripheralTests.swift; sourceTree = "<group>"; };
00752E8F2B6C9AEC00D02120 /* ci.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = ci.yml; sourceTree = "<group>"; };
00CF0B77288DD73700FD88E1 /* PeripheralError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeripheralError.swift; sourceTree = "<group>"; };
00D8C7422A69A6E20069EC00 /* PeripheralManagerError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeripheralManagerError.swift; sourceTree = "<group>"; };
EB443F8E27C6BCA70005CCEA /* CombineCoreBluetooth.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CombineCoreBluetooth.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -144,9 +145,26 @@
path = "Preview Content";
sourceTree = "<group>";
};
00752E8D2B6C9AEC00D02120 /* .github */ = {
isa = PBXGroup;
children = (
00752E8E2B6C9AEC00D02120 /* workflows */,
);
path = .github;
sourceTree = "<group>";
};
00752E8E2B6C9AEC00D02120 /* workflows */ = {
isa = PBXGroup;
children = (
00752E8F2B6C9AEC00D02120 /* ci.yml */,
);
path = workflows;
sourceTree = "<group>";
};
EB443F8427C6BCA70005CCEA = {
isa = PBXGroup;
children = (
00752E8D2B6C9AEC00D02120 /* .github */,
EB443F9827C6BDE00005CCEA /* Sources */,
EB443FE327C6C1B40005CCEA /* Tests */,
003719F927EE588900C2F766 /* CentralPeripheralDemo */,
Expand Down Expand Up @@ -361,7 +379,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1330;
LastUpgradeCheck = 1500;
LastUpgradeCheck = 1520;
TargetAttributes = {
003719F727EE588900C2F766 = {
CreatedOnToolsVersion = 13.3;
Expand Down Expand Up @@ -563,6 +581,7 @@
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
Expand Down Expand Up @@ -636,6 +655,7 @@
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
Expand Down Expand Up @@ -726,6 +746,8 @@
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
Expand Down Expand Up @@ -759,6 +781,8 @@
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
Expand All @@ -774,6 +798,8 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.starry.CombineCoreBluetooth-iOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
};
Expand All @@ -789,6 +815,8 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.starry.CombineCoreBluetooth-iOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1520"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import Foundation
extension PeripheralManager {
public static func live(_ options: ManagerCreationOptions? = nil) -> Self {
let delegate: Delegate = options?.restoreIdentifier != nil ? RestorableDelegate() : Delegate()
#if os(tvOS) || os(watchOS)
let peripheralManager = CBPeripheralManager()
peripheralManager.delegate = delegate
#else
#if os(macOS) || os(iOS)
let peripheralManager = CBPeripheralManager(
delegate: delegate,
queue: DispatchQueue(label: "combine-core-bluetooth.peripheral-manager", target: .global()),
options: options?.peripheralManagerDictionary
)
#else
let peripheralManager = CBPeripheralManager()
peripheralManager.delegate = delegate
#endif

return Self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import XCTest
@testable import CombineCoreBluetooth
import ConcurrencyExtras

#if !os(watchOS) && !os(tvOS)
#if os(macOS) || os(iOS)
final class PeripheralManagerTests: XCTestCase {
var cancellables: Set<AnyCancellable>!

Expand Down
2 changes: 1 addition & 1 deletion Tests/CombineCoreBluetoothTests/PeripheralTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import XCTest
import ConcurrencyExtras

#if !os(watchOS) && !os(tvOS)
#if os(macOS) || os(iOS)
class PeripheralTests: XCTestCase {

override func setUpWithError() throws {
Expand Down
Loading