Skip to content

docs: Add strategy for project structure refactoring #4883

docs: Add strategy for project structure refactoring

docs: Add strategy for project structure refactoring #4883

Workflow file for this run

name: Upload to Testflight
on:
push:
branches:
- main
- v8.x
pull_request:
workflow_dispatch:
# Concurrency configuration:
# - We use workflow-specific concurrency groups to prevent multiple TestFlight uploads of the same build,
# as these operations involve app building, signing, and upload to Apple's servers.
# - For pull requests, we cancel in-progress runs when testing workflow changes since only the
# latest configuration needs validation before merging.
# - For main branch pushes (actual uploads), we never cancel uploads to ensure every main branch
# commit gets properly built and distributed to TestFlight for testing by our team.
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_testflight_for_changes: ${{ github.event_name == 'pull_request' && steps.changes.outputs.run_testflight_for_prs || steps.changes.outputs.run_testflight_for_pushes }}
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
upload_to_testflight:
if: needs.files-changed.outputs.run_testflight_for_changes == 'true'
needs: files-changed
name: Build and Upload iOS-Swift to Testflight
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- name: Setup Ruby
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
with:
bundler-cache: true
# As the DistributionSample project uses local SPM, xcodebuild resolves SPM dependencies for all
# sample projects. The Package.swift references binary targets, which in release branch commits points
# to non-existent download URLs. This creates chicken-egg failures when building these sample apps for
# a release commit build. When building these sample apps for a release commit, xcodebuild tries to
# resolve all SPM dependencies, including the binary targets pointing to these non-existent URLs. The
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
- name: Only keep distribution lib and target in Package.swift
run: ./scripts/prepare-package.sh --remove-binary-targets true
- run: make init-ci-build
- run: make xcode-ci
# We upload a new version to TestFlight on every commit on main
# So we need to bump the build number each time
- name: Bump Build Version
env:
FASTLANE_BUILD_NUMBER: ${{ github.run_number }}
run: bundle exec fastlane bump_build_number
- name: Remove preview version suffixes
run: bundle exec fastlane remove_preview_version_suffixes
- name: Run Fastlane
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
FASTLANE_BUNDLE_VERSION: ${{ github.run_number }}
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
bundle exec fastlane build_ios_swift
bundle exec fastlane ios_swift_to_testflight
- name: Archiving
uses: actions/upload-artifact@v5
with:
name: dSYMs
path: |
${{ github.workspace }}/iOS-Swift.*
${{ github.workspace }}/*.dSYM.zip
${{ github.workspace }}/dSYMs/
- name: Run CI Diagnostics
if: failure()
run: ./scripts/ci-diagnostics.sh
# This check validates that either upload_to_testflight passed or was skipped, which allows us
# to make testflight a required check with only running the upload_to_testflight when required.
# So, we don't have to run upload_to_testflight, for example, for unrelated changes.
testflight-required-check:
needs: [files-changed, upload_to_testflight]
name: Testflight
# 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 testflight jobs has failed." && exit 1