From 2e66e5921fe08af63ac81ea8645d0420d767f8d5 Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Sun, 30 Oct 2022 23:57:40 -0700 Subject: [PATCH] Programaticly select iOS simulator Runtime/Device Signed-off-by: Joe Richey --- .github/workflows/tests.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 63767e6..bd3cf08 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -94,9 +94,15 @@ jobs: wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin cargo dinghy --version - name: Setup Simulator + # Use the first installed iOS runtime and the first (i.e. oldest) supported iPhone device. run: | - RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1) - SIM_ID=$(xcrun simctl create My-iphone7 com.apple.CoreSimulator.SimDeviceType.iPhone-7 $RUNTIME_ID) + RUNTIME=$(xcrun simctl list runtimes --json | jq '.runtimes | map(select(.name | contains("iOS"))) | .[0]') + RUNTIME_ID=$(echo $RUNTIME | jq -r '.identifier') + echo "Using runtime:" $RUNTIME_ID + DEVICE_ID=$(echo $RUNTIME | jq -r '.supportedDeviceTypes | map(select(.productFamily == "iPhone")) | .[0].identifier') + echo "Using device:" $DEVICE_ID + SIM_ID=$(xcrun simctl create Test-iPhone $DEVICE_ID $RUNTIME_ID) + echo "Created simulator:" $SIM_ID xcrun simctl boot $SIM_ID echo "device=$SIM_ID" >> $GITHUB_ENV - uses: Swatinem/rust-cache@v2