Skip to content

Raise minimum supported Swift version to 5.4 #1397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2022
Merged
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
26 changes: 4 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,11 @@ jobs:
matrix:
include:
- image: swift:5.6-focal
swift-test-flags: "--enable-test-discovery --sanitize=thread"
swift-test-flags: "--sanitize=thread"
- image: swift:5.5-focal
swift-test-flags: "--enable-test-discovery --sanitize=thread"
swift-test-flags: "--sanitize=thread"
- image: swift:5.4-focal
swift-test-flags: "--enable-test-discovery --sanitize=thread"
- image: swift:5.3-focal
swift-build-flags: "--enable-test-discovery"
swift-test-flags: "--enable-test-discovery"
- image: swift:5.2-bionic
swift-build-flags: "--enable-test-discovery"
swift-test-flags: "--enable-test-discovery"
swift-test-flags: "--sanitize=thread"
name: Build and Test on ${{ matrix.image }}
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -85,16 +79,6 @@ jobs:
MAX_ALLOCS_ALLOWED_unary_1k_ping_pong: 186000
MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_client: 193000
MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_server: 193000
- image: swift:5.3-focal
env:
MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_10_requests: 460000
MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_1_request: 190000
MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_10_small_requests: 110000
MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_1_small_request: 65000
MAX_ALLOCS_ALLOWED_embedded_server_unary_1k_rpcs_1_small_request: 61000
MAX_ALLOCS_ALLOWED_unary_1k_ping_pong: 187000
MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_client: 194000
MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_server: 194000
name: Performance Tests on ${{ matrix.image }}
runs-on: ubuntu-latest
container:
Expand All @@ -113,8 +97,6 @@ jobs:
- image: swift:5.6-focal
- image: swift:5.5-focal
- image: swift:5.4-focal
- image: swift:5.3-focal
- image: swift:5.2-bionic
name: Integration Tests on ${{ matrix.image }}
runs-on: ubuntu-latest
container:
Expand All @@ -129,7 +111,7 @@ jobs:
- name: Test without NIOSSL
# Skip tests on 5.6: https://bugs.swift.org/browse/SR-15955
if: ${{ matrix.image != 'swift:5.6-focal' }}
run: swift test --enable-test-discovery
run: swift test
env:
GRPC_NO_NIO_SSL: 1
timeout-minutes: 20
7 changes: 5 additions & 2 deletions FuzzTesting/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.4
/*
* Copyright 2021, gRPC Authors All rights reserved.
*
Expand All @@ -23,7 +23,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-nio.git", from: "2.27.0"),
],
targets: [
.target(
.executableTarget(
name: "ServerFuzzer",
dependencies: [
.product(name: "GRPC", package: "grpc-swift"),
Expand All @@ -35,6 +35,9 @@ let package = Package(
name: "EchoModel",
dependencies: [
.product(name: "GRPC", package: "grpc-swift"),
],
exclude: [
"echo.proto",
]
),
.target(
Expand Down
67 changes: 50 additions & 17 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.4
/*
* Copyright 2017, gRPC Authors All rights reserved.
*
Expand Down Expand Up @@ -149,11 +149,14 @@ extension Target {
]
)

static let protocGenGRPCSwift: Target = .target(
static let protocGenGRPCSwift: Target = .executableTarget(
name: "protoc-gen-grpc-swift",
dependencies: [
.protobuf,
.protobufPluginLibrary,
],
exclude: [
"README.md",
]
)

Expand All @@ -178,7 +181,10 @@ extension Target {
.logging,
].appending(
.nioSSL, if: includeNIOSSL
)
),
exclude: [
"Codegen/Normalization/normalization.proto",
]
)

static let interopTestModels: Target = .target(
Expand All @@ -187,6 +193,15 @@ extension Target {
.grpc,
.nio,
.protobuf,
],
exclude: [
"README.md",
"generate.sh",
"src/proto/grpc/testing/empty.proto",
"src/proto/grpc/testing/empty_service.proto",
"src/proto/grpc/testing/messages.proto",
"src/proto/grpc/testing/test.proto",
"unimplemented_call.patch",
]
)

Expand All @@ -204,7 +219,7 @@ extension Target {
)
)

static let interopTests: Target = .target(
static let interopTests: Target = .executableTarget(
name: "GRPCInteroperabilityTests",
dependencies: [
.grpc,
Expand All @@ -216,7 +231,7 @@ extension Target {
]
)

static let backoffInteropTest: Target = .target(
static let backoffInteropTest: Target = .executableTarget(
name: "GRPCConnectionBackoffInteropTest",
dependencies: [
.grpc,
Expand All @@ -225,10 +240,13 @@ extension Target {
.nioPosix,
.logging,
.argumentParser,
],
exclude: [
"README.md",
]
)

static let perfTests: Target = .target(
static let perfTests: Target = .executableTarget(
name: "GRPCPerformanceTests",
dependencies: [
.grpc,
Expand All @@ -243,7 +261,10 @@ extension Target {

static let grpcSampleData: Target = .target(
name: "GRPCSampleData",
dependencies: includeNIOSSL ? [.nioSSL] : []
dependencies: includeNIOSSL ? [.nioSSL] : [],
exclude: [
"bundle.p12",
]
)

static let echoModel: Target = .target(
Expand All @@ -253,7 +274,10 @@ extension Target {
.nio,
.protobuf,
],
path: "Sources/Examples/Echo/Model"
path: "Sources/Examples/Echo/Model",
exclude: [
"echo.proto",
]
)

static let echoImplementation: Target = .target(
Expand All @@ -268,7 +292,7 @@ extension Target {
path: "Sources/Examples/Echo/Implementation"
)

static let echo: Target = .target(
static let echo: Target = .executableTarget(
name: "Echo",
dependencies: [
.grpc,
Expand All @@ -292,10 +316,13 @@ extension Target {
.nio,
.protobuf,
],
path: "Sources/Examples/HelloWorld/Model"
path: "Sources/Examples/HelloWorld/Model",
exclude: [
"helloworld.proto",
]
)

static let helloWorldClient: Target = .target(
static let helloWorldClient: Target = .executableTarget(
name: "HelloWorldClient",
dependencies: [
.grpc,
Expand All @@ -307,7 +334,7 @@ extension Target {
path: "Sources/Examples/HelloWorld/Client"
)

static let helloWorldServer: Target = .target(
static let helloWorldServer: Target = .executableTarget(
name: "HelloWorldServer",
dependencies: [
.grpc,
Expand All @@ -326,10 +353,13 @@ extension Target {
.nio,
.protobuf,
],
path: "Sources/Examples/RouteGuide/Model"
path: "Sources/Examples/RouteGuide/Model",
exclude: [
"route_guide.proto",
]
)

static let routeGuideClient: Target = .target(
static let routeGuideClient: Target = .executableTarget(
name: "RouteGuideClient",
dependencies: [
.grpc,
Expand All @@ -341,7 +371,7 @@ extension Target {
path: "Sources/Examples/RouteGuide/Client"
)

static let routeGuideServer: Target = .target(
static let routeGuideServer: Target = .executableTarget(
name: "RouteGuideServer",
dependencies: [
.grpc,
Expand All @@ -354,7 +384,7 @@ extension Target {
path: "Sources/Examples/RouteGuide/Server"
)

static let packetCapture: Target = .target(
static let packetCapture: Target = .executableTarget(
name: "PacketCapture",
dependencies: [
.grpc,
Expand All @@ -365,7 +395,10 @@ extension Target {
.logging,
.argumentParser,
],
path: "Sources/Examples/PacketCapture"
path: "Sources/Examples/PacketCapture",
exclude: [
"README.md",
]
)
}

Expand Down
13 changes: 11 additions & 2 deletions Performance/QPSBenchmark/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.4
/*
* Copyright 2020, gRPC Authors All rights reserved.
*
Expand Down Expand Up @@ -38,7 +38,7 @@ let package = Package(
),
],
targets: [
.target(
.executableTarget(
name: "QPSBenchmark",
dependencies: [
.product(name: "GRPC", package: "grpc-swift"),
Expand All @@ -50,6 +50,15 @@ let package = Package(
.product(name: "Lifecycle", package: "swift-service-lifecycle"),
.product(name: "SwiftProtobuf", package: "SwiftProtobuf"),
.target(name: "BenchmarkUtils"),
],
exclude: [
"Model/benchmark_service.proto",
"Model/control.proto",
"Model/core_stats.proto",
"Model/messages.proto",
"Model/payloads.proto",
"Model/stats.proto",
"Model/worker_service.proto",
]
),
.target(
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ servers are described in [`docs/plugin.md`][docs-plugin].
gRPC Swift's platform support is identical to the [platform support of Swift
NIO][swift-nio-platforms].

Note that gRPC Swift uses NIO 2 and requires Swift to be version 5.2 or higher.
The earliest supported Swift version for gRPC Swift 1.8.x and newer is 5.4.
For 1.7.x and earlier the oldest supported Swift version is 5.2.

## Getting gRPC Swift

Expand Down
16 changes: 0 additions & 16 deletions Tests/LinuxMain.swift

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/build_podspecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def as_podspec(self):
podspec += indent + "s.homepage = 'https://www.grpc.io'\n"
podspec += indent + "s.authors = { 'The gRPC contributors' => \'[email protected]' }\n\n"

podspec += indent + "s.swift_version = '5.2'\n"
podspec += indent + "s.swift_version = '5.4'\n"
podspec += indent + "s.ios.deployment_target = '10.0'\n"
podspec += indent + "s.osx.deployment_target = '10.12'\n"
podspec += indent + "s.tvos.deployment_target = '10.0'\n"
Expand Down