Skip to content

Commit 58dade6

Browse files
[FSSDK-11964] chore: update GitHub Actions to macOS 15 runner with Xcode 16 (#615)
* Updated to macos 15 * update simulator version * docs: update workflow and script configuration * clean up
1 parent db736bd commit 58dade6

File tree

4 files changed

+63
-28
lines changed

4 files changed

+63
-28
lines changed

.github/workflows/source_clear_cron.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ on:
99

1010
jobs:
1111
source_clear:
12-
runs-on: macos-13
12+
runs-on: macos-15
1313
steps:
1414
- uses: actions/checkout@v3
1515
- name: Source clear scan
1616
env:
1717
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
1818
run: |
19-
gem install cocoapods -v '1.9.3'
19+
gem install cocoapods -v '1.15.2'
2020
curl -sSL https://download.sourceclear.com/ci.sh | bash -s - scan

.github/workflows/swift.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jobs:
3131
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
3232

3333
lint:
34-
runs-on: macos-13
34+
runs-on: macos-15
3535
steps:
3636
- uses: actions/checkout@v3
3737
- uses: maxim-lobanov/setup-xcode@v1
3838
with:
39-
xcode-version: 14.1.0
39+
xcode-version: 16.1.0
4040
- env:
4141
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
4242
run: |
@@ -48,13 +48,13 @@ jobs:
4848
if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}"
4949
uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@master
5050
prepare_for_release:
51-
runs-on: macos-13
51+
runs-on: macos-15
5252
if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}"
5353
steps:
5454
- uses: actions/checkout@v3
5555
- uses: maxim-lobanov/setup-xcode@v1
5656
with:
57-
xcode-version: 14.1.0
57+
xcode-version: 16.1.0
5858
- name: Install Hub by Homebrew
5959
run: |
6060
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@@ -77,12 +77,12 @@ jobs:
7777

7878
release:
7979
if: "${{github.event.inputs.RELEASE == 'true' && github.event_name == 'workflow_dispatch' }}"
80-
runs-on: macos-13
80+
runs-on: macos-15
8181
steps:
8282
- uses: actions/checkout@v3
8383
- uses: maxim-lobanov/setup-xcode@v1
8484
with:
85-
xcode-version: 14.1.0
85+
xcode-version: 16.1.0
8686
- name: Install Hub by Homebrew
8787
run: |
8888
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

.github/workflows/unit_tests.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ env:
77

88
jobs:
99
unittests:
10-
runs-on: macos-13
10+
runs-on: macos-15
1111
strategy:
1212
fail-fast: false
1313
matrix:
@@ -16,43 +16,42 @@ jobs:
1616
# - each xcode version has own simulator os versions.
1717
# - so to run tests with the target simulator, we have to find a proper xcode version pre-installed and support the target simulator os version.
1818
# also, the xcode version (simulator_xcode_version) and simulator os versions (os) are moving target. We have to change these time to time.
19-
# - see "https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md" for installed macOS, xcode and simulator versions.
19+
# - see "https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md" for installed macOS, xcode and simulator versions.
2020
include:
21-
- os: 16.1
22-
device: "iPhone 14"
21+
- os: 18.4
22+
device: "iPhone 16"
2323
scheme: "OptimizelySwiftSDK-iOS"
2424
test_sdk: "iphonesimulator"
2525
platform: "iOS Simulator"
2626
os_type: "iOS"
27-
simulator_xcode_version: 14.1
28-
- os: 16.2
29-
device: "iPhone 14"
27+
simulator_xcode_version: 16.3
28+
- os: 18.5
29+
device: "iPhone 16 Plus"
3030
scheme: "OptimizelySwiftSDK-iOS"
3131
test_sdk: "iphonesimulator"
3232
platform: "iOS Simulator"
3333
os_type: "iOS"
34-
simulator_xcode_version: 14.2
35-
- os: 16.4
36-
# good to have tests with older OS versions, but it looks like this is min OS+xcode versions supported by github actions
37-
device: "iPad Air (5th generation)"
34+
simulator_xcode_version: 16.4
35+
- os: 18.6
36+
device: "iPad Air 11-inch (M2)"
3837
scheme: "OptimizelySwiftSDK-iOS"
3938
test_sdk: "iphonesimulator"
4039
platform: "iOS Simulator"
4140
os_type: "iOS"
42-
simulator_xcode_version: 14.3.1
43-
- os: 16.1
41+
simulator_xcode_version: 16.4
42+
- os: 18.5
4443
device: "Apple TV"
4544
scheme: "OptimizelySwiftSDK-tvOS"
4645
test_sdk: "appletvsimulator"
4746
platform: "tvOS Simulator"
4847
os_type: "tvOS"
49-
simulator_xcode_version: 14.1
48+
simulator_xcode_version: 16.4
5049
steps:
5150
- uses: actions/checkout@v3
5251
- uses: maxim-lobanov/setup-xcode@v1
5352
with:
5453
# macos version and supported simulator_xcode_versions are all related to this xcode_version, so be careful when you upgrade this.
55-
xcode-version: 14.1
54+
xcode-version: 16.4
5655
- name: set SDK Branch if PR
5756
env:
5857
BASE_REF: ${{ github.base_ref }}
@@ -98,11 +97,11 @@ jobs:
9897
with:
9998
name: build-logs-${{ matrix.device }}-${{ matrix.os }}
10099
path: build/Logs
101-
- # - report coverage for PR and iPhone 11 only (avoid redundant ones)
102-
# - use Xcode12.4+ (older Xcode reports a wrong number)
100+
- # - report coverage for PR and iPhone 16 only (avoid redundant ones)
101+
# - use Xcode16+ (older Xcode reports a wrong number)
103102
name: Check on success
104103
id: coveralls
105-
if: ${{ steps.unit_tests.outcome == 'success' && env.BRANCH == 'master' && env.PLATFORM == 'iOS Simulator' && env.NAME == 'iPhone 11' }}
104+
if: ${{ steps.unit_tests.outcome == 'success' && env.BRANCH == 'master' && env.PLATFORM == 'iOS Simulator' && env.NAME == 'iPhone 16' }}
106105
env:
107106
PLATFORM: ${{ matrix.platform }}
108107
NAME: ${{ matrix.device }}

Scripts/prepare_simulator.sh

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,44 @@ if [ "$MAJOR_SIMULATOR_XCODE_VERSION" -lt 12 ]; then
4141
xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os"
4242
CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')"
4343
else
44-
echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file
45-
CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' )
44+
# For Xcode 16+, try multiple runtime key formats
45+
# The runtime key format has changed over Xcode versions
46+
RUNTIME_KEY1="com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}"
47+
RUNTIME_KEY2="${PLATFORM/ Simulator/}-${OS/./-}"
48+
49+
# echo "Attempting to find simulator: $NAME with OS: $OS"
50+
# echo "Runtime key 1: $RUNTIME_KEY1"
51+
# echo "Runtime key 2: $RUNTIME_KEY2"
52+
53+
# List all available devices for debugging
54+
# echo "Available device runtimes:"
55+
# xcrun simctl list --json devices | jq -r '.devices | keys[]'
56+
57+
# Try format 1: com.apple.CoreSimulator.SimRuntime.iOS-XX-X
58+
echo ".devices.\"$RUNTIME_KEY1\"" > /tmp/jq_file
59+
CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file 2>/dev/null | jq -r '.[]? | select(.name==env.NAME) | .udid' || echo "" )
60+
61+
# If not found, try format 2: iOS-XX-X
62+
if [ -z "$CUSTOM_SIMULATOR" ]; then
63+
echo "Trying alternative runtime key format..."
64+
echo ".devices.\"$RUNTIME_KEY2\"" > /tmp/jq_file
65+
CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file 2>/dev/null | jq -r '.[]? | select(.name==env.NAME) | .udid' || echo "" )
66+
fi
67+
68+
# If still not found, search all runtimes
69+
if [ -z "$CUSTOM_SIMULATOR" ]; then
70+
echo "Searching all runtimes for device: $NAME"
71+
CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -r --arg os "$OS" --arg name "$NAME" '.devices | to_entries[] | select(.key | contains($os)) | .value[] | select(.name==$name) | .udid' | head -n 1 )
72+
fi
73+
74+
if [ -z "$CUSTOM_SIMULATOR" ]; then
75+
echo "ERROR: Could not find simulator '$NAME' with OS version $OS"
76+
echo "Available devices:"
77+
xcrun simctl list devices available
78+
exit 1
79+
fi
80+
81+
echo "Found simulator: $CUSTOM_SIMULATOR"
4682
fi
4783
xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30
4884
xcrun simctl list | grep Booted

0 commit comments

Comments
 (0)