Skip to content

Commit fba1c14

Browse files
Merge pull request #4020 from SwiftPackageIndex/swift-6.3-base-image
Update to Swift 6.3 base image
2 parents 67fb0fd + e71c3d7 commit fba1c14

39 files changed

Lines changed: 279 additions & 160 deletions

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.gitlab.com/finestructure/spi-base:2.1.1
1+
FROM registry.gitlab.com/finestructure/spi-base:2.2.0
22

33
# Install SPM build dependencies
44
RUN apt-get update && apt-get install -y curl git make unzip \

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
name: Test
3030
runs-on: ubuntu-latest
3131
container:
32-
image: registry.gitlab.com/finestructure/spi-base:2.1.1
32+
image: registry.gitlab.com/finestructure/spi-base:2.2.0
3333
options: --privileged
3434
steps:
3535
- name: GH Runner bug workaround
@@ -160,7 +160,7 @@ jobs:
160160
name: Release build
161161
runs-on: ubuntu-latest
162162
container:
163-
image: registry.gitlab.com/finestructure/spi-base:2.1.1
163+
image: registry.gitlab.com/finestructure/spi-base:2.2.0
164164
options: --privileged
165165
steps:
166166
- name: GH Runner bug workaround

.github/workflows/query-performance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
continue-on-error: true
3030
container:
31-
image: registry.gitlab.com/finestructure/spi-base:2.1.1
31+
image: registry.gitlab.com/finestructure/spi-base:2.2.0
3232
steps:
3333
- name: Checkout code
3434
uses: actions/checkout@v6

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# ================================
1919
# Build image
2020
# ================================
21-
FROM registry.gitlab.com/finestructure/spi-base:2.1.1 AS build
21+
FROM registry.gitlab.com/finestructure/spi-base:2.2.0 AS build
2222

2323
# Set up a build area
2424
WORKDIR /build
@@ -65,7 +65,7 @@ RUN [ -d /build/Resources ] && { mv /build/Resources ./Resources && chmod -R a-w
6565
# ================================
6666
# Run image
6767
# ================================
68-
FROM registry.gitlab.com/finestructure/spi-base:2.1.1
68+
FROM registry.gitlab.com/finestructure/spi-base:2.2.0
6969

7070
# NB sas 2022-09-23: We're not using a dedicated `vapor` user to run the executable, because it
7171
# makes managing the data in the checkouts volume difficult. See

LOCAL_DEVELOPMENT_SETUP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ The trickiest part of this is to ensure the test or app container can connect to
238238
So, in order to run the tests in a Linux container run:
239239

240240
```
241-
docker run --rm -v "$PWD":/host -w /host --add-host=host.docker.internal:host-gateway registry.gitlab.com/finestructure/spi-base:2.1.1 swift test
241+
docker run --rm -v "$PWD":/host -w /host --add-host=host.docker.internal:host-gateway registry.gitlab.com/finestructure/spi-base:2.2.0 swift test
242242
```
243243

244244
Make sure you use the most recent `spi-base` image. You can find the latest image name in the `test-docker` target, which also provides a convenient way to run all all tests in a docker container.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ test-docker:
8989
@# run tests inside a docker container
9090
docker run --rm -v "$(PWD)":/host -w /host \
9191
--add-host=host.docker.internal:host-gateway \
92-
registry.gitlab.com/finestructure/spi-base:2.1.1 \
92+
registry.gitlab.com/finestructure/spi-base:2.2.0 \
9393
make test
9494

9595
test-e2e: db-reset reconcile ingest analyze

Package.resolved

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

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let package = Package(
3232
.package(url: "https://github.com/SwiftPackageIndex/Plot.git", branch: "main"),
3333
.package(url: "https://github.com/SwiftPackageIndex/CanonicalPackageURL.git", from: "1.0.0"),
3434
.package(url: "https://github.com/SwiftPackageIndex/DependencyResolution.git", from: "1.1.2"),
35-
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "1.10.0"),
35+
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "1.12.0"),
3636
.package(url: "https://github.com/SwiftPackageIndex/SemanticVersion.git", from: "0.3.0"),
3737
.package(url: "https://github.com/SwiftPackageIndex/ShellOut.git", from: "3.3.0"),
3838
.package(url: "https://github.com/SwiftPackageIndex/swift-package-manager.git", branch: "release/6.1"),

Sources/App/Commands/Ingestion.swift

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -264,37 +264,76 @@ enum Ingestion {
264264
}
265265
}
266266

267+
#if compiler(>=6.3.1)
268+
#error("Check if we can revert commit a5ec37ecd58d4971b5a04305d39fe7666b69bde3 `Convert Ingestion.fetchMetadata` (2026-04-08)")
269+
#endif
267270

268271
static func fetchMetadata(package: Package, owner: String, repository: String) async throws(Github.Error) -> (Github.Metadata, Github.License?, Github.Readme?) {
269272
@Dependency(\.environment) var environment
270273
if environment.shouldFail(failureMode: .fetchMetadataFailed) {
271274
throw Github.Error.requestFailed(.internalServerError)
272275
}
273276

274-
// Need to pull in github functions individually, because otherwise the `async let` will trigger a
275-
// concurrency error if github gets used more than once:
276-
// Sending 'github' into async let risks causing data races between async let uses and local uses
277-
@Dependency(\.github.fetchMetadata) var fetchMetadata
278-
@Dependency(\.github.fetchLicense) var fetchLicense
279-
@Dependency(\.github.fetchReadme) var fetchReadme
277+
// 2026-04-08, sas: revert this back to `async let` instead of `withThrowingTaskGroup` when a fix for https://github.com/swiftlang/swift/issues/75501 is available.
278+
do {
279+
enum FetchResult: Sendable {
280+
case metadata(Github.Metadata)
281+
case license(Github.License?)
282+
case readme(Github.Readme?)
283+
}
280284

281-
async let metadata = try await fetchMetadata(owner, repository)
282-
async let license = await fetchLicense(owner, repository)
283-
async let readme = await fetchReadme(owner, repository)
285+
let results = try await withThrowingTaskGroup(of: FetchResult.self) { group in
286+
group.addTask {
287+
@Dependency(\.github.fetchMetadata) var fetchMetadata
288+
return .metadata(try await fetchMetadata(owner, repository))
289+
}
290+
group.addTask {
291+
@Dependency(\.github.fetchLicense) var fetchLicense
292+
return .license(await fetchLicense(owner, repository))
293+
}
294+
group.addTask {
295+
@Dependency(\.github.fetchReadme) var fetchReadme
296+
return .readme(await fetchReadme(owner, repository))
297+
}
284298

285-
do {
286-
return try await (metadata, license, readme)
299+
var results = [FetchResult]()
300+
for try await result in group {
301+
results.append(result)
302+
}
303+
return results
304+
}
305+
306+
var metadata: Github.Metadata?
307+
var license: Github.License?
308+
var readme: Github.Readme?
309+
for res in results {
310+
switch res {
311+
case .metadata(let data):
312+
metadata = data
313+
case .license(let data):
314+
license = data
315+
case .readme(let data):
316+
readme = data
317+
}
318+
}
319+
320+
guard let metadata = metadata else {
321+
struct MetadataIsNil: Swift.Error { }
322+
throw Github.Error.unexpectedError(MetadataIsNil())
323+
}
324+
325+
return (metadata, license, readme)
287326
} catch let error as Github.Error {
288327
throw error
289328
} catch {
290329
// This whole do { ... } catch { ... } should be unnecessary - it's a workaround for
291330
// https://github.com/swiftlang/swift/issues/76169
292-
assert(false, "Unexpected error type: \(type(of: error))")
293-
// We need to throw _something_ here (we should never hit this codepath though)
331+
assert(false, "Unexpected error type: \(type(of: error))")
332+
// We need to throw _something_ here (we should never hit this codepath though)
294333
throw Github.Error.unexpectedError(error)
295-
// We could theoretically avoid this whole second catch and just do
296-
// error as! GithubError
297-
// but let's play it safe and not risk a server crash, unlikely as it may be.
334+
// We could theoretically avoid this whole second catch and just do
335+
// error as! GithubError
336+
// but let's play it safe and not risk a server crash, unlikely as it may be.
298337
}
299338
}
300339

Sources/App/Core/Social.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ enum Social {
107107
throw Error.invalidMessage
108108
}
109109
// Ignore errors from here for now to keep concurrency simpler
110-
async let _ = try? await httpClient.mastodonPost(message: message)
110+
try? await httpClient.mastodonPost(message: message)
111111
}
112112

113113
static func postToFirehose(client: Client,

0 commit comments

Comments
 (0)