Skip to content

Commit be528ee

Browse files
committed
Merge remote-tracking branch 'upstream/main' into jpnurmi/mono-interop
2 parents df48cc1 + 1655116 commit be528ee

File tree

170 files changed

+17817
-23641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+17817
-23641
lines changed

.cursor/rules/file-filters.mdc

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
---
2+
description: |
3+
Apply this rule when making changes to the project's file hierarchy or structure, including:
4+
- Creating new directories (e.g., new test directories, sample projects, utility folders)
5+
- Renaming or moving existing directories
6+
- Restructuring code organization (e.g., splitting modules, reorganizing tests)
7+
- Adding new top-level folders or reorganizing subdirectories
8+
- Reviewing PRs that involve file/folder creation, deletion, or reorganization
9+
10+
This rule ensures that .github/file-filters.yml stays synchronized with the project structure
11+
so that GitHub Actions workflows are properly triggered by relevant file changes. Missing
12+
patterns can cause CI workflows to not run when they should, leading to undetected issues.
13+
alwaysApply: false
14+
---
15+
16+
# File Filters Configuration Rules
17+
18+
## Core Principles
19+
20+
### 1. Complete Coverage
21+
Every directory that contains code, tests, or configuration affecting CI should be included in at least one filter pattern.
22+
23+
### 2. Logical Grouping
24+
Files should be grouped with workflows they logically affect:
25+
- **Source changes** → Build and test workflows
26+
- **Test changes** → Test workflows
27+
- **Configuration changes** → Relevant validation workflows
28+
- **Script changes** → Workflows using those scripts
29+
30+
### 3. Hierarchy Awareness
31+
Use glob patterns (`**`) to capture all subdirectories and their contents recursively.
32+
33+
## Verification Checklist
34+
35+
Before submitting a PR that affects project structure:
36+
37+
- [ ] List all new or renamed directories
38+
- [ ] Check if each directory appears in `.github/file-filters.yml`
39+
- [ ] Add missing patterns to appropriate filter groups
40+
- [ ] Verify glob patterns match intended files
41+
- [ ] Test locally using the `dorny/paths-filter` action logic
42+
43+
## Pattern Best Practices
44+
45+
### Use Glob Patterns for Depth
46+
✅ **Good:**
47+
```yaml
48+
- "Sources/**" # Matches all files under Sources/
49+
- "Tests/**" # Matches all files under Tests/
50+
- "SentryTestUtils/**" # Matches all files under SentryTestUtils/
51+
```
52+
53+
❌ **Bad:**
54+
```yaml
55+
- "Sources/*" # Only matches one level deep
56+
- "Tests/" # Doesn't match files, only directory
57+
```
58+
59+
### Be Specific When Needed
60+
✅ **Good:**
61+
```yaml
62+
- "Samples/iOS-Cocoapods-*/**" # Matches multiple specific samples
63+
- "**/*.xctestplan" # Matches test plans anywhere
64+
- "scripts/ci-*.sh" # Matches CI scripts specifically
65+
```
66+
67+
❌ **Bad:**
68+
```yaml
69+
- "Samples/**" # Too broad, includes unrelated samples
70+
- "**/*" # Matches everything (defeats the purpose)
71+
```
72+
73+
### Include Related Configuration
74+
Always include configuration files that affect the workflow:
75+
76+
```yaml
77+
run_unit_tests_for_prs: &run_unit_tests_for_prs
78+
- "Sources/**"
79+
- "Tests/**"
80+
81+
# GH Actions - Changes to these workflows should trigger tests
82+
- ".github/workflows/test.yml"
83+
- ".github/file-filters.yml"
84+
85+
# Project files - Changes to project structure should trigger tests
86+
- "Sentry.xcodeproj/**"
87+
- "Sentry.xcworkspace/**"
88+
```
89+
90+
## Common Patterns by Workflow Type
91+
92+
These are complete, production-ready filter patterns for common workflow types. Use these as templates when adding new workflows or ensuring proper coverage.
93+
94+
### Unit Test Workflows
95+
**Required coverage:** All test-related directories (Tests, SentryTestUtils, SentryTestUtilsDynamic, SentryTestUtilsTests) must be included to ensure changes to test infrastructure trigger test runs.
96+
```yaml
97+
run_unit_tests_for_prs: &run_unit_tests_for_prs
98+
- "Sources/**" # Source code changes
99+
- "Tests/**" # Test changes
100+
- "SentryTestUtils/**" # Test utility changes
101+
- "SentryTestUtilsDynamic/**" # Dynamic test utilities
102+
- "SentryTestUtilsTests/**" # Test utility tests
103+
- ".github/workflows/test.yml" # Workflow definition
104+
- ".github/file-filters.yml" # Filter changes
105+
- "scripts/ci-*.sh" # CI scripts
106+
- "test-server/**" # Test infrastructure
107+
- "**/*.xctestplan" # Test plans
108+
- "Plans/**" # Test plan directory
109+
- "Sentry.xcodeproj/**" # Project structure
110+
```
111+
112+
### Lint Workflows
113+
```yaml
114+
run_lint_swift_formatting_for_prs: &run_lint_swift_formatting_for_prs
115+
- "**/*.swift" # All Swift files
116+
- ".github/workflows/lint-swift-formatting.yml"
117+
- ".github/file-filters.yml"
118+
- ".swiftlint.yml" # Linter config
119+
- "scripts/.swiftlint-version" # Version config
120+
```
121+
122+
### Build Workflows
123+
```yaml
124+
run_build_for_prs: &run_build_for_prs
125+
- "Sources/**" # Source code
126+
- "Samples/**" # Sample projects
127+
- ".github/workflows/build.yml"
128+
- ".github/file-filters.yml"
129+
- "Sentry.xcodeproj/**" # Project files
130+
- "Package*.swift" # SPM config
131+
- "scripts/sentry-xcodebuild.sh" # Build script
132+
```
133+
134+
## Troubleshooting
135+
136+
### PR Not Triggering Expected Workflows
137+
138+
1. **Check the paths-filter configuration** in the workflow:
139+
```yaml
140+
- uses: dorny/paths-filter@v3
141+
id: changes
142+
with:
143+
filters: .github/file-filters.yml
144+
```
145+
146+
2. **Verify the filter name** matches between `file-filters.yml` and workflow:
147+
```yaml
148+
# In file-filters.yml
149+
run_unit_tests_for_prs: &run_unit_tests_for_prs
150+
151+
# In workflow
152+
if: steps.changes.outputs.run_unit_tests_for_prs == 'true'
153+
```
154+
155+
3. **Test the pattern locally** using glob matching tools
156+
157+
### Pattern Not Matching Expected Files
158+
159+
Common issues:
160+
- Missing `**` for recursive matching
161+
- Using `*` instead of `**` for deep directories
162+
- Forgetting to include file extensions
163+
- Pattern too broad or too narrow
164+
165+
## Maintenance Guidelines
166+
167+
### Regular Audits
168+
Periodically review file-filters.yml to:
169+
- Remove patterns for deleted directories
170+
- Update patterns for renamed directories
171+
- Ensure new directories are covered
172+
- Verify patterns match current structure
173+
174+
### Documentation
175+
Each filter group should have comments explaining:
176+
- What the filter is for
177+
- Which workflow uses it
178+
- Special considerations
179+
180+
### Testing Changes
181+
When updating file-filters.yml:
182+
1. Create a test PR with changes in the new pattern
183+
2. Verify the expected workflow triggers
184+
3. Check that unrelated workflows don't trigger
185+
4. Review the GitHub Actions logs for filter results
186+
187+
## Error Prevention
188+
189+
### Pre-Merge Checklist for Structural Changes
190+
191+
When reviewing PRs that add/move/rename directories:
192+
193+
1. **Identify all affected directories**
194+
```bash
195+
gh pr view --json files --jq '.files[].path' | cut -d'/' -f1-2 | sort | uniq
196+
```
197+
198+
2. **Check each directory against file-filters.yml**
199+
```bash
200+
grep -r "DirectoryName" .github/file-filters.yml
201+
```
202+
203+
3. **Add missing patterns** to appropriate filter groups
204+
205+
4. **Verify the changes** trigger correct workflows
206+
207+
### Automated Detection (Future Enhancement)
208+
209+
Consider adding a script that:
210+
- Detects new top-level directories
211+
- Checks if they appear in file-filters.yml
212+
- Warns in PR if missing coverage
213+
214+
Example location: `.github/workflows/check-file-filters.yml`

.github/file-filters.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ run_unit_tests_for_prs: &run_unit_tests_for_prs
2424
- "Tests/**"
2525
- "SentryTestUtils/**"
2626
- "SentryTestUtilsDynamic/**"
27+
- "SentryTestUtilsTests/**"
2728

2829
# GH Actions
2930
- ".github/workflows/test.yml"

.github/workflows/build-xcframework-variant-slices.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ jobs:
5656
build-xcframework-variant-slices:
5757
name: ${{matrix.sdk}}
5858

59-
# We must compile this on an arm64 runner, cause it's required for visionOS. macos-14 uses arm64.
59+
# We must compile this on an arm64 runner, cause it's required for visionOS. macos-15 uses arm64.
6060
# To see the available runners see https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories.
61-
runs-on: macos-14
61+
runs-on: macos-15
6262

6363
strategy:
6464
matrix:
@@ -67,12 +67,8 @@ jobs:
6767
steps:
6868
- uses: actions/checkout@v5
6969

70-
# We have to compile on Xcode 15.2 because compiling on Xcode 15.4 fails with
71-
# Data+SentryTracing.swift:21:62: error: 'ReadingOptions' aliases 'Foundation.ReadingOptions'
72-
# and cannot be used here because C++ types from imported module 'Foundation' do not support
73-
# library evolution; this is an error in the Swift 6 language mode
74-
# We also can't use Xcode 16.x because validating the XCFramework then fails with Xcode 15.x.
75-
- run: ./scripts/ci-select-xcode.sh 15.2
70+
# We use Xcode 16.4 for building XCFrameworks as it's the standard version available on macos-15 runners.
71+
- run: ./scripts/ci-select-xcode.sh 16.4
7672
shell: bash
7773

7874
- name: Get version
@@ -109,7 +105,7 @@ jobs:
109105
env:
110106
VERSION: ${{ env.VERSION }}
111107
run: |
112-
./scripts/ci-select-xcode.sh 15.2
108+
./scripts/ci-select-xcode.sh 16.4
113109
make bump-version TO=$VERSION
114110
115111
- name: Build ${{inputs.name}}${{inputs.suffix}} XCFramework slice for ${{matrix.sdk}}

.github/workflows/release.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106

107107
validate-xcframework:
108108
name: Validate XCFramework
109-
runs-on: macos-14
109+
runs-on: macos-15
110110
needs: [files-changed, assemble-xcframework-variant]
111111
# Run the job only for PRs with related changes or non-PR events.
112112
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
@@ -120,7 +120,7 @@ jobs:
120120
with:
121121
pattern: xcframework-${{github.sha}}-sentry-swiftui
122122
path: Carthage/
123-
- run: ./scripts/ci-select-xcode.sh 15.4
123+
- run: ./scripts/ci-select-xcode.sh 16.4
124124
- run: make build-xcframework-sample
125125
- name: Run CI Diagnostics
126126
if: failure()
@@ -131,7 +131,7 @@ jobs:
131131
# See https://github.qkg1.topmunity/t/github-sha-isnt-the-value-expected/17903/17906.
132132
validate-spm:
133133
name: Validate SPM Static
134-
runs-on: macos-14
134+
runs-on: macos-15
135135
needs: [files-changed, assemble-xcframework-variant]
136136
# Run the job only for PRs with related changes or non-PR events.
137137
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
@@ -145,6 +145,7 @@ jobs:
145145
uses: ./.github/actions/prepare-package.swift
146146
with:
147147
is-pr: ${{ github.event_name == 'pull_request' }}
148+
- run: ./scripts/ci-select-xcode.sh 16.4
148149
- run: swift build
149150
working-directory: Samples/macOS-SPM-CommandLine
150151
- name: Run CI Diagnostics
@@ -153,7 +154,7 @@ jobs:
153154

154155
validate-spm-dynamic:
155156
name: Validate SPM Dynamic
156-
runs-on: macos-14
157+
runs-on: macos-15
157158
needs: [files-changed, assemble-xcframework-variant]
158159
# Run the job only for PRs with related changes or non-PR events.
159160
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
@@ -167,6 +168,7 @@ jobs:
167168
uses: ./.github/actions/prepare-package.swift
168169
with:
169170
is-pr: ${{ github.event_name == 'pull_request' }}
171+
- run: ./scripts/ci-select-xcode.sh 16.4
170172
- run: swift build
171173
working-directory: Samples/SPM-Dynamic
172174
- name: Run CI Diagnostics
@@ -175,7 +177,7 @@ jobs:
175177

176178
swift-build:
177179
name: Build Swift Static
178-
runs-on: macos-14
180+
runs-on: macos-15
179181
needs: [files-changed, assemble-xcframework-variant]
180182
# Run the job only for PRs with related changes or non-PR events.
181183
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
@@ -189,14 +191,15 @@ jobs:
189191
uses: ./.github/actions/prepare-package.swift
190192
with:
191193
is-pr: ${{ github.event_name == 'pull_request' }}
194+
- run: ./scripts/ci-select-xcode.sh 16.4
192195
- run: swift build
193196
- name: Run CI Diagnostics
194197
if: failure()
195198
run: ./scripts/ci-diagnostics.sh
196199

197200
validate-spm-visionos:
198201
name: Validate SPM Static visionOS
199-
runs-on: macos-14
202+
runs-on: macos-15
200203
needs: [files-changed, assemble-xcframework-variant]
201204
# Run the job only for PRs with related changes or non-PR events.
202205
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
@@ -210,6 +213,7 @@ jobs:
210213
uses: ./.github/actions/prepare-package.swift
211214
with:
212215
is-pr: ${{ github.event_name == 'pull_request' }}
216+
- run: ./scripts/ci-select-xcode.sh 16.4
213217
- run: set -o pipefail &&xcodebuild build -scheme visionOS-SPM -sdk xros -destination 'generic/platform=xros' | tee raw-build-output-spm-visionOS.log | xcbeautify
214218
working-directory: Samples/visionOS-SPM
215219
- name: Run CI Diagnostics
@@ -288,15 +292,16 @@ jobs:
288292
job_release:
289293
runs-on: ubuntu-latest
290294
name: "Release New Version"
291-
needs: [
292-
files-changed,
293-
validate-xcframework,
294-
validate-spm,
295-
validate-spm-dynamic,
296-
swift-build,
297-
duplication-tests,
298-
app-metrics,
299-
]
295+
needs:
296+
[
297+
files-changed,
298+
validate-xcframework,
299+
validate-spm,
300+
validate-spm-dynamic,
301+
swift-build,
302+
duplication-tests,
303+
app-metrics,
304+
]
300305
if: ${{ github.event_name == 'workflow_dispatch' }}
301306
steps:
302307
- name: Get auth token

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ jobs:
258258
create_device: true
259259
device: "iPhone 17 Pro"
260260
scheme: "Sentry"
261-
# This runner seems to be slower than the others, so we give it more time because otherwise it frequently times out. The build step often alone takes 10 minutes and also booting the simulator takes a while.
262-
timeout: 30
261+
# This runner seems to be slower than the others, so we give it more time because otherwise it frequently times out. The build step often alone takes 20 minutes and also booting the simulator takes a while.
262+
timeout: 40
263263

264264
# We don't run the unit tests on macOS 13 cause we run them on all on GH actions available iOS versions.
265265
# The chance of missing a bug solely on tvOS 16 that doesn't occur on iOS, macOS 12 or macOS 14 is minimal.
@@ -424,7 +424,7 @@ jobs:
424424
--result-bundle results.xcresult
425425
426426
- name: Publish Test Report
427-
uses: mikepenz/action-junit-report@5b7ee5a21e8674b695313d769f3cbdfd5d4d53a4 # v6.0.0
427+
uses: mikepenz/action-junit-report@e08919a3b1fb83a78393dfb775a9c37f17d8eea6 # v6.0.1
428428
if: always()
429429
with:
430430
report_paths: "build/reports/junit.xml"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ jobs:
161161
fi
162162
163163
- name: Publish Test Report
164-
uses: mikepenz/action-junit-report@5b7ee5a21e8674b695313d769f3cbdfd5d4d53a4 # v6.0.0
164+
uses: mikepenz/action-junit-report@e08919a3b1fb83a78393dfb775a9c37f17d8eea6 # v6.0.1
165165
if: always()
166166
with:
167167
report_paths: build/reports/*junit.xml

0 commit comments

Comments
 (0)