Skip to content

Commit

Permalink
Add VisionOS and macOS support (#18)
Browse files Browse the repository at this point in the history
# Add VisionOS and macOS support

## ♻️ Current situation & Problem
Currently, SpeziStorage only supports iOS platforms, leading to issues
with depending on packages that use the package and want to support a
broad variety of packages.


## ⚙️ Release Notes 
- Add VisionOS and macOS support


## 📚 Documentation
--


## ✅ Testing
CI steps to ensure building & launching on the respective platforms.


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
philippzagar authored Mar 1, 2024
1 parent eaed222 commit 7d1c8ff
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 20 deletions.
120 changes: 110 additions & 10 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# This source file is part of the Stanford Spezi open-source project
# This source file is part of the Stanford Spezi open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
# SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#
Expand All @@ -16,24 +16,124 @@ on:
workflow_dispatch:

jobs:
buildandtest:
name: Build and Test Swift Package
buildandtest_ios:
name: Build and Test Swift Package iOS
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
strategy:
matrix:
include:
- buildConfig: Debug
artifactname: SpeziStorage-Package-iOS.xcresult
resultBundle: SpeziStorage-Package-iOS.xcresult
- buildConfig: Release
artifactname: SpeziStorage-Package-iOS-Release.xcresult
resultBundle: SpeziStorage-Package-iOS-Release.xcresult
with:
artifactname: SpeziStorage-Package.xcresult
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziStorage-Package
buildandtestuitests:
name: Build and Test UI Tests
buildConfig: ${{ matrix.buildConfig }}
resultBundle: ${{ matrix.resultBundle }}
artifactname: ${{ matrix.artifactname }}
buildandtest_visionos:
name: Build and Test Swift Package visionOS
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
strategy:
matrix:
include:
- buildConfig: Debug
artifactname: SpeziStorage-Package-visionOS.xcresult
resultBundle: SpeziStorage-Package-visionOS.xcresult
- buildConfig: Release
artifactname: SpeziStorage-Package-visionOS-Release.xcresult
resultBundle: SpeziStorage-Package-visionOS-Release.xcresult
with:
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziStorage-Package
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
buildConfig: ${{ matrix.buildConfig }}
resultBundle: ${{ matrix.resultBundle }}
artifactname: ${{ matrix.artifactname }}
buildandtest_macos:
name: Build and Test Swift Package macOS
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
strategy:
matrix:
include:
- buildConfig: Debug
artifactname: SpeziStorage-Package-macOS.xcresult
resultBundle: SpeziStorage-Package-macOS.xcresult
- buildConfig: Release
artifactname: SpeziStorage-Package-macOS-Release.xcresult
resultBundle: SpeziStorage-Package-macOS-Release.xcresult
with:
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziStorage-Package
destination: 'platform=macOS,arch=arm64'
buildConfig: ${{ matrix.buildConfig }}
resultBundle: ${{ matrix.resultBundle }}
artifactname: ${{ matrix.artifactname }}
buildandtestuitests_ios:
name: Build and Test UI Tests iOS
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
strategy:
matrix:
include:
- buildConfig: Debug
resultBundle: TestApp-iOS.xcresult
artifactname: TestApp-iOS.xcresult
- buildConfig: Release
resultBundle: TestApp-iOS-Release.xcresult
artifactname: TestApp-iOS-Release.xcresult
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
buildConfig: ${{ matrix.buildConfig }}
resultBundle: ${{ matrix.resultBundle }}
artifactname: ${{ matrix.artifactname }}
buildandtestuitests_ipad:
name: Build and Test UI Tests iPadOS
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
strategy:
matrix:
include:
- buildConfig: Debug
resultBundle: TestApp-iPad.xcresult
artifactname: TestApp-iPad.xcresult
- buildConfig: Release
resultBundle: TestApp-iPad-Release.xcresult
artifactname: TestApp-iPad-Release.xcresult
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
destination: 'platform=iOS Simulator,name=iPad Air (5th generation)'
buildConfig: ${{ matrix.buildConfig }}
resultBundle: ${{ matrix.resultBundle }}
artifactname: ${{ matrix.artifactname }}
buildandtestuitests_visionos:
name: Build and Test UI Tests visionOS
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
strategy:
matrix:
include:
- buildConfig: Debug
resultBundle: TestApp-visionOS.xcresult
artifactname: TestApp-visionOS.xcresult
- buildConfig: Release
resultBundle: TestApp-visionOS-Release.xcresult
artifactname: TestApp-visionOS-Release.xcresult
with:
artifactname: TestApp.xcresult
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
buildConfig: ${{ matrix.buildConfig }}
resultBundle: ${{ matrix.resultBundle }}
artifactname: ${{ matrix.artifactname }}
uploadcoveragereport:
name: Upload Coverage Report
needs: [buildandtest, buildandtestuitests]
needs: [buildandtest_ios, buildandtest_visionos, buildandtest_macos, buildandtestuitests_ios, buildandtestuitests_ipad, buildandtestuitests_visionos]
uses: StanfordSpezi/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
with:
coveragereports: SpeziStorage-Package.xcresult TestApp.xcresult
coveragereports: 'SpeziStorage-Package-iOS.xcresult SpeziStorage-Package-visionOS.xcresult SpeziStorage-Package-macOS.xcresult TestApp-iOS.xcresult TestApp-iPad.xcresult TestApp-visionOS.xcresult'
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ SpeziStorage contributors
* [Paul Schmiedmayer](https://github.com/PSchmiedmayer)
* [Vishnu Ravi](https://github.com/vishnuravi)
* [Andreas Bauer](https://github.com/Supereg)
* [Philipp Zagar]https://github.com/philippzagar)
8 changes: 5 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ import PackageDescription
let package = Package(
name: "SpeziStorage",
platforms: [
.iOS(.v17)
.iOS(.v17),
.visionOS(.v1),
.macOS(.v14)
],
products: [
.library(name: "SpeziLocalStorage", targets: ["SpeziLocalStorage"]),
.library(name: "SpeziSecureStorage", targets: ["SpeziSecureStorage"])
],
dependencies: [
.package(url: "https://github.com/StanfordSpezi/Spezi", from: "1.0.0"),
.package(url: "https://github.com/StanfordBDHG/XCTRuntimeAssertions", from: "1.0.0")
.package(url: "https://github.com/StanfordSpezi/Spezi", from: "1.2.1"),
.package(url: "https://github.com/StanfordBDHG/XCTRuntimeAssertions", from: "1.0.1")
],
targets: [
.target(
Expand Down
5 changes: 5 additions & 0 deletions Tests/SpeziLocalStorageTests/LocalStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ final class LocalStorageTests: XCTestCase {


func testLocalStorage() async throws {
#if !os(macOS)
let spezi = await LocalStorageTestsAppDelegate().spezi
#else
let spezi = LocalStorageTestsAppDelegate().spezi
#endif

let localStorage = try XCTUnwrap(spezi.storage[LocalStorage.self])

let letter = Letter(greeting: "Hello Paul 👋\(String(repeating: "🚀", count: Int.random(in: 0...10)))")
Expand Down
3 changes: 2 additions & 1 deletion Tests/UITests/TestApp/TestApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
// SPDX-License-Identifier: MIT
//

import Spezi
import SwiftUI
import XCTestApp

@main
struct UITestsApp: App {
@UIApplicationDelegateAdaptor(TestAppDelegate.self) var appDelegate
@ApplicationDelegateAdaptor(TestAppDelegate.self) var appDelegate


var body: some Scene {
Expand Down
24 changes: 18 additions & 6 deletions Tests/UITests/UITests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,12 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.storage.testapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Debug;
};
Expand Down Expand Up @@ -469,10 +471,12 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.storage.testapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Release;
};
Expand All @@ -489,10 +493,12 @@
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.storage.testappuitests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_TARGET_NAME = TestApp;
};
name = Debug;
Expand All @@ -510,9 +516,11 @@
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.storage.testappuitests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_TARGET_NAME = TestApp;
};
name = Release;
Expand Down Expand Up @@ -601,10 +609,12 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.storage.testapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Test;
};
Expand All @@ -621,10 +631,12 @@
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.storage.testappuitests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_TARGET_NAME = TestApp;
};
name = Test;
Expand Down

0 comments on commit 7d1c8ff

Please sign in to comment.