-
-
Notifications
You must be signed in to change notification settings - Fork 381
189 lines (171 loc) · 6.41 KB
/
ui-tests-common.yml
File metadata and controls
189 lines (171 loc) · 6.41 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
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
run_on_cirrus_labs:
description: "Whether to run the tests on Cirrus Labs"
required: false
default: false
type: boolean
should_skip:
description: "Whether to skip the job"
required: false
default: false
type: boolean
secrets:
CODECOV_TOKEN:
required: true
jobs:
common-ui-tests:
if: ${{ !inputs.should_skip }}
name: UI Tests Common
runs-on: ${{ inputs.run_on_cirrus_labs && fromJSON(format('["ghcr.io/cirruslabs/macos-runner:{0},runner_concurrency_group={1}", "runner_group_id:10"]', inputs.macos_version, github.run_id)) || inputs.macos_version }}
timeout-minutes: 40
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Ruby
uses: ruby/setup-ruby@09a7688d3b55cf0e976497ff046b70949eeaccfd # v1.288.0
with:
bundler-cache: true
- name: Select Xcode version
env:
XCODE_VERSION: ${{ inputs.xcode_version }}
run: ./scripts/ci-select-xcode.sh "$XCODE_VERSION"
- 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: ${{ inputs.test-destination-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: ${{ inputs.device }}
OS_VERSION: ${{ inputs.test-destination-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@v7
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: ${{ inputs.device }}
TEST_DESTINATION_OS: ${{ inputs.test-destination-os }}
run: |
if [ -n "$DEVICE" ] && [ -n "$TEST_DESTINATION_OS" ]; then
bundle exec fastlane "$FASTLANE_COMMAND" device:"$DEVICE ($TEST_DESTINATION_OS)"
else
bundle exec fastlane "$FASTLANE_COMMAND"
fi
- name: Publish Test Report
uses: mikepenz/action-junit-report@5e05ac00ad0604dfb7e313ae412aa3284f4906d6 # v6.3.0
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/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # pin@v1.2.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
name: sentry-cocoa-unit-tests
flags: ui-tests-${{ inputs.fastlane_command }}-${{ inputs.xcode_version }}, ui-tests
- name: Upload Result Bundle
uses: actions/upload-artifact@v6
if: ${{ failure() }}
with:
name: ${{ inputs.fastlane_command }}${{ inputs.files_suffix }}
path: |
fastlane/test_results/**/*.xcresult
- name: Upload iOS Simulator Crash Logs
uses: actions/upload-artifact@v6
if: ${{ failure() }}
with:
name: ${{ inputs.fastlane_command }}${{ inputs.files_suffix }}_crash_logs
path: |
~/Library/Logs/DiagnosticReports/**
- name: Archiving Raw Test Logs
uses: actions/upload-artifact@v6
if: ${{ failure() || cancelled() }}
with:
name: ${{ inputs.fastlane_command }}${{ inputs.files_suffix }}_raw_output
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 }}
- name: Run CI Diagnostics
if: failure()
run: ./scripts/ci-diagnostics.sh