Skip to content

chore: Convert SentryFramesTracker to Swift #3294

chore: Convert SentryFramesTracker to Swift

chore: Convert SentryFramesTracker to Swift #3294

name: Test Cross Platform
on:
push:
branches:
- main
pull_request:
# Concurrency configuration:
# - We use workflow-specific concurrency groups to prevent multiple cross-platform tests,
# as these involve complex React Native and cross-platform integration setups.
# - For pull requests, we cancel in-progress runs when new commits are pushed since only the
# latest cross-platform compatibility results matter for validating multi-platform support.
# - For main branch pushes, we never cancel cross-platform tests to ensure our SDK remains
# compatible with React Native and other cross-platform frameworks that depend on us.
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_test_cross_platform_for_prs: ${{ steps.changes.outputs.run_test_cross_platform_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
test-react-native:
name: React Native Installation
# Run the job only for PRs with related changes or non-PR events.
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_test_cross_platform_for_prs == 'true'
needs: files-changed
runs-on: macos-14
# This job can take a while to run, so we set a timeout.
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
with:
repository: getsentry/sentry-cocoa
path: sentry-cocoa
- name: Initialize tools
run: make init-ci-build
working-directory: sentry-cocoa
- name: Clone Sentry React Native Repository
uses: actions/checkout@v5
with:
repository: getsentry/sentry-react-native
path: sentry-react-native
ref: itay/frames_tracker_swift
- name: Enable Corepack
working-directory: sentry-react-native
run: npm i -g corepack
- uses: actions/setup-node@v5
with:
node-version: 18
cache: "yarn"
cache-dependency-path: sentry-react-native/yarn.lock
- run: ./sentry-cocoa/scripts/ci-select-xcode.sh 16.2
- name: Install SDK JS Dependencies
working-directory: sentry-react-native
run: yarn install
- name: Remove Sentry/HybridSDK Dependency from RNSentry.podspec
run: sed -i '' "s/s.dependency 'Sentry\/HybridSDK', '[0-9]*\.[0-9]*\.[0-9]*'/s.dependency 'Sentry\/HybridSDK'/" sentry-react-native/packages/core/RNSentry.podspec
- name: Add Sentry/HybridSDK Dependency to RNSentryCocoaTester/Podfile
run: sed -i '' -e "s/RNSentry.podspec'/RNSentry.podspec'\\n pod 'Sentry\/HybridSDK', :path => '..\/..\/..\/..\/sentry-cocoa'/" sentry-react-native/packages/core/RNSentryCocoaTester/Podfile
- name: Disable test parallelization
working-directory: sentry-react-native/packages/core/RNSentryCocoaTester
run: sed -i '' "s/parallelizable = \"YES\"/parallelizable = \"NO\"/" RNSentryCocoaTester.xcodeproj/xcshareddata/xcschemes/RNSentryCocoaTester.xcscheme
- name: Install App Pods
working-directory: sentry-react-native/packages/core/RNSentryCocoaTester
run: pod install
- name: Run iOS Tests
working-directory: sentry-react-native/packages/core/RNSentryCocoaTester
env:
SCHEME: RNSentryCocoaTester
CONFIGURATION: Release
DESTINATION: "platform=iOS Simulator,OS=17.5,name=iPhone 15 Pro"
run: |
set -o pipefail
env NSUnbufferedIO=YES \
xcodebuild -workspace *.xcworkspace \
-scheme $SCHEME -configuration $CONFIGURATION \
-destination "$DESTINATION" \
test SWIFT_ACTIVE_COMPILATION_CONDITIONS=CROSS_PLATFORM_TEST GCC_PREPROCESSOR_DEFINITIONS"=CROSS_PLATFORM_TEST=1" | xcbeautify
- name: Run CI Diagnostics
if: failure()
run: ./sentry-cocoa/scripts/ci-diagnostics.sh
test_cross_platform-required-check:
needs:
[
files-changed,
test-react-native,
]
name: Test Cross Platform
# 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 cross-platform test jobs has failed." && exit 1