Skip to content

Commit 2fc1ea5

Browse files
authored
Test UI test on Cirrus Labs (#6576)
* Add cirrus lab tests * Update name * Test new parameters * Fix open simulator * Change OS versions * Set device for tvOS * Add device * Bump xcode version * Print failed job * Add missing install platforms to iOS17 * Update UI tests for Cirrus Runners to run only on commits to main * Use a single ui tests file * Use macos 15 * Modify matrixes * Use macos-15 and fix fastlane command * Define specific xcode version for cirrus labs * Disable fail fast * Bump iOS version used * Use iOS 18.6 * Cleanup comments * Skip cirrus labs if the job is not a commit on main
1 parent 86eb6d5 commit 2fc1ea5

File tree

5 files changed

+107
-32
lines changed

5 files changed

+107
-32
lines changed

.github/file-filters.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ run_ui_tests_for_prs: &run_ui_tests_for_prs
434434

435435
# GH Actions
436436
- ".github/workflows/ui-tests.yml"
437+
- ".github/workflows/ui-tests-cirrus-labs.yml"
437438
- ".github/workflows/ui-tests-common.yml"
438439
- ".github/workflows/build-xcframework-variant-slices.yml"
439440
- ".github/workflows/assemble-xcframework-variant.yml"

.github/workflows/ui-tests-common.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ on:
2424
macos_version:
2525
description: "macOS version"
2626
required: true
27+
default: macos-26
2728
type: string
2829
needs_xcframework:
2930
description: "Whether the workflow needs to download the XCFramework."
@@ -60,14 +61,25 @@ on:
6061
required: false
6162
default: ""
6263
type: string
64+
run_on_cirrus_labs:
65+
description: "Whether to run the tests on Cirrus Labs"
66+
required: false
67+
default: false
68+
type: boolean
69+
should_skip:
70+
description: "Whether to skip the job"
71+
required: false
72+
default: false
73+
type: boolean
6374
secrets:
6475
CODECOV_TOKEN:
6576
required: true
6677

6778
jobs:
6879
common-ui-tests:
80+
if: ${{ !inputs.should_skip }}
6981
name: UI Tests Common
70-
runs-on: ${{ inputs.macos_version }}
82+
runs-on: ${{ inputs.run_on_cirrus_labs && fromJSON(format('["ghcr.io/cirruslabs/macos-runner:{0}", "runner_group_id:10"]', inputs.macos_version)) || inputs.macos_version }}
7183
timeout-minutes: 40
7284
steps:
7385
- uses: actions/checkout@v5

.github/workflows/ui-tests.yml

Lines changed: 86 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,106 +36,165 @@ jobs:
3636
ui-tests:
3737
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_for_prs == 'true'
3838
needs: files-changed
39-
name: Test ${{matrix.name}} V3 # Up the version with every change to keep track of flaky tests
39+
name: Test ${{matrix.name}} on ${{matrix.runner}} V3 # Up the version with every change to keep track of flaky tests
4040
uses: ./.github/workflows/ui-tests-common.yml
4141
strategy:
42+
fail-fast: false
4243
matrix:
44+
runner:
45+
- GitHub
46+
- Cirrus Labs
47+
job_id:
48+
- ios_objc
49+
- tvos_swift
4350
include:
44-
- name: iOS Objective-C
51+
- job_id: ios_objc
52+
name: iOS Objective-C
4553
target: ios_objc
46-
- name: tvOS Swift
54+
test_destination_os: "18.6"
55+
device: iPhone 16 Pro
56+
- job_id: tvos_swift
57+
name: tvOS Swift
4758
target: tvos_swift
59+
test_destination_os: "18.5"
60+
device: "Apple TV"
4861
with:
4962
fastlane_command: ui_tests_${{matrix.target}}
50-
xcode_version: 16.2
63+
xcode_version: 16.4
5164
build_with_make: true
52-
macos_version: macos-14
65+
macos_version: ${{ matrix.runner == 'Cirrus Labs' && 'sequoia' || 'macos-15' }}
66+
run_on_cirrus_labs: ${{ matrix.runner == 'Cirrus Labs' }}
5367
codecov_test_analytics: true
68+
test-destination-os: ${{matrix.test_destination_os}}
69+
device: ${{matrix.device}}
70+
files_suffix: _${{matrix.target}}_${{matrix.runner}}
71+
# Github doesn't allow using matrix variables in if conditions, so we pass it to the common workflow and skip there.
72+
# This lets us skip the job if it's a push to the main branch and the runner is Cirrus Labs.
73+
should_skip: ${{ ( github.event_name != 'push' || github.ref != 'refs/heads/main' ) && matrix.runner == 'Cirrus Labs' }}
5474
secrets:
5575
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5676

57-
# SwiftUI only supports iOS 14+ so we run it in a separate matrix here
5877
ui-tests-swift-ui:
5978
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_for_prs == 'true'
6079
needs: files-changed
61-
name: Test SwiftUI V4 # Up the version with every change to keep track of flaky tests
80+
name: Test SwiftUI on ${{matrix.runner}} V4 # Up the version with every change to keep track of flaky tests
6281
uses: ./.github/workflows/ui-tests-common.yml
6382
with:
6483
fastlane_command: ui_tests_ios_swiftui
6584
build_with_make: true
6685
codecov_test_analytics: true
6786
xcode_version: 16.4
68-
macos_version: macos-15
69-
test-destination-os: "18.4"
87+
macos_version: ${{ matrix.runner == 'Cirrus Labs' && 'sequoia' || 'macos-15' }}
88+
run_on_cirrus_labs: ${{ matrix.runner == 'Cirrus Labs' }}
89+
test-destination-os: "18.6"
7090
device: iPhone 16 Pro
91+
files_suffix: _swiftui_-${{matrix.runner}}
92+
# Github doesn't allow using matrix variables in if conditions, so we pass it to the common workflow and skip there.
93+
# This lets us skip the job if it's a push to the main branch and the runner is Cirrus Labs.
94+
should_skip: ${{ ( github.event_name != 'push' || github.ref != 'refs/heads/main' ) && matrix.runner == 'Cirrus Labs' }}
7195
secrets:
7296
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
73-
97+
strategy:
98+
fail-fast: false
99+
matrix:
100+
runner:
101+
- GitHub
102+
- Cirrus Labs
74103
ui-tests-swift:
75104
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_for_prs == 'true'
76105
needs: files-changed
77-
name: Test Swift ${{matrix.name}} V5 # Up the version with every change to keep track of flaky tests
106+
name: Test Swift ${{matrix.name}} on ${{matrix.runner}} V5 # Up the version with every change to keep track of flaky tests
78107
uses: ./.github/workflows/ui-tests-common.yml
79108
strategy:
80109
fail-fast: false
81110
matrix:
111+
runner:
112+
- GitHub
113+
- Cirrus Labs
114+
job_id:
115+
- ios_17
116+
- ios_18
117+
- ios_26
82118
include:
83-
# iOS 17 - Use pre-installed iOS 17.5 runtime on macOS-14 with Xcode 15.4
84-
- name: iOS 17
85-
runs-on: macos-14
119+
# iOS 17 - Use iOS 17.5 runtime on macOS-15 with Xcode 16.4
120+
- job_id: ios_17
121+
name: iOS 17
122+
runs_on: macos-14
123+
runs_on_cirrus: sequoia
86124
xcode: "15.4"
87-
test-destination-os: "17.5"
125+
xcode_cirrus: "16.4"
126+
test_destination_os: "17.5"
88127
platform: "iOS"
128+
install_platforms: false
89129
create_device: true
90130
device: iPhone 15 Pro
91131

92132
# iOS 18 - Use pre-installed iOS 18.4 runtime on macOS-15
93-
- name: iOS 18
94-
runs-on: macos-15
133+
- job_id: ios_18
134+
name: iOS 18
135+
runs_on: macos-15
136+
runs_on_cirrus: sequoia
95137
xcode: "16.4"
96-
test-destination-os: "18.4"
138+
test_destination_os: "18.4"
97139
platform: "iOS"
98140
device: iPhone 16 Pro
99141
install_platforms: false
100142
create_device: false
101143

102144
# iOS 26 - Download iOS 26.1 beta runtime on macOS-26
103-
- name: iOS 26
104-
runs-on: macos-26
145+
- job_id: ios_26
146+
name: iOS 26
147+
runs_on: macos-26
148+
runs_on_cirrus: tahoe
105149
xcode: "26.1"
106-
test-destination-os: "26.1"
150+
test_destination_os: "26.1"
107151
install_platforms: true
108152
platform: "iOS"
109153
create_device: true
110154
device: iPhone 17 Pro
111155
with:
112156
fastlane_command: ui_tests_ios_swift
113-
files_suffix: _xcode_${{matrix.xcode}}-${{matrix.device}}
157+
files_suffix: _xcode_${{matrix.xcode}}-${{matrix.device}}-${{matrix.runner}}
114158
build_with_make: true
115-
macos_version: ${{matrix.runs-on}}
159+
macos_version: ${{matrix.runner == 'Cirrus Labs' && matrix.runs_on_cirrus || matrix.runs_on}}
160+
run_on_cirrus_labs: ${{ matrix.runner == 'Cirrus Labs' }}
116161
codecov_test_analytics: true
117-
xcode_version: ${{matrix.xcode}}
118-
test-destination-os: ${{matrix.test-destination-os}}
162+
xcode_version: ${{ matrix.runner == 'Cirrus Labs' && matrix.xcode_cirrus || matrix.xcode}}
163+
test-destination-os: ${{matrix.test_destination_os}}
119164
install_platforms: ${{matrix.install_platforms}}
120165
platform: ${{matrix.platform}}
121166
create_device: ${{matrix.create_device}}
122167
device: ${{matrix.device}}
168+
# Github doesn't allow using matrix variables in if conditions, so we pass it to the common workflow and skip there.
169+
# This lets us skip the job if it's a push to the main branch and the runner is Cirrus Labs.
170+
should_skip: ${{ ( github.event_name != 'push' || github.ref != 'refs/heads/main' ) && matrix.runner == 'Cirrus Labs' }}
123171
secrets:
124172
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
125173

126174
ui-tests-swift6:
127175
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_for_prs == 'true'
128176
needs: files-changed
129-
name: Test iOS Swift6 V3 # Up the version with every change to keep track of flaky tests
177+
name: Test iOS Swift6 on ${{matrix.runner}} V3 # Up the version with every change to keep track of flaky tests
130178
uses: ./.github/workflows/ui-tests-common.yml
179+
strategy:
180+
fail-fast: false
181+
matrix:
182+
runner:
183+
- GitHub
184+
- Cirrus Labs
131185
with:
132186
fastlane_command: ui_tests_ios_swift6
133187
xcode_version: 16.4
134188
build_with_make: true
135-
macos_version: macos-15
189+
macos_version: ${{matrix.runner == 'Cirrus Labs' && 'sequoia' || 'macos-15'}}
190+
run_on_cirrus_labs: ${{matrix.runner == 'Cirrus Labs'}}
136191
codecov_test_analytics: true
137192
device: iPhone 16 Pro
138193
test-destination-os: "18.4"
194+
files_suffix: _swift6_-${{matrix.runner}}
195+
# Github doesn't allow using matrix variables in if conditions, so we pass it to the common workflow and skip there.
196+
# This lets us skip the job if it's a push to the main branch and the runner is Cirrus Labs.
197+
should_skip: ${{ ( github.event_name != 'push' || github.ref != 'refs/heads/main' ) && matrix.runner == 'Cirrus Labs' }}
139198
secrets:
140199
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
141200

fastlane/Fastfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,10 @@ platform :ios do
271271
)
272272
end
273273

274-
lane :ui_tests_ios_objc do
274+
lane :ui_tests_ios_objc do |options|
275275
run_ui_tests(
276276
scheme: "iOS-ObjectiveC",
277+
device: options[:device],
277278
result_bundle_name: "ui_tests_ios_objc"
278279
)
279280
end
@@ -287,9 +288,10 @@ platform :ios do
287288
)
288289
end
289290

290-
lane :ui_tests_tvos_swift do
291+
lane :ui_tests_tvos_swift do |options|
291292
run_ui_tests(
292293
scheme: "tvOS-Swift",
294+
device: options[:device],
293295
result_bundle_name: "ui_tests_tvos_swift"
294296
)
295297
end

scripts/ci-boot-simulator.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,9 @@ for attempt in $(seq 1 $MAX_BOOT_ATTEMPTS); do
174174
# Open Simulator app UI (only on first attempt)
175175
if [ "$attempt" -eq 1 ]; then
176176
log_notice "Opening Simulator app UI"
177-
if ! open -a Simulator; then
178-
log_error "Failed to open Simulator app"
177+
SIMULATOR_APP_PATH="$(xcode-select -p)/Applications/Simulator.app"
178+
if ! open "$SIMULATOR_APP_PATH"; then
179+
log_error "Failed to open Simulator app at $SIMULATOR_APP_PATH"
179180
exit 1
180181
fi
181182
log_notice "Simulator app opened successfully"

0 commit comments

Comments
 (0)