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

Filter by extension

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: 14 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,28 @@ jobs:
name: swifttests
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
with:
enable_windows_checks: false
linux_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}, {\"swift_version\": \"5.10\"}]"
linux_env_vars: SWIFT_HOMOMORPHIC_ENCRYPTION_ENABLE_BENCHMARKING=1
linux_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}, {\"swift_version\": \"5.10\"}]"
linux_pre_build_command: "apt-get update && apt-get install -y libjemalloc-dev"
linux_build_command: >
swift test --configuration release;
for filename in $(find Snippets -name \*.swift); do
basename=$(basename "$filename" .swift)
swift run --configuration release ${basename}
done
windows_env_vars: SWIFT_HOMOMORPHIC_ENCRYPTION_ENABLE_BENCHMARKING=1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • TODO: make sure that works

windows_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}, {\"swift_version\": \"5.10\"}]"
# swift test --configuration release;
# $filenames = Get-ChildItem -Path Snippets\*.swift -Name -Recurse;
# $filenames = Get-ChildItem -Path Snippets\* -Include *.swift -Name -Recurse;
# ^-- didn't work
windows_build_command: >
swift test --configuration release;
$swiftFiles = Get-ChildItem -Path .\Snippets -Include *.swift -Recurse;
foreach ($file in $swiftFiles) {
$basename = [System.IO.Path]::GetFileNameWithoutExtension($file.FullName);
swift run --configuration release $basename;
}
pre-commit:
timeout-minutes: 1
runs-on: ubuntu-22.04
Expand Down
34 changes: 17 additions & 17 deletions Package.resolved

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

27 changes: 17 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,6 @@ let package = Package(
"HomomorphicEncryptionProtobuf",
"_TestUtilities",
], swiftSettings: executableSettings),
.testTarget(
name: "PIRGenerateDatabaseTests",
dependencies: ["PIRGenerateDatabase",
"_TestUtilities",
.product(name: "Numerics", package: "swift-numerics")], swiftSettings: executableSettings),
.testTarget(
name: "PIRProcessDatabaseTests",
dependencies: ["PIRProcessDatabase",
"_TestUtilities",
.product(name: "Numerics", package: "swift-numerics")], swiftSettings: executableSettings),
.testTarget(
name: "PrivateInformationRetrievalTests",
dependencies: [
Expand All @@ -245,6 +235,23 @@ let package = Package(
], swiftSettings: executableSettings),
])

// Workaround SwiftPM's attempt to link in executables which does not work on all
// platforms.
Comment on lines +238 to +239
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we come up with a different way to support these tests?
One option would be to split the executables into two parts: the library that will be imported to tests and a very minimal boilerplate main.swift that calls into the library.

Do we have other options?

#if !os(Windows)
package.targets.append(contentsOf: [
.testTarget(
name: "PIRGenerateDatabaseTests",
dependencies: ["PIRGenerateDatabase",
"_TestUtilities",
.product(name: "Numerics", package: "swift-numerics")], swiftSettings: executableSettings),
.testTarget(
name: "PIRProcessDatabaseTests",
dependencies: ["PIRProcessDatabase",
"_TestUtilities",
.product(name: "Numerics", package: "swift-numerics")], swiftSettings: executableSettings),
])
#endif

// MARK: - Benchmarks

var enableBenchmarking: Bool {
Expand Down
2 changes: 2 additions & 0 deletions Snippets/HomomorphicEncryption/BasicsSnippet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ precondition(decoded == [8, 5, 12, 12, 15, 0, 8, 5])
// plaintext to any observer. The observed value in this case is zero.
try sum -= sum
precondition(sum.isTransparent())

preconditionFailure()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark this with a TODO to remove it.

Loading