ci: Test with static lib #14129
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
- release/** | |
pull_request: | |
# Concurrency configuration: | |
# - We use workflow-specific concurrency groups to prevent multiple build runs of the same code, | |
# which would waste CI resources without providing additional value. | |
# - For pull requests, we cancel in-progress builds when new commits are pushed since only the | |
# latest commit's build results matter for merge decisions. | |
# - For main branch pushes, we never cancel builds to ensure all release and sample builds complete, | |
# as broken builds on main could block releases and affect downstream consumers. | |
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_build_for_prs: ${{ steps.changes.outputs.run_build_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 | |
# We had issues that the release build was broken on main. | |
# With this we catch potential issues already in the PR. | |
ios-swift-release: | |
name: Release Build of iOS Swift | |
# Run the job only for PRs with related changes or non-PR events. | |
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true' | |
needs: files-changed | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v5 | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- run: make init-ci-build | |
- run: make xcode-ci | |
- 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_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 }} | |
run: bundle exec fastlane build_ios_swift | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
build-sample: | |
name: Sample ${{ matrix.scheme }} ${{ matrix.config }} | |
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true' | |
needs: files-changed | |
runs-on: macos-15 | |
strategy: | |
fail-fast: false | |
matrix: | |
# other sample projects are built in ui-tests | |
include: | |
- scheme: macOS-Swift | |
config: Debug | |
- scheme: iOS13-Swift | |
config: Debug | |
- scheme: watchOS-Swift WatchKit App | |
config: Debug | |
- scheme: macOS-SwiftUI | |
config: Debug | |
- scheme: SessionReplay-CameraTest | |
config: Debug | |
- scheme: visionOS-Swift | |
config: Debug | |
- scheme: iOS-Swift | |
config: DebugV9 | |
- scheme: macOS-Swift | |
config: DebugV9 | |
- scheme: tvOS-Swift | |
config: DebugV9 | |
- scheme: visionOS-Swift | |
config: DebugV9 | |
- scheme: iOS-SwiftUI | |
config: DebugV9 | |
- scheme: iOS-ObjectiveC | |
config: DebugV9 | |
steps: | |
- uses: actions/checkout@v5 | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
- run: make init-ci-build | |
- run: make xcode-ci | |
# Note: Due to complexity in implementing the CODE_SIGNING_ALLOWED flag in the sentry-xcodebuild.sh script, | |
# we did not yet migrate this step to use the script yet. | |
- run: >- | |
set -o pipefail && NSUnbufferedIO=YES xcodebuild | |
-workspace Sentry.xcworkspace | |
-scheme '${{matrix.scheme}}' | |
-configuration '${{matrix.config}}' | |
CODE_SIGNING_ALLOWED="NO" | |
build 2>&1 | |
| tee raw-build-output.log | |
| xcbeautify --preserve-unbeautified | |
- name: Archiving Raw Build Logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() || cancelled() }} | |
with: | |
name: raw-build-output-scheme-${{matrix.scheme}} | |
path: | | |
raw-build-output.log | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
build-spm: | |
name: Build with SPM | |
runs-on: macos-15 | |
# Don't run this on release branches, cause the SPM Package.swift points to the unreleased versions. | |
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true') | |
needs: files-changed | |
steps: | |
- uses: actions/checkout@v5 | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
shell: sh | |
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace | |
- run: set -o pipefail && NSUnbufferedIO=YES EXPERIMENTAL_SPM_BUILDS=1 xcodebuild build -scheme SentrySPM -sdk watchos -destination 'generic/platform=watchOS' | tee raw-build-output-spm-watchos.log | xcbeautify | |
shell: sh | |
- run: set -o pipefail && NSUnbufferedIO=YES EXPERIMENTAL_SPM_BUILDS=1 xcodebuild build -scheme SentrySPM -sdk iphoneos -destination 'generic/platform=iphoneos' | tee raw-build-output-spm-iphoneos.log | xcbeautify | |
shell: sh | |
- name: Upload SPM Build Logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() || cancelled() }} | |
with: | |
name: raw-build-output-spm | |
path: | | |
raw-build-output-spm-watchos.log | |
raw-build-output-spm-iphoneos.log | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
build-v9: | |
name: Build SDK v9 | |
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true' | |
needs: files-changed | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v5 | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
- run: | | |
./scripts/sentry-xcodebuild.sh \ | |
--platform iOS \ | |
--os 18.4 \ | |
--command build \ | |
--device "iPhone 16 Pro" \ | |
--configuration DebugV9 | |
- name: Archiving Raw Build Logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() || cancelled() }} | |
with: | |
name: raw-build-output-v9 | |
path: | | |
raw-build-output.log | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
check-debug-without-UIKit: | |
name: Check no UIKit linkage (DebugWithoutUIKit) | |
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true' | |
needs: files-changed | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v5 | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
- name: Build for Debug | |
run: | | |
./scripts/sentry-xcodebuild.sh \ | |
--platform iOS \ | |
--os 18.4 \ | |
--ref ${{ github.ref }} \ | |
--command build \ | |
--device "iPhone 16 Pro" \ | |
--configuration DebugWithoutUIKit \ | |
--derived-data uikit-check-build | |
- name: Ensure UIKit is not linked | |
run: ./scripts/check-uikit-linkage.sh DebugWithoutUIKit uikit-check-build unlinked SentryWithoutUIKit | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
check-release-without-UIKit: | |
name: Check no UIKit linkage (ReleaseWithoutUIKit) | |
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true' | |
needs: files-changed | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v5 | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
- name: Build for Release | |
run: | | |
./scripts/sentry-xcodebuild.sh \ | |
--platform iOS \ | |
--os 18.4 \ | |
--ref ${{ github.ref }} \ | |
--command build \ | |
--device "iPhone 16 Pro" \ | |
--configuration ReleaseWithoutUIKit \ | |
--derived-data uikit-check-build | |
- name: Ensure UIKit is not linked | |
run: ./scripts/check-uikit-linkage.sh ReleaseWithoutUIKit uikit-check-build unlinked SentryWithoutUIKit | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
check-debug-with-UIKit: | |
name: Check UIKit linkage (Debug) | |
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true' | |
needs: files-changed | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v5 | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
- name: Build for Debug | |
run: | | |
./scripts/sentry-xcodebuild.sh \ | |
--platform iOS \ | |
--os 18.4 \ | |
--ref ${{ github.ref }} \ | |
--command build \ | |
--device "iPhone 16 Pro" \ | |
--configuration Debug \ | |
--derived-data uikit-check-build | |
- name: Ensure UIKit is linked | |
run: ./scripts/check-uikit-linkage.sh Debug uikit-check-build linked Sentry | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
check-release-with-UIKit: | |
name: Check UIKit linkage (Release) | |
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true' | |
needs: files-changed | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v5 | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
- name: Build for Release | |
run: | | |
./scripts/sentry-xcodebuild.sh \ | |
--platform iOS \ | |
--os 18.4 \ | |
--ref ${{ github.ref }} \ | |
--command build \ | |
--device "iPhone 16 Pro" \ | |
--configuration Release \ | |
--derived-data uikit-check-build | |
- name: Ensure UIKit is linked | |
run: ./scripts/check-uikit-linkage.sh Release uikit-check-build linked Sentry | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
# The compiler only evaluates SentryAsyncSafeLogs that get printed based on the SENTRY_ASYNC_SAFE_LOG_LEVEL. | |
# So if the level is set to error, which is the default, and a SENTRY_ASYNC_SAFE_LOG_DEBUG has a compiler error, | |
# you only get the compiler error when setting the SENTRY_ASYNC_SAFE_LOG_LEVEL to SENTRY_ASYNC_SAFE_LOG_LEVEL_DEBUG or lower. | |
check-compiling-async-safe-logs: | |
name: Check compiling Async Safe Logs | |
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true' | |
needs: files-changed | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v5 | |
# If the SentryAsyncSafeLog doesn't contain the SENTRY_ASYNC_SAFE_LOG_LEVEL_ERROR this fails. | |
- name: Async Safe Log Level is Error | |
run: grep -c "SENTRY_ASYNC_SAFE_LOG_LEVEL SENTRY_ASYNC_SAFE_LOG_LEVEL_ERROR" Sources/Sentry/SentryAsyncSafeLog.h | |
- name: Set Async Safe Log Level to Debug | |
run: | | |
sed -i '' 's/#define SENTRY_ASYNC_SAFE_LOG_LEVEL SENTRY_ASYNC_SAFE_LOG_LEVEL_ERROR/#define SENTRY_ASYNC_SAFE_LOG_LEVEL SENTRY_ASYNC_SAFE_LOG_LEVEL_TRACE/' Sources/Sentry/SentryAsyncSafeLog.h | |
shell: bash | |
- run: ./scripts/ci-select-xcode.sh 16.4 | |
- name: Build for Debug | |
run: | | |
./scripts/sentry-xcodebuild.sh \ | |
--platform iOS \ | |
--os 18.4 \ | |
--ref ${{ github.ref }} \ | |
--command build \ | |
--device "iPhone 16 Pro" \ | |
--configuration Debug | |
- name: Debug Xcode environment | |
if: ${{ failure() || cancelled() }} | |
run: ./scripts/ci-diagnostics.sh | |
build-required-check: | |
needs: | |
[ | |
files-changed, | |
ios-swift-release, | |
build-sample, | |
build-spm, | |
build-v9, | |
check-debug-without-UIKit, | |
check-release-without-UIKit, | |
check-debug-with-UIKit, | |
check-release-with-UIKit, | |
check-compiling-async-safe-logs, | |
] | |
name: Build | |
# 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 build jobs has failed." && exit 1 |