Skip to content

Commit 664f39f

Browse files
committed
Begin adopting SwiftTesting to improve test and runtime stability
This includes the use Swift6 toolchain for Swift 5 testing, and dropping support for Xcode 15.4. This is acceptable because Xcode 15 is no longer supported by Apple, therefore it is no longer supported by us.
1 parent 57dc83b commit 664f39f

111 files changed

Lines changed: 3172 additions & 2594 deletions

File tree

Some content is hidden

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

.github/actions/setup-swift/action.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ runs:
2525
echo "Using Xcode ${xcode_version} for Swift ${{ inputs.swift-version }}"
2626
echo "DEVELOPER_DIR=${developer_dir}" >> $GITHUB_ENV
2727
echo "developer_dir=${developer_dir}" >> $GITHUB_OUTPUT
28+
29+
swift_arguments=$(yq ".swift[] | select(.version == \"${{inputs.swift-version}}\") | .swift_arguments" "${{inputs.version-manifest}}")
30+
if [[ -n "$swift_arguments" ]]; then
31+
echo "Requires the use of \"${swift_arguments}\" Swift arguments"
32+
echo "SWIFT_ARGUMENTS=${swift_arguments}" >> $GITHUB_ENV
33+
echo "swift_arguments=${swift_arguments}" >> $GITHUB_OUTPUT
34+
else
35+
echo "SWIFT_ARGUMENTS=" >> $GITHUB_ENV
36+
echo "swift_arguments=" >> $GITHUB_OUTPUT
37+
fi
38+
2839
exit 0
2940
fi
3041
done

.github/actions/setup-swift/versions.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
swift:
2+
# Swift 5.10 mode within the 6.x toolchain, since Xcode 15.4 is no longer supported by Apple on the App Store
23
- version: "5.10"
4+
swift_arguments: "-Xswiftc -swift-version -Xswiftc 5"
35
xcode_versions:
4-
- "15.4"
6+
- "16.0"
57
- version: "6.0"
68
xcode_versions:
79
- "16.0"

.github/workflows/documentation-ghpages.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ jobs:
4949
--output-path "docs/$VERSION" \
5050
--include-extended-types \
5151
--symbol-graph-minimum-access-level public \
52-
--experimental-skip-synthesized-symbols \
5352
--enable-experimental-combined-documentation \
54-
--enable-experimental-mentioned-in \
5553
--enable-experimental-external-link-support \
5654
--enable-experimental-overloaded-symbol-presentation \
5755
$TARGET_LIST

.github/workflows/tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ jobs:
180180
matrix:
181181
include:
182182
- swift_version: "5.10"
183-
os: macos-14
183+
os: macos-15
184184
- swift_version: "6.0"
185185
os: macos-15
186186
- swift_version: "6.1"
@@ -204,11 +204,11 @@ jobs:
204204
- name: Build
205205
run: |
206206
set -o pipefail
207-
swift build --build-tests --verbose 2>&1 | tee -a .build/ci-logs/${LOG_NAME}-build.log | xcbeautify $XCBEAUTIFY_ARGS
207+
swift build --build-tests $SWIFT_ARGUMENTS --verbose 2>&1 | tee -a .build/ci-logs/${LOG_NAME}-build.log | xcbeautify $XCBEAUTIFY_ARGS
208208
- name: Test
209209
run: |
210210
set -o pipefail
211-
swift test --verbose 2>&1 | tee -a .build/ci-logs/${LOG_NAME}-test.log | xcbeautify $XCBEAUTIFY_ARGS
211+
swift test $SWIFT_ARGUMENTS --verbose 2>&1 | tee -a .build/ci-logs/${LOG_NAME}-test.log | xcbeautify $XCBEAUTIFY_ARGS
212212
- name: Upload Logs
213213
if: failure()
214214
uses: actions/upload-artifact@v4

.spi.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ builder:
88
- OktaIdxAuth
99
- BrowserSignin
1010
custom_documentation_parameters:
11-
- "--enable-experimental-combined-documentation"
12-
- "--enable-experimental-mentioned-in"
13-
- "--experimental-skip-synthesized-symbols"
1411
- "--enable-experimental-external-link-support"

.swift-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"fileScopedDeclarationPrivacy" : {
33
"accessLevel" : "private"
44
},
5+
"indentBlankLines": false,
56
"indentConditionalCompilationBlocks" : true,
67
"indentSwitchCaseLabels" : false,
78
"indentation" : {

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ var package = Package(
9595
resources: [.copy("MockResponses")],
9696
swiftSettings: .testTarget),
9797
],
98-
swiftLanguageModes: [.v6]
98+
swiftLanguageModes: [.v6, .v5]
9999
)
100100

101101
#if canImport(UIKit) || canImport(AppKit)

Package@swift-5.10.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extension Array<SwiftSetting> {
1010
[
1111
.enableUpcomingFeature("ExistentialAny"),
1212
.enableUpcomingFeature("ForwardTrailingClosures"),
13+
.enableExperimentalFeature("SwiftTesting"),
1314
]
1415
}
1516

Sources/AuthFoundation/JWT/Internal/DefaultJWKValidator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
import Foundation
1414

1515
struct DefaultJWKValidator: JWKValidator {
16-
func validate(token: JWT, using keySet: JWKS) throws -> Bool {
16+
func validate(token: JWT, using keySet: JWKS) throws {
1717
guard let key = keySet[token.header.keyId] else {
1818
throw JWTError.invalidKey
1919
}
2020

2121
#if canImport(CommonCrypto)
22-
return try key.verify(token: token)
22+
try key.verify(token: token)
2323
#else
2424
throw JWTError.signatureVerificationUnavailable
2525
#endif

Sources/AuthFoundation/JWT/Internal/JWK+Extensions.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ extension JWK {
8787
attributes as NSDictionary,
8888
&errorRef)
8989
else {
90-
let error = errorRef?.takeRetainedValue()
91-
let desc = error != nil ? CFErrorCopyDescription(error) : nil
92-
let code = error != nil ? CFErrorGetCode(error) : 0
93-
throw JWTError.cannotCreateKey(code: OSStatus(code),
94-
description: desc as String?)
90+
if let error = errorRef?.takeRetainedValue() {
91+
let desc = CFErrorCopyDescription(error)
92+
throw JWTError.cannotCreateKey(code: OSStatus(CFErrorGetCode(error)),
93+
description: desc as String?)
94+
} else {
95+
throw JWTError.cannotCreateKey(code: 0, description: nil)
96+
}
9597
}
9698

9799
return publicKey
@@ -110,7 +112,7 @@ extension JWK {
110112
let addStatus = SecItemAdd(addAttributes as CFDictionary, persistKey)
111113
guard addStatus == errSecSuccess || addStatus == errSecDuplicateItem else {
112114
throw JWTError.cannotCreateKey(code: addStatus,
113-
description: nil)
115+
description: nil)
114116
}
115117

116118
let copyAttributes: [CFString: Any] = [
@@ -126,7 +128,7 @@ extension JWK {
126128

127129
guard let publicKey = keyRef else {
128130
throw JWTError.cannotCreateKey(code: copyStatus,
129-
description: nil)
131+
description: nil)
130132
}
131133

132134
// swiftlint:disable force_cast

0 commit comments

Comments
 (0)