Skip to content

test: add a dummy NSPrincipalClass for the SentryTests bundle #6194

test: add a dummy NSPrincipalClass for the SentryTests bundle

test: add a dummy NSPrincipalClass for the SentryTests bundle #6194

name: Objective-C Conversion Analysis
on:
push:
branches:
- main
- v8.x
pull_request:
# Concurrency configuration:
# - We use workflow-specific concurrency groups to prevent multiple Objective-C conversion analysis runs,
# as these analyze code conversion progress and generate tracking reports.
# - For pull requests, we cancel in-progress runs when new commits are pushed since only the
# latest conversion analysis matters for tracking progress on SwiftConversion changes.
# - For main branch pushes, we never cancel conversion analysis to ensure we maintain accurate
# tracking of our Objective-C to Swift conversion progress across the entire project.
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_objc_conversion_analysis_for_prs: ${{ steps.changes.outputs.run_objc_conversion_analysis_for_prs }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Get changed files
id: changes
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
analyze-objc-conversion:
name: Analyze Objective-C to Swift Conversion
# Run the job only for PRs with related changes or non-PR events.
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_objc_conversion_analysis_for_prs == 'true'
needs: files-changed
runs-on: macos-15
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Ruby
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: true
- name: Install Graphviz
run: brew install graphviz
- name: Run Objective-C conversion analyzer
working-directory: SwiftConversion
run: |
ruby objc_conversion_analyzer.rb
- name: Generate Graphviz DOT file
working-directory: SwiftConversion
run: |
ruby generate_graphviz.rb
- name: Convert DOT to SVG
working-directory: SwiftConversion
run: |
dot -Tsvg objc_dependencies_topo.dot -o objc_dependencies_topo.svg
- name: Upload analysis artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: objc-conversion-analysis
path: |
SwiftConversion/objc_conversion_analysis.json
SwiftConversion/objc_dependencies_topo.dot
SwiftConversion/objc_dependencies_topo.svg
retention-days: 30
- name: Run CI Diagnostics
uses: ./.github/actions/ci-diagnostics
if: failure()
# This check validates that either all Objective-C conversion analysis passed or was skipped, which allows us
# to make the analysis a required check with only running the analysis when required.
# So, we don't have to run analysis, for example, for Changelog or ReadMe changes.
objc_conversion_analysis-required-check:
needs: [files-changed, analyze-objc-conversion]
name: Objective-C Conversion Analysis
# 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 Objective-C conversion analysis jobs has failed." && exit 1