-
-
Notifications
You must be signed in to change notification settings - Fork 410
221 lines (199 loc) · 8.1 KB
/
Copy pathui-tests-common.yml
File metadata and controls
221 lines (199 loc) · 8.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: UI Tests Common
on:
workflow_call:
inputs:
fastlane_command:
description: "The fastlane command to run"
required: true
type: string
files_suffix:
description: "Suffix for the files to upload"
required: false
default: ""
type: string
xcode_version:
description: "Xcode version"
required: true
type: string
build_with_make:
description: "Build with make"
required: false
default: false
type: boolean
macos_version:
description: "macOS version"
required: true
default: macos-26
type: string
needs_xcframework:
description: "Whether the workflow needs to download the XCFramework."
required: false
default: false
type: boolean
codecov_test_analytics:
description: "Whether or not to push results to Codecov for analytics."
required: false
default: false
type: boolean
test-destination-os:
description: "Test destination OS"
required: false
default: ""
type: string
device:
description: "Device"
required: false
default: ""
type: string
platform:
description: "Additional platform to install"
required: false
default: ""
type: string
should_skip:
description: "Whether to skip the job"
required: false
default: false
type: boolean
runner_provider:
description: "CI runner provider: cirrus (default) or bitrise"
required: false
default: "cirrus"
type: string
secrets:
CODECOV_TOKEN:
required: true
jobs:
common-ui-tests:
if: ${{ !inputs.should_skip }}
name: UI Tests Common
runs-on: ${{ inputs.runner_provider == 'bitrise' && fromJSON(format('["bitrise_pool_name:{0}"]', inputs.macos_version)) || fromJSON(format('["ghcr.io/cirruslabs/macos-runner:{0},runner_concurrency_group={1}", "runner_group_id:10"]', inputs.macos_version, github.run_id)) }}
continue-on-error: ${{ inputs.runner_provider == 'bitrise' }}
timeout-minutes: 40
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: actions/cache@v5
name: Cache Ruby
with:
path: |
~/.asdf/installs/ruby
key: ruby-asdf-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.ruby-version') }}
- name: Install Ruby (Bitrise)
if: inputs.runner_provider == 'bitrise'
run: |
asdf plugin add ruby || true
asdf plugin update ruby
asdf install ruby $(cat .ruby-version)
asdf global ruby $(cat .ruby-version)
bundle install
- name: Setup Ruby
if: inputs.runner_provider != 'bitrise'
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
with:
bundler-cache: true
- name: Setup Xcode
id: setup-xcode
uses: ./.github/actions/setup-xcode
with:
version: ${{ inputs.xcode_version }}
- name: Resolve test destination
id: resolve-test-destination
uses: ./.github/actions/resolve-test-destination
with:
test-destination-os: ${{ inputs.test-destination-os || steps.setup-xcode.outputs.ios-simulator-os }}
device: ${{ inputs.device }}
platform: ${{ inputs.platform }}
- name: Ensure required runtime is loaded
if: ${{ inputs.platform == 'iOS' || inputs.platform == 'tvOS' }}
# Ideally we will not need this, but CI sometimes is failing to load some runtimes, this will ensure they are loaded
timeout-minutes: 5 # 5 minutes timeout
env:
OS_VERSION: ${{ steps.resolve-test-destination.outputs.TEST_OS }}
PLATFORM: ${{ inputs.platform }}
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION" --platform "$PLATFORM"
# Boot created simulators to ensure they're ready before tests run
# Based on CircleCI forum comment, booting is especially important for Xcode 26: https://discuss.circleci.com/t/xcode-26-rc/54066/18
- name: Boot simulator
if: ${{ inputs.platform == 'iOS' }}
env:
XCODE_VERSION: ${{ inputs.xcode_version }}
DEVICE_NAME: ${{ steps.resolve-test-destination.outputs.TEST_DEVICE }}
OS_VERSION: ${{ steps.resolve-test-destination.outputs.TEST_OS }}
run: ./scripts/ci-boot-simulator.sh --xcode "$XCODE_VERSION" --device "$DEVICE_NAME" --os-version "$OS_VERSION"
- run: make init-ci-build
if: ${{ inputs.build_with_make }}
- run: make xcode-ci
if: ${{ inputs.build_with_make }}
- name: Add Microphone permissions
uses: ./.github/actions/add-microphone-permissions
- name: Download XCFramework
if: ${{ inputs.needs_xcframework }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: xcframework-${{github.sha}}-sentry-static
path: XCFrameworkBuildPath/
- name: Unzip XCFramework
if: ${{ inputs.needs_xcframework }}
run: |
unzip -o XCFrameworkBuildPath/Sentry.xcframework.zip -d XCFrameworkBuildPath/
- name: Run Fastlane
env:
FASTLANE_COMMAND: ${{ inputs.fastlane_command }}
DEVICE: ${{ steps.resolve-test-destination.outputs.TEST_DEVICE }}
TEST_DESTINATION_OS: ${{ steps.resolve-test-destination.outputs.TEST_OS }}
run: |
if [ -n "$DEVICE" ] && [ -n "$TEST_DESTINATION_OS" ]; then
# Fastlane resolves simulators by major.minor (e.g. "26.4"), not
# hotfix versions like 26.4.1. Strip the patch component.
OS_MM=$(echo "$TEST_DESTINATION_OS" | awk -F. '{print $1"."$2}')
bundle exec fastlane "$FASTLANE_COMMAND" device:"$DEVICE ($OS_MM)"
else
bundle exec fastlane "$FASTLANE_COMMAND"
fi
- name: Publish Test Report
uses: mikepenz/action-junit-report@3a81627bfac62268172037048872e8ebd4207e6d # v6.4.1
if: always()
with:
report_paths: build/reports/*junit.xml
fail_on_failure: true
fail_on_parse_error: true
detailed_summary: true
- name: Codecov test analytics
if: ${{ !cancelled() && inputs.codecov_test_analytics }}
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # pin@v6.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
verbose: true
name: sentry-cocoa-unit-tests
flags: ui-tests-${{ inputs.fastlane_command }}-${{ inputs.xcode_version }}-${{ inputs.runner_provider }}, ui-tests
- name: Upload Result Bundle
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: ${{ failure() }}
with:
name: ${{ inputs.fastlane_command }}${{ inputs.files_suffix }}-${{ inputs.runner_provider }}
path: |
fastlane/test_results/**/*.xcresult
- name: Upload iOS Simulator Crash Logs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: ${{ failure() }}
with:
name: ${{ inputs.fastlane_command }}${{ inputs.files_suffix }}_crash_logs-${{ inputs.runner_provider }}
path: |
~/Library/Logs/DiagnosticReports/**
- name: Archiving Raw Test Logs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: ${{ failure() || cancelled() }}
with:
name: ${{ inputs.fastlane_command }}${{ inputs.files_suffix }}_raw_output-${{ inputs.runner_provider }}
path: |
~/Library/Logs/scan/*.log
./fastlane/test_output/**
- name: Store screenshot
uses: ./.github/actions/capture-screenshot
if: failure()
with:
suffix: ${{ inputs.fastlane_command }}${{ inputs.files_suffix }}-${{ inputs.runner_provider }}
- name: Run CI Diagnostics
uses: ./.github/actions/ci-diagnostics
if: failure()