From 9d98008cf0d406a5b19e8a8430c49ccf105269b8 Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 15:11:59 -0400 Subject: [PATCH 01/11] Update ios.yml with new device and OS version --- .github/workflows/ios.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 0449bfa..64d3a8a 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -18,8 +18,8 @@ jobs: env: scheme: ${{ 'SDKHostApp' }} platform: ${{ 'iOS Simulator' }} - os: ${{ '16.2' }} - device: ${{ 'iPhone 13' }} + os: ${{ '18.1' }} + device: ${{ 'iPhone 16' }} run: | # xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) if [ $scheme = default ]; then scheme=$(cat default); fi From 642988fe5b91fd7b78d4e4bf94e8cecf7c2a1388 Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 15:24:26 -0400 Subject: [PATCH 02/11] using latest flag instead of specific iOS version --- .github/workflows/ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 64d3a8a..13af858 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -18,7 +18,7 @@ jobs: env: scheme: ${{ 'SDKHostApp' }} platform: ${{ 'iOS Simulator' }} - os: ${{ '18.1' }} + os: ${{ latest }} device: ${{ 'iPhone 16' }} run: | # xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) From 658b0b639aee7544eb0e1fbb0332ec45c37c0edf Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 15:43:11 -0400 Subject: [PATCH 03/11] Updated iOS.yml that uses latest OS / device version --- .github/workflows/ios.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 13af858..22fe09b 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -17,12 +17,33 @@ jobs: - name: Build and Test env: scheme: ${{ 'SDKHostApp' }} - platform: ${{ 'iOS Simulator' }} - os: ${{ latest }} - device: ${{ 'iPhone 16' }} run: | # xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) + if [ $scheme = default ]; then scheme=$(cat default); fi + + # Determine file to build: .xcworkspace or .xcodeproj if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi + + # Clean up whitespace file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` - xcodebuild test -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,OS=$os,name=$device" + + # Find latest available iOS runtime identifier + latest_runtime_id=$(xcrun simctl list runtimes | grep -E "iOS [0-9]+\.[0-9]*" | grep -v unavailable | sort -Vr | head -n 1 | sed -E 's/.*- (.*)$/\1/') + + # Find a compatible simulator device name for that runtime + device_name=$(xcrun simctl list devices available | grep "$latest_runtime_id" | head -n 1 | sed -E 's/^ (.+) \(.+\) \(.+\)$/\1/') + + if [ -z "$latest_runtime_id" ] || [ -z "$device_name" ]; then + echo "❌ Failed to find a valid iOS runtime or device." + exit 1 + fi + + echo "🛠 Using runtime: $latest_runtime_id" + echo "📱 Using device: $device_name" + + # Build and run the tests + xcodebuild test \ + -scheme "$scheme" \ + -"$filetype_parameter" "$file_to_build" \ + -destination "platform=iOS Simulator,OS=$latest_runtime_id,name=$device_name" From 06daa8537f43de33faf472467112267280948d01 Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 16:05:25 -0400 Subject: [PATCH 04/11] using first device instead of getting latest runtime + device --- .github/workflows/ios.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 22fe09b..ea2da6a 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -28,22 +28,18 @@ jobs: # Clean up whitespace file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` - # Find latest available iOS runtime identifier - latest_runtime_id=$(xcrun simctl list runtimes | grep -E "iOS [0-9]+\.[0-9]*" | grep -v unavailable | sort -Vr | head -n 1 | sed -E 's/.*- (.*)$/\1/') + # Find first available simulator + device_name=$(xcrun simctl list devices available | grep "iPhone" | head -n 1 | sed -E 's/^[[:space:]]*(.+) \(.+\) \(.+\)$/\1/') - # Find a compatible simulator device name for that runtime - device_name=$(xcrun simctl list devices available | grep "$latest_runtime_id" | head -n 1 | sed -E 's/^ (.+) \(.+\) \(.+\)$/\1/') - - if [ -z "$latest_runtime_id" ] || [ -z "$device_name" ]; then - echo "❌ Failed to find a valid iOS runtime or device." + if [ -z "$device_name" ]; then + echo "❌ Failed to find a valid iOS device." exit 1 fi - echo "🛠 Using runtime: $latest_runtime_id" echo "📱 Using device: $device_name" # Build and run the tests xcodebuild test \ -scheme "$scheme" \ -"$filetype_parameter" "$file_to_build" \ - -destination "platform=iOS Simulator,OS=$latest_runtime_id,name=$device_name" + -destination "platform=iOS Simulator,name=$device_name" From d709049a5b6de3348f9382a0facda515ff1d089b Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 16:11:42 -0400 Subject: [PATCH 05/11] trying this... --- .github/workflows/ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index ea2da6a..2de3452 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -40,6 +40,6 @@ jobs: # Build and run the tests xcodebuild test \ + -sdk iphonesimulator -scheme "$scheme" \ -"$filetype_parameter" "$file_to_build" \ - -destination "platform=iOS Simulator,name=$device_name" From aa3dcf1aab187339c83d65534f56fd03dc6a47cd Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 16:12:52 -0400 Subject: [PATCH 06/11] typo --- .github/workflows/ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 2de3452..9518219 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -40,6 +40,6 @@ jobs: # Build and run the tests xcodebuild test \ - -sdk iphonesimulator + -sdk iphonesimulator \ -scheme "$scheme" \ -"$filetype_parameter" "$file_to_build" \ From 8852749191965a472df9f04c22db09ad33ddccde Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 16:19:39 -0400 Subject: [PATCH 07/11] undoing last change --- .github/workflows/ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 9518219..fde9c6d 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -40,6 +40,6 @@ jobs: # Build and run the tests xcodebuild test \ - -sdk iphonesimulator \ -scheme "$scheme" \ -"$filetype_parameter" "$file_to_build" \ + -destination "platform=iOS Simulator,name=$device_name,OS=latest" From a850d7540a2db2c15ceddbf17fecc7bb4b7688d5 Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 16:21:46 -0400 Subject: [PATCH 08/11] remove OS --- .github/workflows/ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index fde9c6d..ea2da6a 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -42,4 +42,4 @@ jobs: xcodebuild test \ -scheme "$scheme" \ -"$filetype_parameter" "$file_to_build" \ - -destination "platform=iOS Simulator,name=$device_name,OS=latest" + -destination "platform=iOS Simulator,name=$device_name" From dcb94e42a6c9845c2eb9359e96e452f63fb54968 Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 16:27:43 -0400 Subject: [PATCH 09/11] hard-coding device name --- .github/workflows/ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index ea2da6a..98281ea 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -42,4 +42,4 @@ jobs: xcodebuild test \ -scheme "$scheme" \ -"$filetype_parameter" "$file_to_build" \ - -destination "platform=iOS Simulator,name=$device_name" + -destination "platform=iOS Simulator,name=iPhone 15 Pro" From 943c738926b2f3465c985ab481348919e7366894 Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 16:34:16 -0400 Subject: [PATCH 10/11] escaped regex --- .github/workflows/ios.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 98281ea..e9d1132 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -29,7 +29,7 @@ jobs: file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` # Find first available simulator - device_name=$(xcrun simctl list devices available | grep "iPhone" | head -n 1 | sed -E 's/^[[:space:]]*(.+) \(.+\) \(.+\)$/\1/') + device_name=$(xcrun simctl list devices available | grep "iPhone" | head -n 1 | sed -E 's/^[[:space:]]*(.+) \\(.+\\) \\(.+\\)$/\1/') if [ -z "$device_name" ]; then echo "❌ Failed to find a valid iOS device." @@ -42,4 +42,4 @@ jobs: xcodebuild test \ -scheme "$scheme" \ -"$filetype_parameter" "$file_to_build" \ - -destination "platform=iOS Simulator,name=iPhone 15 Pro" + -destination "platform=iOS Simulator,name=$device_name" From 5b5ae78ac988778bfc3779e651c69652c76d8593 Mon Sep 17 00:00:00 2001 From: Alexia Nunez Date: Wed, 2 Apr 2025 16:38:01 -0400 Subject: [PATCH 11/11] another regex --- .github/workflows/ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index e9d1132..8b02b81 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -29,7 +29,7 @@ jobs: file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` # Find first available simulator - device_name=$(xcrun simctl list devices available | grep "iPhone" | head -n 1 | sed -E 's/^[[:space:]]*(.+) \\(.+\\) \\(.+\\)$/\1/') + device_name=$(xcrun simctl list devices available | grep "iPhone" | head -n 1 | sed -E 's/^[[:space:]]*([^()]+)[[:space:]]*\(.*$/\1/' | awk '{$1=$1; print}') if [ -z "$device_name" ]; then echo "❌ Failed to find a valid iOS device."