Skip to content

Commit e946996

Browse files
defined simulator to test with and removed debugging
1 parent 8d07129 commit e946996

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

.github/workflows/ios.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,28 @@ jobs:
2727
scheme: ${{ 'default' }}
2828
platform: ${{ 'iOS Simulator' }}
2929
run: |
30-
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
31-
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
30+
device_id=$(xcrun simctl list devices available | grep "iPhone 16" | head -1 | sed -E 's/.*\(([A-Z0-9-]+)\).*/\1/')
31+
if [ -z "$device_id" ]; then
32+
echo "No iPhone 16 simulator found, use another simulator"
33+
device_id=$(xcrun simctl list devices available | grep "iPhone" | head -1 | sed -E 's/.*\(([A-Z0-9-]+)\).*/\1/')
34+
fi
35+
echo "Use simulator with ID: $device_id"
3236
if [ $scheme = default ]; then scheme=$(cat default); fi
3337
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
3438
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
35-
xcodebuild build-for-testing -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device"
39+
xcodebuild build-for-testing -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=iOS Simulator,id=$device_id"
3640
- name: Test
3741
env:
3842
scheme: ${{ 'default' }}
3943
platform: ${{ 'iOS Simulator' }}
4044
run: |
41-
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
42-
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
45+
device_id=$(xcrun simctl list devices available | grep "iPhone 16" | head -1 | sed -E 's/.*\(([A-Z0-9-]+)\).*/\1/')
46+
if [ -z "$device_id" ]; then
47+
echo "No iPhone 16 simulator found, use another simulator"
48+
device_id=$(xcrun simctl list devices available | grep "iPhone" | head -1 | sed -E 's/.*\(([A-Z0-9-]+)\).*/\1/')
49+
fi
50+
echo "Use simulator with ID: $device_id"
4351
if [ $scheme = default ]; then scheme=$(cat default); fi
4452
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
4553
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
46-
xcodebuild test-without-building -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device"
47-
- name: Debug Info
48-
run: |
49-
xcodebuild -version
50-
xcrun simctl list devices available
51-
ls -la
54+
xcodebuild build-for-testing -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=iOS Simulator,id=$device_id"

0 commit comments

Comments
 (0)