Skip to content

chore: Convert SentryFramesTracker to Swift #5659

chore: Convert SentryFramesTracker to Swift

chore: Convert SentryFramesTracker to Swift #5659

name: Test UI Critical
on:
push:
branches:
- main
pull_request:
# Concurrency configuration:
# - We use workflow-specific concurrency groups to prevent multiple critical UI test runs,
# as these test the most essential user interface functionality and are resource-intensive.
# - For pull requests, we cancel in-progress runs when new commits are pushed to provide
# faster feedback on critical functionality and avoid wasting expensive testing resources.
# - For main branch pushes, we never cancel critical UI tests to ensure the most important
# user interface features are always validated before code reaches production.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
files-changed:
name: Detect File Changes
runs-on: ubuntu-latest
outputs:
run_ui_tests_critical_for_prs: ${{ steps.changes.outputs.run_ui_tests_critical_for_prs }}
steps:
- uses: actions/checkout@v5
- name: Get changed files
id: changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
run-tests:
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_critical_for_prs == 'true'
needs: files-changed
name: Test ${{matrix.name}} V4 # Up the version with every change to keep track of flaky tests
uses: ./.github/workflows/ui-tests-common.yml
with:
fastlane_command: ui_critical_tests_ios_swiftui_envelope
build_with_make: true
xcode_version: ${{matrix.platform.xcode}}
macos_version: ${{matrix.platform.runs-on}}
files_suffix: _${{matrix.platform.xcode}}
platform: ${{matrix.platform.platform}}
device: ${{matrix.platform.device}}
test-destination-os: ${{matrix.platform.test-destination-os}}
strategy:
fail-fast: false
matrix:
include:
# As of 25th March 2025, the preinstalled iOS simulator version is 16.4 for macOS 13 and Xcode 14.3.1; see
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#installed-sdks
- name: iOS 16
platform:
runs-on: macos-13
xcode: "14.3.1"
platform: "iOS"
device: "iPhone 14 Pro"
test-destination-os: "16.4"
# macos-14 iOS 17 not included due to the XCUIServerNotFound errors causing flaky tests
# As of 14th August 2025, the preinstalled iOS simulator version is 18.4 for macOS 15 and Xcode 16.4; see
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#installed-sdks
- name: iOS 18
platform:
runs-on: macos-15
xcode: "16.4"
platform: "iOS"
device: "iPhone 16 Pro"
test-destination-os: "18.4"
- name: iOS 26
platform:
runs-on: macos-15
xcode: "26.0.1"
platform: "iOS"
device: "iPhone 16 Pro"
test-destination-os: "26.0"
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run-swiftui-crash-test:
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_critical_for_prs == 'true'
needs: files-changed
name: Run SwiftUI Crash Test
runs-on: macos-15
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- run: make init-ci-build
- run: make xcode-ci
- name: Enable screenshots permissions
shell: bash
run: ./scripts/ci-enable-permissions.sh
- name: Boot simulator
run: ./scripts/ci-boot-simulator.sh
- name: Run SwiftUI Crash Test
run: |
./TestSamples/SwiftUICrashTest/test-crash-and-relaunch.sh --screenshots-dir "swiftui-crash-test-screenshots"
- name: Upload SwiftUI Crash Test Screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: swiftui-crash-test-screenshots
path: swiftui-crash-test-screenshots
- name: Collect Logs
if: always()
run: xcrun simctl spawn booted log collect --output $(pwd)/swiftui-crash-test-log.logarchive
- name: Upload Logs
uses: actions/upload-artifact@v4
if: always()
with:
name: swiftui-crash-test-log.logarchive
path: swiftui-crash-test-log.logarchive
- name: Run CI Diagnostics
if: failure()
run: ./scripts/ci-diagnostics.sh
# This check validates that either all UI tests critical passed or were skipped, which allows us
# to make UI tests critical a required check with only running the UI tests critical when required.
# So, we don't have to run UI tests critical, for example, for unrelated changes.
ui_tests_critical-required-check:
needs:
[
files-changed,
run-tests,
run-swiftui-crash-test,
]
name: UI Tests Critical
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
if: always()
runs-on: ubuntu-latest
steps:
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
# Skipped jobs are not considered failures.
- name: Check for failures
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "One of the UI tests critical jobs has failed." && exit 1