Skip to content

Commit 139db8b

Browse files
authored
ci: Check Package.swift differences on CI (#5854)
* Set default C language to compiler default * Bump GCC C version to GNU11 * Use GNU17 * Remove GCC_C_LANGUAGE_STANDARD * Restore xcconfig changes * Update changelog * Update tests to check building with both package files * Only delete newer package files * ci: Lint Package.swift differences on CI * Update job name * Rename job to `Check` instead of `Lint` * Update trigger path in check-package-diff workflow to match package file naming convention * Add error message if check fails * Update message * Remove change in Changelog
1 parent 59fc426 commit 139db8b

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# We want to ensure that the Package.swift and [email protected] are in sync.
2+
3+
name: Check Package.swift Diff
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
10+
pull_request:
11+
paths:
12+
- ".github/workflows/check-package-diff.yml"
13+
- "Package*.swift"
14+
- "Makefile"
15+
- "Utils/expected_package_diff.patch"
16+
17+
jobs:
18+
check:
19+
name: Check Package.swift Diff
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Check Package.swift Diff
24+
run: make check-package-diff

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,5 @@ Sentry-Dynamic-WithARM64e.xcframework*
104104
SentrySwiftUI.xcframework*
105105
Sentry-WithoutUIKitOrAppKit.xcframework*
106106
Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework*
107+
108+
current_package_diff.patch

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,18 @@ xcode-ci:
183183
xcodegen --spec Samples/watchOS-Swift/watchOS-Swift.yml
184184
xcodegen --spec TestSamples/SwiftUITestSample/SwiftUITestSample.yml
185185
xcodegen --spec TestSamples/SwiftUICrashTest/SwiftUICrashTest.yml
186+
187+
.PHONY: check-package-diff update-package-diff
188+
# Diff will return an error if the files are different, so we need to ignore it with `|| true`.
189+
check-package-diff:
190+
diff Package.swift [email protected] > current_package_diff.patch || true
191+
@if diff ./Utils/expected_package_diff.patch current_package_diff.patch > /dev/null 2>&1; then \
192+
echo "--> Package diff check passed - no changes detected"; \
193+
else \
194+
echo "--> Package diff check failed - changes detected! Make sure to run \"make update-package-diff\" to update the expected diff."; \
195+
exit 1; \
196+
fi
197+
198+
# Diff will return an error if the files are different, so we need to ignore it with `|| true`.
199+
update-package-diff:
200+
diff Package.swift [email protected] > ./Utils/expected_package_diff.patch || true

Utils/expected_package_diff.patch

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
1,2c1,5
2+
< // swift-tools-version:5.3
3+
< #if canImport(Darwin)
4+
---
5+
> // swift-tools-version:5.9
6+
> // This Package.swift for Swift 5.9 (and newer) fixes an issue on Xcode 26 when linking `SentrySwiftUI`.
7+
> // Don't remove this comment.
8+
>
9+
> #if canImport(Darwin)
10+
15d17
11+
< .library(name: "Sentry-Dynamic-WithARM64e", targets: ["Sentry-Dynamic-WithARM64e"]),
12+
39a42,44
13+
> swiftSettings: [
14+
> .interoperabilityMode(.Cxx, .when(platforms: [.visionOS]))
15+
> ],
16+
53c58
17+
< if let env = env, String(cString: env, encoding: .utf8) == "1" {
18+
---
19+
> if let env = env, String(cString: env) == "1" {
20+
84a90
21+
> publicHeadersPath: "",
22+
100c106
23+
< platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4)],
24+
---
25+
> platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4), .visionOS(.v1)],

0 commit comments

Comments
 (0)