Skip to content

Commit 0a6a5bc

Browse files
committed
Merge remote-tracking branch 'origin/main' into philprime/disable-live-activity-widgets
2 parents 0965325 + 762a701 commit 0a6a5bc

File tree

26 files changed

+708
-83
lines changed

26 files changed

+708
-83
lines changed

.github/actions/prepare-package.swift/action.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/file-filters.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ run_version_bump_util_for_prs: &run_version_bump_util_for_prs
428428
- "Sources/Configuration/SDK.xcconfig"
429429
- "Sources/Configuration/Versioning.xcconfig"
430430
- "Sources/Configuration/SentrySwiftUI.xcconfig"
431+
- "Sources/Configuration/SentrySwiftLog.xcconfig"
431432

432433
run_ui_tests_for_prs: &run_ui_tests_for_prs
433434
- "Sources/**"

.github/workflows/build.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- release/**
88

99
pull_request:
10+
types: [opened, synchronize, reopened, labeled]
1011

1112
# Concurrency configuration:
1213
# - We use workflow-specific concurrency groups to prevent multiple build runs of the same code,
@@ -20,9 +21,17 @@ concurrency:
2021
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2122

2223
jobs:
24+
ready-to-merge-gate:
25+
name: Ready-to-merge gate
26+
uses: ./.github/workflows/ready-to-merge-workflow.yml
27+
with:
28+
is-pr: ${{ github.event_name == 'pull_request' }}
29+
labels: ${{ toJson(github.event.pull_request.labels) }}
30+
2331
files-changed:
2432
name: Detect File Changes
2533
runs-on: ubuntu-latest
34+
needs: ready-to-merge-gate
2635
outputs:
2736
run_build_for_prs: ${{ steps.changes.outputs.run_build_for_prs }}
2837
steps:
@@ -39,11 +48,23 @@ jobs:
3948
ios-swift-release:
4049
name: Release Build of iOS Swift
4150
# Run the job only for PRs with related changes or non-PR events.
42-
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
51+
# Don't run this on release branches, cause the SPM Package.swift points to the unreleased versions.
52+
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true')
4353
needs: files-changed
4454
runs-on: macos-15
4555
steps:
4656
- uses: actions/checkout@v5
57+
58+
# As the DistributionSample project uses local SPM, xcodebuild resolves SPM dependencies for all
59+
# sample projects. The Package.swift references binary targets, which in release branch commits points
60+
# to non-existent download URLs. This creates chicken-egg failures when building these sample apps for
61+
# a release commit build. When building these sample apps for a release commit, xcodebuild tries to
62+
# resolve all SPM dependencies, including the binary targets pointing to these non-existent URLs. The
63+
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
64+
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
65+
- name: Only keep distribution lib and target in Package.swift
66+
run: ./scripts/prepare-package.sh --only-keep-distribution true
67+
4768
- run: ./scripts/ci-select-xcode.sh 16.4
4869
- uses: ruby/setup-ruby@v1
4970
with:
@@ -98,6 +119,17 @@ jobs:
98119

99120
steps:
100121
- uses: actions/checkout@v5
122+
123+
# As the DistributionSample project uses local SPM, xcodebuild resolves SPM dependencies for all
124+
# sample projects. The Package.swift references binary targets, which in release branch commits points
125+
# to non-existent download URLs. This creates chicken-egg failures when building these sample apps for
126+
# a release commit build. When building these sample apps for a release commit, xcodebuild tries to
127+
# resolve all SPM dependencies, including the binary targets pointing to these non-existent URLs. The
128+
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
129+
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
130+
- name: Only keep distribution lib and target in Package.swift
131+
run: ./scripts/prepare-package.sh --only-keep-distribution true
132+
101133
- run: ./scripts/ci-select-xcode.sh 16.4
102134
- run: make init-ci-build
103135
- run: make xcode-ci
@@ -129,12 +161,15 @@ jobs:
129161
build-distribution:
130162
name: Build the distribution framework
131163
runs-on: macos-15
164+
# Don't run this on release branches, cause the SPM Package.swift points to the unreleased versions.
165+
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true')
132166
needs: files-changed
133167
steps:
134168
- uses: actions/checkout@v5
135169

136170
- run: ./scripts/ci-select-xcode.sh 16.4
137171
shell: sh
172+
138173
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
139174
- run: set -o pipefail && NSUnbufferedIO=YES xcodebuild build -scheme SentryDistribution -sdk iphoneos -destination 'generic/platform=iphoneos' | tee raw-build-output-spm.log | xcbeautify
140175
shell: sh
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Ready to Merge Workflow
2+
on:
3+
workflow_call:
4+
inputs:
5+
labels:
6+
description: The GitHub event's labels
7+
required: true
8+
type: string
9+
is-pr:
10+
description: Whether the workflow is running on a PR
11+
required: true
12+
type: boolean
13+
14+
jobs:
15+
ready-to-merge-gate:
16+
name: 'Missing "ready-to-merge" label'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check for exact 'ready-to-merge' label
20+
if: ${{ inputs.is-pr }}
21+
id: check-label
22+
run: |
23+
# Use jq to check for exact label match (avoids substring matching issues with contains())
24+
if echo '${{ inputs.labels }}' | jq -e '.[] | select(.name == "ready-to-merge")' > /dev/null; then
25+
echo "label_found=true" >> $GITHUB_OUTPUT
26+
else
27+
echo "label_found=false" >> $GITHUB_OUTPUT
28+
fi
29+
# Since Github also accepts `skipped` results for Required Workflows, we need
30+
# to fail the job to ensure that the downstream jobs don't just skip.
31+
- name: Fail until the 'ready-to-merge' label is present
32+
if: ${{ inputs.is-pr && steps.check-label.outputs.label_found == 'false' }}
33+
run: |
34+
echo "Add the 'ready-to-merge' label to run CI."
35+
exit 1
36+
- name: Gate passed
37+
if: ${{ inputs.is-pr && steps.check-label.outputs.label_found == 'true' }}
38+
run: echo "Label present. Proceeding with CI."
39+
- name: Gate passed
40+
if: ${{ !inputs.is-pr }}
41+
run: echo "Not a PR. Proceeding with CI."

.github/workflows/release.yml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- v8.x
99

1010
pull_request:
11+
types: [opened, synchronize, reopened, labeled]
1112

1213
workflow_dispatch:
1314
inputs:
@@ -33,9 +34,17 @@ concurrency:
3334
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
3435

3536
jobs:
37+
ready-to-merge-gate:
38+
name: Ready-to-merge gate
39+
uses: ./.github/workflows/ready-to-merge-workflow.yml
40+
with:
41+
is-pr: ${{ github.event_name == 'pull_request' }}
42+
labels: ${{ toJson(github.event.pull_request.labels) }}
43+
3644
files-changed:
3745
name: Detect File Changes
3846
runs-on: ubuntu-latest
47+
needs: ready-to-merge-gate
3948
outputs:
4049
run_release_for_prs: ${{ steps.changes.outputs.run_release_for_prs }}
4150
steps:
@@ -142,9 +151,12 @@ jobs:
142151
pattern: xcframework-${{github.sha}}-*
143152
merge-multiple: true
144153
- name: Prepare Package.swift
145-
uses: ./.github/actions/prepare-package.swift
146-
with:
147-
is-pr: ${{ github.event_name == 'pull_request' }}
154+
shell: bash
155+
run: |
156+
./scripts/prepare-package.sh \
157+
--package-file Package.swift \
158+
--is-pr "${{ github.event_name == 'pull_request' }}" \
159+
--change-path true
148160
- run: ./scripts/ci-select-xcode.sh 16.4
149161
- run: swift build
150162
working-directory: Samples/macOS-SPM-CommandLine
@@ -165,9 +177,12 @@ jobs:
165177
pattern: xcframework-${{github.sha}}-*
166178
merge-multiple: true
167179
- name: Prepare Package.swift
168-
uses: ./.github/actions/prepare-package.swift
169-
with:
170-
is-pr: ${{ github.event_name == 'pull_request' }}
180+
shell: bash
181+
run: |
182+
./scripts/prepare-package.sh \
183+
--package-file Package.swift \
184+
--is-pr "${{ github.event_name == 'pull_request' }}" \
185+
--change-path true
171186
- run: ./scripts/ci-select-xcode.sh 16.4
172187
- run: swift build
173188
working-directory: Samples/SPM-Dynamic
@@ -188,9 +203,12 @@ jobs:
188203
pattern: xcframework-${{github.sha}}-*
189204
merge-multiple: true
190205
- name: Prepare Package.swift
191-
uses: ./.github/actions/prepare-package.swift
192-
with:
193-
is-pr: ${{ github.event_name == 'pull_request' }}
206+
shell: bash
207+
run: |
208+
./scripts/prepare-package.sh \
209+
--package-file Package.swift \
210+
--is-pr "${{ github.event_name == 'pull_request' }}" \
211+
--change-path true
194212
- run: ./scripts/ci-select-xcode.sh 16.4
195213
- run: swift build
196214
- name: Run CI Diagnostics
@@ -210,9 +228,12 @@ jobs:
210228
pattern: xcframework-${{github.sha}}-*
211229
merge-multiple: true
212230
- name: Prepare Package.swift
213-
uses: ./.github/actions/prepare-package.swift
214-
with:
215-
is-pr: ${{ github.event_name == 'pull_request' }}
231+
shell: bash
232+
run: |
233+
./scripts/prepare-package.sh \
234+
--package-file Package.swift \
235+
--is-pr "${{ github.event_name == 'pull_request' }}" \
236+
--change-path true
216237
- run: ./scripts/ci-select-xcode.sh 16.4
217238
- run: set -o pipefail &&xcodebuild build -scheme visionOS-SPM -sdk xros -destination 'generic/platform=xros' | tee raw-build-output-spm-visionOS.log | xcbeautify
218239
working-directory: Samples/visionOS-SPM

.github/workflows/test.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- release/**
88

99
pull_request:
10+
types: [opened, synchronize, reopened, labeled]
1011

1112
# Concurrency configuration:
1213
# - We use workflow-specific concurrency groups to allow independent test runs across different workflows
@@ -20,6 +21,13 @@ concurrency:
2021
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2122

2223
jobs:
24+
ready-to-merge-gate:
25+
name: Ready-to-merge gate
26+
uses: ./.github/workflows/ready-to-merge-workflow.yml
27+
with:
28+
is-pr: ${{ github.event_name == 'pull_request' }}
29+
labels: ${{ toJson(github.event.pull_request.labels) }}
30+
2331
# This job detects if the PR contains changes that require running unit tests.
2432
# If yes, the job will output a flag that will be used by the next job to run the unit tests.
2533
# If no, the job will output a flag that will be used by the next job to skip running the unit tests.
@@ -28,6 +36,7 @@ jobs:
2836
files-changed:
2937
name: Detect File Changes
3038
runs-on: ubuntu-latest
39+
needs: ready-to-merge-gate
3140
# Map a step output to a job output
3241
outputs:
3342
run_unit_tests_for_prs: ${{ steps.changes.outputs.run_unit_tests_for_prs }}
@@ -96,15 +105,20 @@ jobs:
96105
distribution-tests:
97106
name: Distribution Tests
98107
runs-on: macos-15
108+
# Don't run this on release branches, cause the SPM Package.swift points to the unreleased versions.
109+
# Also, skip when PR changes don't require running tests to save CI time.
110+
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_unit_tests_for_prs == 'true')
99111
needs: files-changed
100112
steps:
101113
- uses: actions/checkout@v5
102114
- name: Prepare Package.swift
103-
uses: ./.github/actions/prepare-package.swift
104-
with:
105-
is-pr: ${{ github.event_name == 'pull_request' }}
106-
change-path: false
107-
remove-duplicate: true
115+
shell: bash
116+
run: |
117+
./scripts/prepare-package.sh \
118+
--package-file Package.swift \
119+
--is-pr "${{ github.event_name == 'pull_request' }}" \
120+
--remove-duplicate true \
121+
--change-path false
108122
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
109123
- run: set -o pipefail && NSUnbufferedIO=YES SKIP_BINARIES=1 xcodebuild test -scheme Sentry-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16 Pro' | tee raw-test-output-distribution.log | xcbeautify --preserve-unbeautified
110124
shell: sh

.github/workflows/testflight.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
branches:
55
- main
66
- v8.x
7-
- release/**
87

98
pull_request:
109
workflow_dispatch:

.github/workflows/ui-tests-critical.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- v8.x
77

88
pull_request:
9+
types: [opened, synchronize, reopened, labeled]
910

1011
# Concurrency configuration:
1112
# - We use workflow-specific concurrency groups to prevent multiple critical UI test runs,
@@ -19,9 +20,17 @@ concurrency:
1920
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2021

2122
jobs:
23+
ready-to-merge-gate:
24+
name: Ready-to-merge gate
25+
uses: ./.github/workflows/ready-to-merge-workflow.yml
26+
with:
27+
is-pr: ${{ github.event_name == 'pull_request' }}
28+
labels: ${{ toJson(github.event.pull_request.labels) }}
29+
2230
files-changed:
2331
name: Detect File Changes
2432
runs-on: ubuntu-latest
33+
needs: ready-to-merge-gate
2534
outputs:
2635
run_ui_tests_critical_for_prs: ${{ steps.changes.outputs.run_ui_tests_critical_for_prs }}
2736
steps:

.github/workflows/ui-tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- v8.x
77

88
pull_request:
9+
types: [opened, synchronize, reopened, labeled]
910

1011
# Concurrency configuration:
1112
# - We use workflow-specific concurrency groups to prevent multiple UI test runs on the same code,
@@ -19,9 +20,17 @@ concurrency:
1920
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2021

2122
jobs:
23+
ready-to-merge-gate:
24+
name: Ready-to-merge gate
25+
uses: ./.github/workflows/ready-to-merge-workflow.yml
26+
with:
27+
is-pr: ${{ github.event_name == 'pull_request' }}
28+
labels: ${{ toJson(github.event.pull_request.labels) }}
29+
2230
files-changed:
2331
name: Detect File Changes
2432
runs-on: ubuntu-latest
33+
needs: ready-to-merge-gate
2534
outputs:
2635
run_ui_tests_for_prs: ${{ steps.changes.outputs.run_ui_tests_for_prs }}
2736
steps:

0 commit comments

Comments
 (0)