Skip to content

Commit 96ca550

Browse files
committed
Refactors
1 parent 7b4e647 commit 96ca550

4 files changed

Lines changed: 47 additions & 11 deletions

File tree

action.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,15 @@ runs:
3434
# Workaround for Xcode/GitHub runner issues finding simulators.
3535
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
3636
- name: Refresh Simulators
37-
run: Refresh Simulators |
38-
echo "Refreshing simulators...\n"
39-
LIST=$(xcrun simctl list)
37+
run: $GITHUB_ACTION_PATH/scripts/refresh.sh
4038
shell: bash
4139
if: inputs.refresh == 'true'
40+
env:
41+
GITHUB_ACTION_PATH: ${{ github.action_path }}
4242

4343
- name: Parse Inputs
4444
id: parse-inputs
45-
run: Parse Inputs |
46-
"$GITHUB_ACTION_PATH/scripts/parse-inputs.sh"
45+
run: $GITHUB_ACTION_PATH/scripts/parse-inputs.sh
4746
shell: bash
4847
env:
4948
GITHUB_ACTION_PATH: ${{ github.action_path }}
@@ -62,19 +61,16 @@ runs:
6261
# Workaround for Xcode/GitHub runner issues finding simulators.
6362
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
6463
- name: Download Simulator for Platform
65-
run: Download Simulator for Platform |
66-
echo "Downloading simulator if needed...\n"
67-
LOG=$(xcodebuild -downloadPlatform "$SIMPLATFORM")
64+
run: $GITHUB_ACTION_PATH/scripts/download.sh
6865
shell: bash
6966
if: inputs.download == 'true'
7067
env:
68+
GITHUB_ACTION_PATH: ${{ github.action_path }}
7169
SIMPLATFORM: ${{ steps.parse-inputs.outputs.parsed-platform }}
7270

7371
- name: Find Simulator ID
7472
id: id-finder
75-
run: Find Simulator ID |
76-
echo "Finding matching device simulator..."
77-
"$GITHUB_ACTION_PATH/scripts/id.sh"
73+
run: $GITHUB_ACTION_PATH/scripts/id.sh
7874
shell: bash
7975
env:
8076
GITHUB_ACTION_PATH: ${{ github.action_path }}

scripts/download.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
# Workaround for Xcode/GitHub runner issues finding simulators.
4+
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
5+
6+
# Inputs:
7+
# - SIMPLATFORM required
8+
9+
# Step outputs produced:
10+
# (none)
11+
12+
echo "Downloading simulator if needed..."
13+
echo ""
14+
15+
# Capture output so it doesn't spam the console. In future this can optionally be printed to the console.
16+
LOG=$(xcodebuild -downloadPlatform "$SIMPLATFORM")
17+
18+
echo "Done downloading simulator."
19+
echo ""

scripts/id.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
# Note that validation of variables is skipped in this script, as validation already occurred
2424
# in the action step that runs parse-inputs.sh.
2525

26+
echo "Finding matching device simulator..."
27+
2628
# Get full list of all available device simulators installed in the system that are applicable for the given Xcode scheme.
2729
XCODE_OUTPUT=$(xcodebuild -showdestinations -workspace "$WORKSPACEPATH" -scheme "$SCHEME")
2830
XCODE_OUTPUT_REGEX="m/\{\splatform:(.*\sSimulator),.*id:([A-F0-9\-]{36}),.*OS:(\d{1,2}\.\d),.*name:([a-zA-Z0-9\(\)\s]*)\s\}/g"

scripts/refresh.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
# Workaround for Xcode/GitHub runner issues finding simulators.
4+
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
5+
6+
# Inputs:
7+
# (none)
8+
9+
# Step outputs produced:
10+
# (none)
11+
12+
echo "Refreshing simulators..."
13+
echo ""
14+
15+
# Capture output so it doesn't spam the console. In future this can optionally be printed to the console.
16+
LIST=$(xcrun simctl list)
17+
18+
echo "Done refreshing simulators."
19+
echo ""

0 commit comments

Comments
 (0)