Skip to content

Commit

Permalink
Update Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
PSchmiedmayer committed Jun 28, 2024
1 parent d90150b commit 1e60a78
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 36 deletions.
74 changes: 38 additions & 36 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,50 +57,52 @@ jobs:
# resultBundle: TemplatePackage-macOS.xcresult
# destination: 'platform=macOS,arch=arm64'
# artifactname: TemplatePackage-macOS.xcresult
# ios:
# name: Build and Test iOS
# uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
# with:
# path: 'Tests/UITests'
# scheme: TestApp
# resultBundle: TestApp-iOS.xcresult
# artifactname: TestApp-iOS.xcresult
# ipados:
# name: Build and Test iPadOS
# uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
# with:
# path: 'Tests/UITests'
# scheme: TestApp
# destination: 'platform=iOS Simulator,name=iPad Air (5th generation)'
# resultBundle: TestApp-iPadOS.xcresult
# artifactname: TestApp-iPadOS.xcresult
ios:
name: Build and Test iOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
path: 'Tests/UITests'
scheme: TestApp
resultBundle: TestApp-iOS.xcresult
artifactname: TestApp-iOS.xcresult
ipados:
name: Build and Test iPadOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
path: 'Tests/UITests'
scheme: TestApp
destination: 'platform=iOS Simulator,name=iPad Air (5th generation)'
resultBundle: TestApp-iPadOS.xcresult
artifactname: TestApp-iPadOS.xcresult
watchos:
name: Build and Test watchOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestAppWatchApp
destination: 'id=3C5F6AF7-5AB7-4FA4-9684-305E2533D6EA'
destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)'
resultBundle: TestApp-watchOS.xcresult
artifactname: TestApp-watchOS.xcresult
# visionos:
# name: Build and Test visionOS
# uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
# with:
# path: 'Tests/UITests'
# scheme: TestApp
# destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
# resultBundle: TestApp-visionOS.xcresult
# artifactname: TestApp-visionOS.xcresult
# tvos:
# name: Build and Test tvOS
# uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
# with:
# path: 'Tests/UITests'
# scheme: TestApp
# destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
# resultBundle: TestApp-tvOS.xcresult
# artifactname: TestApp-tvOS.xcresult
visionos:
name: Build and Test visionOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
resultBundle: TestApp-visionOS.xcresult
artifactname: TestApp-visionOS.xcresult
tvos:
name: Build and Test tvOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
path: 'Tests/UITests'
scheme: TestApp
destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
resultBundle: TestApp-tvOS.xcresult
artifactname: TestApp-tvOS.xcresult
# codeql:
# name: CodeQL
# uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
Expand Down
20 changes: 20 additions & 0 deletions Tests/UITests/TestApp/OperatingSystem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// This source file is part of the TemplatePackage open-source project
//
// SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//


#if os(macOS)
let operatingSystem = "macOS"
#elseif os(iOS)
let operatingSystem = "iOS"
#elseif os(watchOS)
let operatingSystem = "watchOS"
#elseif os(visionOS)
let operatingSystem = "visionOS"
#elseif os(tvOS)
let operatingSystem = "tvOS"
#endif
1 change: 1 addition & 0 deletions Tests/UITests/TestApp/TestApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct UITestsApp: App {
var body: some Scene {
WindowGroup {
Text(TemplatePackage().stanford)
Text(operatingSystem)
}
}
}
14 changes: 14 additions & 0 deletions Tests/UITests/TestAppUITests/TestAppUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,19 @@ class TestAppUITests: XCTestCase {
let app = XCUIApplication()
app.launch()
XCTAssert(app.staticTexts["Stanford University"].waitForExistence(timeout: 0.1))

if app.staticTexts["macOS"].exists {
print("Template Package is running on macOS.")
} else if app.staticTexts["iOS"].exists {
print("Template Package is running on iOS.")
} else if app.staticTexts["watchOS"].exists {
print("Template Package is running on watchOS.")
} else if app.staticTexts["visionOS"].exists {
print("Template Package is running on visionOS.")
} else if app.staticTexts["tvOS"].exists {
print("Template Package is running on tvOS.")
} else {
XCTFail("Running on an unexpected operating system.")
}
}
}
6 changes: 6 additions & 0 deletions Tests/UITests/UITests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
2F9CBEDA2A76C795009818FF /* TemplatePackage in Frameworks */ = {isa = PBXBuildFile; productRef = 2F9CBED92A76C795009818FF /* TemplatePackage */; };
2F9CBEDB2A76C7EC009818FF /* TestAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F8A431229130A8C005D2B8F /* TestAppUITests.swift */; };
2FA7382C290ADFAA007ACEB9 /* TestApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FA7382B290ADFAA007ACEB9 /* TestApp.swift */; };
2FB5B6E02C2F6C50009162E6 /* OperatingSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */; };
2FB5B6E12C2F6DBC009162E6 /* OperatingSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -73,6 +75,7 @@
2F9CBEBF2A76C412009818FF /* TestAppWatchAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestAppWatchAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2FA7382B290ADFAA007ACEB9 /* TestApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestApp.swift; sourceTree = "<group>"; };
2FB0758A299DDB9000C0B37F /* TestApp.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestApp.xctestplan; sourceTree = "<group>"; };
2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperatingSystem.swift; sourceTree = "<group>"; };
2FF8922E2A770D4200903A5A /* TestAppWatchApp.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestAppWatchApp.xctestplan; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -138,6 +141,7 @@
isa = PBXGroup;
children = (
2FA7382B290ADFAA007ACEB9 /* TestApp.swift */,
2FB5B6DF2C2F6C50009162E6 /* OperatingSystem.swift */,
2F6D139928F5F386007C25D6 /* Assets.xcassets */,
);
path = TestApp;
Expand Down Expand Up @@ -326,6 +330,7 @@
buildActionMask = 2147483647;
files = (
2FA7382C290ADFAA007ACEB9 /* TestApp.swift in Sources */,
2FB5B6E02C2F6C50009162E6 /* OperatingSystem.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -341,6 +346,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2FB5B6E12C2F6DBC009162E6 /* OperatingSystem.swift in Sources */,
2F9CBED72A76C752009818FF /* TestApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down

0 comments on commit 1e60a78

Please sign in to comment.