Skip to content

test: Add crash when SentryInitializeForGettingSubclassesNotCalled is… #771

test: Add crash when SentryInitializeForGettingSubclassesNotCalled is…

test: Add crash when SentryInitializeForGettingSubclassesNotCalled is… #771

name: Test 3rd Party Integrations
on:
push:
branches:
- main
- release/**
pull_request:
types: [opened, synchronize, reopened, labeled]
# Concurrency configuration:
# - We use workflow-specific concurrency groups to allow independent test runs across different workflows
# while preventing multiple runs of the same test suite on the same branch/commit.
# - For pull requests, we cancel in-progress runs when new commits are pushed to save CI resources
# and provide faster feedback on the latest changes.
# - For main branch pushes and scheduled runs, we never cancel in-progress runs to ensure the complete
# test suite always finishes, maintaining the integrity of our main branch quality gates.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
ready-to-merge-gate:
name: Ready-to-merge gate
uses: ./.github/workflows/ready-to-merge-workflow.yml
# This job detects if the PR contains changes that require running tests for 3rd-party integrations.
# If yes, the job will output a flag that will be used by the next job to run the tests for 3rd-party integrations.
# If no, the job will output a flag that will be used by the next job to skip running the tests for 3rd-party integrations.
# At the end of this workflow, we run a check that validates that either all tests for 3rd-party integrations passed or were
# called unit-tests-required-check.
files-changed:
name: Detect File Changes
runs-on: ubuntu-latest
needs: ready-to-merge-gate
# Map a step output to a job output
outputs:
run_3rd_party_integrations_tests_for_prs: ${{ steps.changes.outputs.run_3rd_party_integrations_tests_for_prs }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Get changed files
id: changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
# Build xcframeworks from source code once for all integration tests.
# This ensures tests use the current source code instead of the latest GitHub release.
# We only build the Static variant since 3rd-party integrations only use the "Sentry" product.
# Intentionally skipped on release branches.
build-xcframeworks:
name: Build XCFrameworks
needs: files-changed
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_3rd_party_integrations_tests_for_prs == 'true')
runs-on:
- "ghcr.io/cirruslabs/macos-runner:sequoia,runner_concurrency_group=${{ github.run_id }}"
- "runner_group_id:10"
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Select Xcode
run: ./scripts/ci-select-xcode.sh 16.4
- name: Build XCFramework (Static)
run: ./scripts/build-xcframework-local.sh macOSOnly StaticOnly --not-signed
- name: Upload XCFrameworks
uses: actions/upload-artifact@v7
with:
name: xcframeworks-for-3rd-party-integration-tests
path: "XCFrameworkBuildPath/*.xcframework.zip"
retention-days: 1
# SPM tests for all 3rd-party integrations
test-integrations-spm:
name: SPM Tests | ${{matrix.integration_dir}}
needs: [files-changed, build-xcframeworks]
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_3rd_party_integrations_tests_for_prs == 'true')
runs-on:
- "ghcr.io/cirruslabs/macos-runner:sequoia,runner_concurrency_group=${{ github.run_id }}"
- "runner_group_id:10"
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- integration_dir: SentrySwiftLog
- integration_dir: SentrySwiftyBeaver
- integration_dir: SentryCocoaLumberjack
- integration_dir: SentryPulse
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Select Xcode
run: ./scripts/ci-select-xcode.sh 16.4
- name: Download XCFrameworks
uses: actions/download-artifact@v8
with:
name: xcframeworks-for-3rd-party-integration-tests
- name: Modify Package.swift to use local xcframeworks
run: ./scripts/prepare-package.sh --package-file Package.swift --is-pr true --remove-duplicate true --change-path true
- name: Use local sentry-cocoa
working-directory: 3rd-party-integrations/${{matrix.integration_dir}}
run: |
sed -i '' 's|\.package(url: "https://github\.com/getsentry/sentry-cocoa", from: "[^"]*")|.package(name: "sentry-cocoa", path: "../..")|g' Package.swift
- name: Run SPM Tests
working-directory: 3rd-party-integrations/${{matrix.integration_dir}}
run: swift test
- name: Archiving Raw Logs
uses: actions/upload-artifact@v7
if: ${{ failure() || cancelled() }}
with:
name: raw-output-${{matrix.integration_dir}}-integration
path: |
3rd-party-integrations/${{matrix.integration_dir}}/.build/**/*.log
- name: Run CI Diagnostics
if: failure()
run: ./scripts/ci-diagnostics.sh
unit-tests-required-check:
needs:
[
ready-to-merge-gate,
files-changed,
build-xcframeworks,
test-integrations-spm,
]
name: 3rd Party Integration Tests - Required Check
# 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 3rd party integration test jobs has failed." && exit 1