Skip to content

Commit 9ce129b

Browse files
authored
Use Swift 6.2 + Dependency updates (#370)
1 parent f656e2b commit 9ce129b

File tree

8 files changed

+65
-77
lines changed

8 files changed

+65
-77
lines changed

.github/workflows/deploy-all-lambdas.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
deploy-lambdas:
1010
runs-on: ubuntu-latest
11-
container: swift:6.1-amazonlinux2
11+
container: swift:6.2-amazonlinux2
1212

1313
env:
1414
AWS_DEFAULT_REGION: eu-west-1

.github/workflows/deploy-penny.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
runs-on: ubuntu-latest
1313

14-
container: swift:6.1-noble
14+
container: swift:6.2-noble
1515

1616
steps:
1717
- name: Checkout

.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ================================
22
# Build image
33
# ================================
4-
FROM swift:6.1-noble as build
4+
FROM swift:6.2-noble as build
55

66
ARG SWIFT_CONFIGURATION
77
ARG EXEC_NAME

Package.resolved

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:6.1
1+
// swift-tools-version:6.2
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -29,13 +29,9 @@ let package = Package(
2929
.package(url: "https://github.com/soto-project/soto-core.git", from: "7.3.0"),
3030
/// Not-released area:
3131
.package(url: "https://github.com/swiftlang/swift-evolution-metadata-extractor.git", from: "0.1.0"),
32-
.package(url: "https://github.com/apple/swift-markdown.git", from: "0.5.0"),
33-
.package(
34-
url: "https://github.com/swift-server/swift-aws-lambda-runtime.git",
35-
/// Last commit on main as of this code change; V2
36-
revision: "c7df9bcd8af279c70f991f5d53e48d73d3e6821a"
37-
),
38-
.package(url: "https://github.com/swift-server/swift-aws-lambda-events.git", from: "1.0.0"),
32+
.package(url: "https://github.com/swiftlang/swift-markdown.git", from: "0.7.1"),
33+
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "2.0.0-beta.3"),
34+
.package(url: "https://github.com/swift-server/swift-aws-lambda-events.git", from: "1.2.1"),
3935
],
4036
targets: [
4137
.executableTarget(
@@ -54,7 +50,7 @@ let package = Package(
5450
.target(name: "Shared"),
5551
.target(name: "Models"),
5652
],
57-
swiftSettings: targetsSwiftSettings
53+
swiftSettings: upcomingFeaturesSwiftSettings
5854
),
5955
.lambdaTarget(
6056
name: "Users",
@@ -122,10 +118,11 @@ let package = Package(
122118
.product(name: "SotoSecretsManager", package: "soto"),
123119
.product(name: "SotoCore", package: "soto-core"),
124120
.product(name: "Logging", package: "swift-log"),
121+
.product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"),
125122
.target(name: "Shared"),
126123
],
127124
path: "./Lambdas/LambdasShared",
128-
swiftSettings: targetsSwiftSettings
125+
swiftSettings: upcomingFeaturesSwiftSettings
129126
),
130127
.target(
131128
name: "GitHubAPI",
@@ -145,14 +142,14 @@ let package = Package(
145142
.copy("openapi-generator-config.yaml"),
146143
.copy("openapi.yaml"),
147144
],
148-
swiftSettings: targetsSwiftSettings
145+
swiftSettings: upcomingFeaturesSwiftSettings
149146
),
150147
.target(
151148
name: "Models",
152149
dependencies: [
153150
.product(name: "DiscordModels", package: "DiscordBM")
154151
],
155-
swiftSettings: targetsSwiftSettings
152+
swiftSettings: upcomingFeaturesSwiftSettings
156153
),
157154
.target(
158155
name: "Shared",
@@ -163,7 +160,7 @@ let package = Package(
163160
.product(name: "DiscordBM", package: "DiscordBM"),
164161
.target(name: "Models"),
165162
],
166-
swiftSettings: targetsSwiftSettings
163+
swiftSettings: upcomingFeaturesSwiftSettings
167164
),
168165
.target(
169166
name: "Rendering",
@@ -175,7 +172,7 @@ let package = Package(
175172
.product(name: "LeafKit", package: "leaf-kit"),
176173
.target(name: "Shared"),
177174
],
178-
swiftSettings: targetsSwiftSettings
175+
swiftSettings: upcomingFeaturesSwiftSettings
179176
),
180177
.testTarget(
181178
name: "PennyTests",
@@ -202,12 +199,12 @@ let package = Package(
202199
.target(name: "Penny"),
203200
.target(name: "GHHooksLambda"),
204201
],
205-
swiftSettings: testsSwiftSettings
202+
swiftSettings: upcomingFeaturesSwiftSettings
206203
),
207204
]
208205
)
209206

210-
/// Bug alert! Don't make these constants, or they won't take effect!
207+
/// Bug alert! Don't make this a constant, or it won't take effect!
211208
/// https://github.com/apple/swift-package-manager/issues/6597
212209
var upcomingFeaturesSwiftSettings: [SwiftSetting] {
213210
[
@@ -218,20 +215,6 @@ var upcomingFeaturesSwiftSettings: [SwiftSetting] {
218215
]
219216
}
220217

221-
var targetsSwiftSettings: [SwiftSetting] {
222-
upcomingFeaturesSwiftSettings + [
223-
/// https://github.com/apple/swift/issues/67214
224-
.unsafeFlags(
225-
["-Xllvm", "-vectorize-slp=false"],
226-
.when(platforms: [.linux], configuration: .release)
227-
)
228-
]
229-
}
230-
231-
var testsSwiftSettings: [SwiftSetting] {
232-
upcomingFeaturesSwiftSettings
233-
}
234-
235218
extension PackageDescription.Target {
236219
@MainActor
237220
static func lambdaTarget(
@@ -249,7 +232,7 @@ extension PackageDescription.Target {
249232
.target(name: "Models"),
250233
] + additionalDependencies,
251234
path: "./Lambdas/\(name)",
252-
swiftSettings: targetsSwiftSettings
235+
swiftSettings: upcomingFeaturesSwiftSettings
253236
)
254237
}
255238
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Penny is a Swift bot that works for the [Vapor](https://vapor.codes) community.
2929
</a>
3030
<a href="https://swift.org">
3131
<img
32-
src="https://design.vapor.codes/images/swift61up.svg"
33-
alt="Swift 6.1+"
32+
src="https://design.vapor.codes/images/swift62up.svg"
33+
alt="Swift 6.2+"
3434
>
3535
</a>
3636
</p>
@@ -63,7 +63,7 @@ The related labels are:
6363
* `semver-noop`
6464
* `release`
6565
* `prerelease`
66-
* `no-release-needed`
66+
* `no-release-needed`
6767

6868
Some other notes:
6969
* `semver-major` and `release` are of limited use for automatic releases. Penny won't do a whole major release by itself since those are rare and they can be risky to do.

Tests/PennyTests/Tests/+SwiftTesting.swift

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,37 @@ func expectMultilineStringsEqual(
1212
) {
1313
let expression1 = expression1.trimmingSuffix(while: \.isNewline)
1414
let expression2 = expression2.trimmingSuffix(while: \.isNewline)
15-
if expression1 != expression2 {
16-
/// Not using `whereSeparator: \.isNewline` so it doesn't match non `\n` characters.
17-
let lines1 =
18-
expression1
19-
.split(separator: "\n", omittingEmptySubsequences: false)
20-
.map { $0.trimmingSuffix(while: \.isWhitespace) }
21-
let lines2 =
22-
expression2
23-
.split(separator: "\n", omittingEmptySubsequences: false)
24-
.map { $0.trimmingSuffix(while: \.isWhitespace) }
2515

26-
if lines1.count == lines2.count {
27-
for (idx, (line1, line2)) in zip(lines1, lines2).enumerated() {
28-
if line1 != line2 {
29-
Issue.record(
30-
"""
31-
Not equal at line \(idx + 1):
32-
Got: \(line1.debugDescription)
33-
Expected: \(line2.debugDescription)
34-
""",
35-
sourceLocation: sourceLocation
36-
)
37-
}
38-
}
39-
} else {
40-
#expect(expression1 == expression2, sourceLocation: sourceLocation)
16+
/// Short-circuit if the lines are completely equal.
17+
if expression1 == expression2 {
18+
return
19+
}
20+
21+
/// Not using `whereSeparator: \.isNewline` so it doesn't match non `\n` characters.
22+
let lines1 =
23+
expression1
24+
.split(separator: "\n", omittingEmptySubsequences: false)
25+
.map { $0.trimmingSuffix(while: \.isWhitespace) }
26+
let lines2 =
27+
expression2
28+
.split(separator: "\n", omittingEmptySubsequences: false)
29+
.map { $0.trimmingSuffix(while: \.isWhitespace) }
30+
31+
guard lines1.count == lines2.count else {
32+
#expect(expression1 == expression2, sourceLocation: sourceLocation)
33+
return
34+
}
35+
36+
for (idx, (line1, line2)) in zip(lines1, lines2).enumerated() {
37+
if line1 != line2 {
38+
Issue.record(
39+
"""
40+
Not equal at line \(idx + 1):
41+
Got: \(line1.debugDescription)
42+
Expected: \(line2.debugDescription)
43+
""",
44+
sourceLocation: sourceLocation
45+
)
4146
}
4247
}
4348
}

0 commit comments

Comments
 (0)