Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/pipeline

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ jobs:
--user root \
-v $PWD:/swift/swift-unidoc \
-w /swift/swift-unidoc \
-e SWIFT_INSTALLATION=/usr \
swift:6.0.1-noble \
/bin/bash .github/pipeline
/bin/bash Scripts/TestAll

macos:
runs-on: macos-15
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ node_modules/
Package.swift.json

Snippets/_Crashes/*
TestPackages/*.bson
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ let package:Package = .init(
.package(url: "https://github.com/tayloraswift/swift-ip", .upToNextMinor(
from: "0.1.2")),
.package(url: "https://github.com/tayloraswift/swift-mongodb", .upToNextMinor(
from: "0.25.1")),
from: "0.27.0")),
.package(url: "https://github.com/tayloraswift/swift-unixtime", .upToNextMinor(
from: "0.1.5")),

Expand Down Expand Up @@ -442,8 +442,6 @@ let package:Package = .init(
dependencies: [
.target(name: "SymbolGraphs"),
.target(name: "System_"),

.product(name: "Testing_", package: "swift-grammar"),
]),

.target(name: "TopologicalSorting"),
Expand Down Expand Up @@ -565,6 +563,12 @@ let package:Package = .init(
.target(name: "UnidocUI"),
]),

.target(name: "UnidocTesting",
dependencies: [
.target(name: "UnidocDB"),
.product(name: "MongoTesting", package: "swift-mongodb"),
]),

.target(name: "UnidocUI",
dependencies: [
.target(name: "GitHubAPI"),
Expand Down Expand Up @@ -653,7 +657,7 @@ let package:Package = .init(
.executableTarget(name: "SymbolGraphBuilderTests",
dependencies: [
.target(name: "SymbolGraphBuilder"),
.target(name: "SymbolGraphTesting"),
.product(name: "Testing_", package: "swift-grammar"),
]),

.executableTarget(name: "SymbolGraphCompilerTests",
Expand Down Expand Up @@ -711,21 +715,19 @@ let package:Package = .init(
.product(name: "Testing_", package: "swift-grammar"),
]),

.executableTarget(name: "UnidocDBTests",
.testTarget(name: "UnidocDBTests",
dependencies: [
.target(name: "UnidocDB"),
.target(name: "UnidocTesting"),
.target(name: "GitHubClient"),
.target(name: "SymbolGraphBuilder"),
.target(name: "SymbolGraphTesting"),
.product(name: "MongoTesting", package: "swift-mongodb"),
]),

.executableTarget(name: "UnidocQueryTests",
.testTarget(name: "UnidocQueryTests",
dependencies: [
.target(name: "UnidocQueries"),
.target(name: "SymbolGraphBuilder"),
.target(name: "UnidocTesting"),
.target(name: "SymbolGraphTesting"),
.product(name: "MongoTesting", package: "swift-mongodb"),
]),

.executableTarget(name: "UnidocRecordsTests",
Expand Down
16 changes: 16 additions & 0 deletions Scripts/GeneratePackageSymbolGraphs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

swift --version

.build/release/ssgc -u $SWIFT_INSTALLATION \
-n swift \
-o TestPackages/swift.bson

.build/release/ssgc -u $SWIFT_INSTALLATION \
-p TestPackages/swift-test \
-o TestPackages/swift-test.bson

.build/release/ssgc -u $SWIFT_INSTALLATION \
-p TestPackages/swift-malibu \
-o TestPackages/swift-malibu.bson
File renamed without changes.
26 changes: 26 additions & 0 deletions Scripts/TestAll
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

export UNIDOC_ENABLE_INDEXSTORE=1

swift --version
swift build -c release \
--explicit-target-dependency-import-check=error \
-Xcxx -I/usr/lib/swift \
-Xcxx -I/usr/lib/swift/Block \
--build-tests

Scripts/GenerateTestSymbolGraphs
Scripts/GeneratePackageSymbolGraphs

swift test -c release \
--explicit-target-dependency-import-check=error \
-Xcxx -I/usr/lib/swift \
-Xcxx -I/usr/lib/swift/Block \
--no-parallel \
--skip-build \
--disable-testable-imports

for f in .build/release/*Tests; do
$f
done
19 changes: 9 additions & 10 deletions Sources/SymbolGraphBuilderTests/Main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import MarkdownRendering
@_spi(testable)
import SymbolGraphBuilder
import SymbolGraphs
import SymbolGraphTesting
import System_
import Testing_

Expand Down Expand Up @@ -67,7 +66,7 @@ enum Main:TestMain, TestBattery
try workspace.build(special: .swift, with: toolchain)
})
{
docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}

#if canImport(IndexStoreDB)
Expand Down Expand Up @@ -147,7 +146,7 @@ enum Main:TestMain, TestBattery
tests.expect(docs.graph.cultures.count >? 0)
tests.expect(docs.graph.decls.nodes.count >? 0)

docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}
}

Expand Down Expand Up @@ -240,7 +239,7 @@ enum Main:TestMain, TestBattery
tests.expect(docs.graph.cultures.count >? 0)
tests.expect(docs.graph.decls.nodes.count >? 0)

docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}

// https://github.com/tayloraswift/swift-unidoc/issues/211
Expand All @@ -267,7 +266,7 @@ enum Main:TestMain, TestBattery
tests.expect(docs.graph.cultures.count >? 0)
tests.expect(docs.graph.decls.nodes.count >? 0)

docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}
#endif

Expand All @@ -293,7 +292,7 @@ enum Main:TestMain, TestBattery
tests.expect(docs.graph.cultures.count >? 0)
tests.expect(docs.graph.decls.nodes.count >? 0)

docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}

// The swift-async-dns-resolver repo includes a git submodule, so we should be able
Expand All @@ -318,7 +317,7 @@ enum Main:TestMain, TestBattery
tests.expect(docs.graph.cultures.count >? 0)
tests.expect(docs.graph.decls.nodes.count >? 0)

docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}

// SwiftSyntax is a morbidly obese package. If we can handle SwiftSyntax,
Expand All @@ -340,7 +339,7 @@ enum Main:TestMain, TestBattery
tests.expect(docs.graph.cultures.count >? 0)
tests.expect(docs.graph.decls.nodes.count >? 0)

docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}

// The swift-snapshot-testing package at 1.17.0 has a dependency on SwiftSyntax with
Expand All @@ -366,7 +365,7 @@ enum Main:TestMain, TestBattery
tests.expect(docs.graph.cultures.count >? 0)
tests.expect(docs.graph.decls.nodes.count >? 0)

docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}
#endif

Expand Down Expand Up @@ -408,7 +407,7 @@ enum Main:TestMain, TestBattery
tests.expect(docs.graph.articles.nodes.count >? 0)
tests.expect(docs.graph.decls.nodes.count ==? 0)

docs.roundtrip(for: tests, in: workspace.location)
docs.roundtrip(for: tests)
}
}
}
29 changes: 29 additions & 0 deletions Sources/SymbolGraphBuilderTests/SymbolGraphObject (ext).swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import BSON
import SymbolGraphs
import Testing_

extension SymbolGraphObject<Void>
{
func roundtrip(for tests:TestGroup)
{
guard
let tests:TestGroup = tests / "roundtripping"
else
{
return
}

let encoded:BSON.Document = .init(encoding: self)

guard
let decoded:Self = tests.do({ try .init(buffer: encoded.bytes) })
else
{
return
}

tests.expect(decoded.metadata ==? self.metadata)
// We don’t want to dump the entire symbol graph to the terminal!
tests.expect(true: decoded.graph == self.graph)
}
}
31 changes: 11 additions & 20 deletions Sources/SymbolGraphTesting/SymbolGraphObject (ext).swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import SemanticVersions
import SymbolGraphs
import Symbols
import System_
import Testing_
import Testing

extension SymbolGraphObject<Void>
{
public static
func load(swift:SwiftVersion,
public
static func load(swift:SwiftVersion,
in directory:FilePath.Directory) throws -> Self
{
let filename:String = "swift@\(swift.version).bson"
return try .init(buffer: try (directory / filename).read())
}

public static
func load(package:Symbol.Package,
public
static func load(package:Symbol.Package,
at version:AnyVersion? = nil,
in directory:FilePath.Directory) throws -> Self
{
Expand All @@ -39,22 +39,13 @@ extension SymbolGraphObject<Void>
extension SymbolGraphObject<Void>
{
public
func roundtrip(for tests:TestGroup, in directory:FilePath.Directory)
func roundtrip(in directory:FilePath.Directory) throws
{
tests.do
{
let file:FilePath = try self.save(in: directory)
let file:FilePath = try self.save(in: directory)
let decoded:Self = try .init(buffer: try file.read())

if let tests:TestGroup = tests / "roundtripping",
let decoded:Self = tests.do(
{
try .init(buffer: try file.read())
})
{
tests.expect(decoded.metadata ==? self.metadata)
// We don’t want to dump the entire symbol graph to the terminal!
tests.expect(true: decoded.graph == self.graph)
}
}
#expect(decoded.metadata == self.metadata)
// We don’t want to dump the entire symbol graph to the terminal!
#expect(decoded.graph == self.graph)
}
}
8 changes: 0 additions & 8 deletions Sources/UnidocAPI/Unidoc.Shoot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ extension Unidoc
}
}
}
extension Unidoc.Shoot
{
public
init(path:borrowing ArraySlice<String>, hash:FNV24? = nil)
{
self.init(stem: .init(path: path), hash: hash)
}
}
extension Unidoc.Shoot:Comparable
{
@inlinable public static
Expand Down
2 changes: 1 addition & 1 deletion Sources/UnidocDB/Activity/Unidoc.DB.DocsFeed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension Unidoc.DB.DocsFeed:Mongo.CollectionModel
let indexes:[Mongo.CollectionIndex] =
[
.init("Volume",
collation: SimpleCollation.spec,
collation: .simple,
unique: true)
{
$0[Activity<Unidoc.Edition>[.volume]] = (+)
Expand Down
6 changes: 2 additions & 4 deletions Sources/UnidocDB/Building/Unidoc.DB.PendingBuilds.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ extension Unidoc.DB.PendingBuilds
name:Symbol.PackageAtRef,
priority:Int32 = 0) async throws -> Unidoc.PendingBuild
{
let (pendingBuild, _):(Unidoc.PendingBuild, Bool) = try await self.modify(
upserting: id,
returning: .new)
let (pendingBuild, _):(Unidoc.PendingBuild, Bool) = try await self.upsert(id: id)
{
let now:UnixMillisecond = .now()

Expand Down Expand Up @@ -241,7 +239,7 @@ extension Unidoc.DB.PendingBuilds
func updateBuild(id:Unidoc.Edition,
entered stage:Unidoc.BuildStage) async throws -> Unidoc.PendingBuild?
{
try await self.modify(existing: id, returning: .new)
try await self.modify(id: id)
{
$0[.set] { $0[Unidoc.PendingBuild[.stage]] = stage }
}
Expand Down
Loading
Loading