Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,27 @@ run_lint_xcode_analyze_for_prs: &run_lint_xcode_analyze_for_prs # Xcode linting
- "Sentry.xcodeproj/**"
- "*.podspec"
- "Gemfile.lock"

run_build_for_prs: &run_build_for_prs # Build-related code
- "Sources/**"
- "test-server/**"
- "Samples/**"

# GH Actions
- ".github/workflows/build.yml"
- ".github/file-filters.yml"

# Project files
- "Sentry.xcworkspace/**"
- "Sentry.xcodeproj/**"
- "Package*.swift"

# Scripts
- "scripts/ci-select-xcode.sh"
- "scripts/ci-diagnostics.sh"

# Other
- "fastlane/**"
- "Gemfile.lock"
- "Makefile" # Make commands used for CI build setup
- "Brewfile*" # Dependency installation affects build environment
74 changes: 59 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@ on:
- release/**

pull_request:
paths:
- "Sources/**"
- "test-server/**"
- "Samples/**"
- ".github/workflows/build.yml"
- "fastlane/**"
- "scripts/ci-select-xcode.sh"
- "scripts/ci-diagnostics.sh"
- Sentry.xcworkspace/**
- Sentry.xcodeproj/**
- Gemfile.lock
- "Package*.swift"
- "Makefile" # Make commands used for CI build setup
- "Brewfile*" # Dependency installation affects build environment

# Concurrency configuration:
# - We use workflow-specific concurrency groups to prevent multiple build runs of the same code,
Expand All @@ -33,10 +19,27 @@ concurrency:
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
Expand All @@ -63,6 +66,8 @@ jobs:

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
Expand Down Expand Up @@ -127,7 +132,8 @@ jobs:
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
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

Expand All @@ -154,6 +160,8 @@ jobs:

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
Expand All @@ -178,6 +186,8 @@ jobs:

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-14
steps:
- uses: actions/checkout@v5
Expand All @@ -201,6 +211,8 @@ jobs:

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-14
steps:
- uses: actions/checkout@v5
Expand All @@ -224,6 +236,8 @@ jobs:

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-14
steps:
- uses: actions/checkout@v5
Expand All @@ -247,6 +261,8 @@ jobs:

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-14
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -274,6 +290,8 @@ jobs:

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
Expand Down Expand Up @@ -302,3 +320,29 @@ jobs:
- 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
Loading