Skip to content

chore: add visionOS to build and unit test jobs #3900

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

Merged
merged 12 commits into from
Oct 21, 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
27 changes: 18 additions & 9 deletions .github/composite_actions/get_platform_parameters/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ runs:
run: |
INPUT_PLATFORM=${{ inputs.platform }}
case $INPUT_PLATFORM in
iOS|tvOS|watchOS|macOS) ;;
iOS|tvOS|watchOS|macOS|visionOS) ;;
*) echo "Unsupported platform: $INPUT_PLATFORM"; exit 1 ;;
esac
shell: bash

- id: get-xcode-version
run: |
LATEST_XCODE_VERSION=15.3.0
LATEST_XCODE_VERSION=16.0.0
MINIMUM_XCODE_VERSION=15.0.1

INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
Expand All @@ -66,35 +66,44 @@ runs:

case $INPUT_PLATFORM/$INPUT_XCODE_VERSION in
iOS/latest)
DEVICE="iPhone 15"
OS_VERSION="17.4"
DEVICE="iPhone 16"
OS_VERSION="18.0"
;;
iOS/*)
DEVICE="iPhone 14"
OS_VERSION="17.0.1"
;;
tvOS/latest)
DEVICE="Apple TV 4K (3rd generation)"
OS_VERSION="17.4"
OS_VERSION="18.0"
;;
tvOS/*)
DEVICE="Apple TV 4K (3rd generation)"
OS_VERSION="17.0"
;;
watchOS/latest)
DEVICE="Apple Watch Series 9 (45mm)"
OS_VERSION="10.4"
DEVICE="Apple Watch Series 10 (46mm)"
OS_VERSION="11.0"
;;
watchOS/*)
DEVICE="Apple Watch Series 8 (45mm)"
OS_VERSION="10.0"
;;
visionOS/latest)
DEVICE="Apple Vision Pro"
OS_VERSION="2.0"
;;
visionOS/*)
DEVICE="Apple Vision Pro"
OS_VERSION="1.0"
;;
esac

DESTINATION_MAPPING="{
\"iOS\": \"platform=iOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"tvOS\": \"platform=tvOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"watchOS\": \"platform=watchOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"visionOS\": \"platform=visionOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"macOS\": \"platform=macOS,arch=arm64\"
}"

Expand All @@ -119,8 +128,8 @@ runs:
"iOS": "iphonesimulator",
"tvOS": "appletvsimulator",
"watchOS": "watchsimulator",
"visionOS": "xrsimulator",
"macOS": "macosx"
}'
echo "sdk=$(echo $SDK_MAPPING | jq -r .$INPUT_PLATFORM)" >> $GITHUB_OUTPUT
shell: bash

shell: bash
9 changes: 8 additions & 1 deletion .github/workflows/build_amplify_swift_platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

push:
branches-ignore:
- main
Expand All @@ -46,12 +52,13 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [iOS, macOS, tvOS, watchOS]
platform: [iOS, macOS, tvOS, watchOS, visionOS]
exclude:
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'None' }}
- platform: ${{ github.event.inputs.macos == 'false' && 'macOS' || 'None' }}
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'None' }}
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'None' }}
- platform: ${{ github.event.inputs.visionos == 'false' && 'visionOS' || 'None' }}
uses: ./.github/workflows/build_scheme.yml
with:
scheme: Amplify-Package
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_scheme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

os-runner:
type: string
default: 'macos-latest'
default: 'macos-15'

save_build_cache:
type: boolean
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
inputs:
os-runner:
type: string
default: 'macos-latest'
default: 'macos-15'
scheme:
description: 'The scheme to run the tests'
required: true
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/run_unit_tests_platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
os-runner:
description: 'runs-on input'
type: string
default: 'macos-latest'
default: 'macos-15'

permissions:
contents: read
Expand All @@ -35,12 +35,13 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [iOS, macOS, tvOS, watchOS]
platform: [iOS, macOS, tvOS, watchOS, visionOS]
exclude:
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'None' }}
- platform: ${{ github.event.inputs.macos == 'false' && 'macOS' || 'None' }}
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'None' }}
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'None' }}
- platform: ${{ github.event.inputs.visionos == 'false' && 'visionOS' || 'None' }}
uses: ./.github/workflows/run_unit_tests.yml
with:
scheme: ${{ inputs.scheme }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

push:
branches-ignore:
- main
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/unit_test_amplify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/unit_test_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_datastore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/unit_test_geo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/unit_test_internal_pinpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_predictions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_push_notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ class AppSyncRealTimeRequestAuthTests: XCTestCase {
amzDate: date
)

XCTAssertEqual(toJson(iamAuth)?.shrink(), """
// Convert to JSON and then parse it back into a dictionary for comparison
let iamAuthJson = toJson(iamAuth)?.shrink()

let expectedJsonString = """
{
"accept": "application\\/json, text\\/javascript",
"Authorization": "\(token)",
Expand All @@ -63,7 +66,24 @@ class AppSyncRealTimeRequestAuthTests: XCTestCase {
"x-amz-date": "\(date)",
"X-Amz-Security-Token": "\(securityToken)"
}
""".shrink())
""".shrink()

// Convert both JSON strings to dictionaries for comparison
let iamAuthDict = convertToDictionary(text: iamAuthJson)
let expectedDict = convertToDictionary(text: expectedJsonString)

// Assert that the dictionaries are equal using the custom method
XCTAssertTrue(areDictionariesEqual(iamAuthDict, expectedDict))
}

private func convertToDictionary(text: String?) -> [String: Any]? {
guard let data = text?.data(using: .utf8) else { return nil }
return try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
}

private func areDictionariesEqual(_ lhs: [String: Any]?, _ rhs: [String: Any]?) -> Bool {
guard let lhs = lhs, let rhs = rhs else { return false }
return NSDictionary(dictionary: lhs).isEqual(to: rhs)
}

func testAppSyncRealTimeRequestAuth_encodeStartRequestWithCognitoAuth() {
Expand Down Expand Up @@ -124,8 +144,9 @@ class AppSyncRealTimeRequestAuthTests: XCTestCase {
let request = AppSyncRealTimeRequest.start(
.init(id: id, data: data, auth: .iam(iamAuth))
)
let requestJson = toJson(request)
XCTAssertEqual(requestJson?.shrink(), """
let requestJson = toJson(request)?.shrink()

let expectedJsonString = """
{
"id": "\(id)",
"payload": {
Expand All @@ -144,7 +165,14 @@ class AppSyncRealTimeRequestAuthTests: XCTestCase {
},
"type": "start"
}
""".shrink())
""".shrink()

// Convert both JSON strings to dictionaries for comparison
let requestDict = convertToDictionary(text: requestJson)
let expectedDict = convertToDictionary(text: expectedJsonString)

// Assert that the dictionaries are equal using the custom method
XCTAssertTrue(areDictionariesEqual(requestDict, expectedDict))
}

private func toJson(_ value: Encodable) -> String? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ class RESTRequestUtilsTests: XCTestCase {

func testConstructURLRequestFailsWithInvalidQueryParams() throws {
let baseURL = URL(string: "https://aws.amazon.com")!
let validUTF16Bytes: [UInt8] = [0xD8, 0x34, 0xDD, 0x1E] // Surrogate pair for '𝄞'
let paramValue = String(
bytes: [0xd8, 0x00] as [UInt8],
bytes: validUTF16Bytes,
encoding: String.Encoding.utf16BigEndian
)!
let invalidQueryParams: [String: String] = ["param": paramValue]
Expand Down
Loading