Skip to content

Commit 68682eb

Browse files
committed
Migrate CI to use swiftlang / SwiftNIO common GitHub Actions.
Motivation: * Reduce duplication * Centralise boilerplate changes when new Swift versions are picked up. * Benefit from centralised work to add new linting / test infrastructure. Modifications: Changes of note: * Use soundness checks from swiftlang/github-workflows. * Retain bespoke license-checking code for .swift files as the gRPC header style is very different to most templates. Result: More test, linting, formatting coverage. More common CI with other Swift on Server projects.
1 parent f5b87e7 commit 68682eb

27 files changed

+347
-228
lines changed

.github/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
changelog:
2+
categories:
3+
- title: SemVer Major
4+
labels:
5+
- ⚠️ semver/major
6+
- title: SemVer Minor
7+
labels:
8+
- semver/minor
9+
- title: SemVer Patch
10+
labels:
11+
- semver/patch
12+
- title: Other Changes
13+
labels:
14+
- semver/none

.github/workflows/ci.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 8,20 * * *"
8+
9+
jobs:
10+
unit-tests:
11+
name: Unit tests
12+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
13+
with:
14+
linux_5_9_enabled: false
15+
linux_5_10_enabled: false
16+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
17+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
18+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

.github/workflows/pull_request.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
types: [opened, reopened, synchronize]
7+
8+
jobs:
9+
soundness:
10+
name: Soundness
11+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
12+
with:
13+
license_header_check_project_name: "gRPC"
14+
15+
grpc-soundness:
16+
name: Soundness
17+
uses: ./.github/workflows/soundness.yml
18+
19+
unit-tests:
20+
name: Unit tests
21+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
22+
with:
23+
linux_5_9_enabled: false
24+
linux_5_10_enabled: false
25+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
26+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
27+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
28+
29+
cxx-interop:
30+
name: Cxx interop
31+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
32+
with:
33+
linux_5_9_enabled: false
34+
linux_5_10_enabled: false
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, reopened, synchronize]
6+
7+
jobs:
8+
semver-label-check:
9+
name: Semantic version label check
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 1
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
- name: Check for Semantic Version label
18+
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main

.github/workflows/soundness.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Soundness
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
swift-license-check:
8+
name: Swift license headers check
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
with:
14+
persist-credentials: false
15+
- name: Mark the workspace as safe
16+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
17+
- name: Run license check
18+
run: |
19+
./dev/license-check.sh
20+
21+
check-generated-code:
22+
name: Check generated code
23+
runs-on: ubuntu-latest
24+
container:
25+
image: swift:latest
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
persist-credentials: false
31+
- name: Mark the workspace as safe
32+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
33+
- name: Install protoc
34+
run: apt update && apt install -y protobuf-compiler
35+
- name: Run soundness checks
36+
run: |
37+
./dev/check-generated-code.sh

.license_header_template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@@ Copyright YEARS, gRPC Authors All rights reserved.
2+
@@
3+
@@ Licensed under the Apache License, Version 2.0 (the "License");
4+
@@ you may not use this file except in compliance with the License.
5+
@@ You may obtain a copy of the License at
6+
@@
7+
@@ http://www.apache.org/licenses/LICENSE-2.0
8+
@@
9+
@@ Unless required by applicable law or agreed to in writing, software
10+
@@ distributed under the License is distributed on an "AS IS" BASIS,
11+
@@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
@@ See the License for the specific language governing permissions and
13+
@@ limitations under the License.

.licenseignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.gitignore
2+
**/.gitignore
3+
.licenseignore
4+
.gitattributes
5+
.git-blame-ignore-revs
6+
.gitmodules
7+
.mailfilter
8+
.mailmap
9+
.spi.yml
10+
.swift-format
11+
.editorconfig
12+
.github/*
13+
*.md
14+
*.txt
15+
*.yml
16+
*.yaml
17+
*.json
18+
Package.swift
19+
**/Package.swift
20+
Package@-*.swift
21+
**/Package@-*.swift
22+
Package.resolved
23+
**/Package.resolved
24+
Makefile
25+
*.modulemap
26+
**/*.modulemap
27+
**/*.docc/*
28+
*.xcprivacy
29+
**/*.xcprivacy
30+
*.symlink
31+
**/*.symlink
32+
Dockerfile
33+
**/Dockerfile
34+
Snippets/*
35+
dev/git.commit.template
36+
dev/version-bump.commit.template
37+
.unacceptablelanguageignore
38+
LICENSE
39+
**/*.swift
40+
dev/protos/**/*.proto

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ let dependencies: [Package.Dependency] = [
5454
let defaultSwiftSettings: [SwiftSetting] = [
5555
.swiftLanguageMode(.v6),
5656
.enableUpcomingFeature("ExistentialAny"),
57-
.enableUpcomingFeature("InternalImportsByDefault")
57+
.enableUpcomingFeature("InternalImportsByDefault"),
5858
]
5959

6060
let targets: [Target] = [
@@ -90,7 +90,7 @@ let targets: [Target] = [
9090
dependencies: [
9191
.target(name: "GRPCInterceptors"),
9292
.product(name: "GRPCCore", package: "grpc-swift"),
93-
.product(name: "Tracing", package: "swift-distributed-tracing")
93+
.product(name: "Tracing", package: "swift-distributed-tracing"),
9494
]
9595
),
9696

@@ -111,7 +111,7 @@ let targets: [Target] = [
111111
.product(name: "GRPCCore", package: "grpc-swift"),
112112
.product(name: "GRPCInProcessTransport", package: "grpc-swift"),
113113
]
114-
)
114+
),
115115
]
116116

117117
let package = Package(

Sources/GRPCHealthService/Generated/health.grpc.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
// The canonical version of this proto can be found at
16-
// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
16+
// https://github.com/grpc/grpc-proto/blob/0b30c8c05277ab78ec72e77c9cbf66a26684673d/grpc/health/v1/health.proto
1717

1818
// DO NOT EDIT.
1919
// swift-format-ignore-file
@@ -70,7 +70,7 @@ extension GRPCCore.ServiceDescriptor {
7070

7171
/// Health is gRPC's mechanism for checking whether a server is able to handle
7272
/// RPCs. Its semantics are documented in
73-
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
73+
/// https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/doc/health-checking.md.
7474
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
7575
package protocol Grpc_Health_V1_Health_StreamingServiceProtocol: GRPCCore.RegistrableRPCService {
7676
/// Check gets the health of the specified service. If the requested service
@@ -86,7 +86,7 @@ package protocol Grpc_Health_V1_Health_StreamingServiceProtocol: GRPCCore.Regist
8686
request: GRPCCore.StreamingServerRequest<Grpc_Health_V1_HealthCheckRequest>,
8787
context: GRPCCore.ServerContext
8888
) async throws -> GRPCCore.StreamingServerResponse<Grpc_Health_V1_HealthCheckResponse>
89-
89+
9090
/// Performs a watch for the serving status of the requested service.
9191
/// The server will immediately send back a message indicating the current
9292
/// serving status. It will then subsequently send a new message whenever
@@ -140,7 +140,7 @@ extension Grpc_Health_V1_Health.StreamingServiceProtocol {
140140

141141
/// Health is gRPC's mechanism for checking whether a server is able to handle
142142
/// RPCs. Its semantics are documented in
143-
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
143+
/// https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/doc/health-checking.md.
144144
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
145145
package protocol Grpc_Health_V1_Health_ServiceProtocol: Grpc_Health_V1_Health.StreamingServiceProtocol {
146146
/// Check gets the health of the specified service. If the requested service
@@ -156,7 +156,7 @@ package protocol Grpc_Health_V1_Health_ServiceProtocol: Grpc_Health_V1_Health.St
156156
request: GRPCCore.ServerRequest<Grpc_Health_V1_HealthCheckRequest>,
157157
context: GRPCCore.ServerContext
158158
) async throws -> GRPCCore.ServerResponse<Grpc_Health_V1_HealthCheckResponse>
159-
159+
160160
/// Performs a watch for the serving status of the requested service.
161161
/// The server will immediately send back a message indicating the current
162162
/// serving status. It will then subsequently send a new message whenever
@@ -191,7 +191,7 @@ extension Grpc_Health_V1_Health.ServiceProtocol {
191191
)
192192
return GRPCCore.StreamingServerResponse(single: response)
193193
}
194-
194+
195195
package func watch(
196196
request: GRPCCore.StreamingServerRequest<Grpc_Health_V1_HealthCheckRequest>,
197197
context: GRPCCore.ServerContext
@@ -206,7 +206,7 @@ extension Grpc_Health_V1_Health.ServiceProtocol {
206206

207207
/// Health is gRPC's mechanism for checking whether a server is able to handle
208208
/// RPCs. Its semantics are documented in
209-
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
209+
/// https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/doc/health-checking.md.
210210
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
211211
package protocol Grpc_Health_V1_Health_ClientProtocol: Sendable {
212212
/// Check gets the health of the specified service. If the requested service
@@ -225,7 +225,7 @@ package protocol Grpc_Health_V1_Health_ClientProtocol: Sendable {
225225
options: GRPCCore.CallOptions,
226226
_ body: @Sendable @escaping (GRPCCore.ClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
227227
) async throws -> R where R: Sendable
228-
228+
229229
/// Performs a watch for the serving status of the requested service.
230230
/// The server will immediately send back a message indicating the current
231231
/// serving status. It will then subsequently send a new message whenever
@@ -267,7 +267,7 @@ extension Grpc_Health_V1_Health.ClientProtocol {
267267
body
268268
)
269269
}
270-
270+
271271
package func watch<R>(
272272
request: GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>,
273273
options: GRPCCore.CallOptions = .defaults,
@@ -312,7 +312,7 @@ extension Grpc_Health_V1_Health.ClientProtocol {
312312
handleResponse
313313
)
314314
}
315-
315+
316316
/// Performs a watch for the serving status of the requested service.
317317
/// The server will immediately send back a message indicating the current
318318
/// serving status. It will then subsequently send a new message whenever
@@ -348,15 +348,15 @@ extension Grpc_Health_V1_Health.ClientProtocol {
348348

349349
/// Health is gRPC's mechanism for checking whether a server is able to handle
350350
/// RPCs. Its semantics are documented in
351-
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
351+
/// https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/doc/health-checking.md.
352352
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
353353
package struct Grpc_Health_V1_Health_Client: Grpc_Health_V1_Health.ClientProtocol {
354354
private let client: GRPCCore.GRPCClient
355-
355+
356356
package init(wrapping client: GRPCCore.GRPCClient) {
357357
self.client = client
358358
}
359-
359+
360360
/// Check gets the health of the specified service. If the requested service
361361
/// is unknown, the call will fail with status NOT_FOUND. If the caller does
362362
/// not specify a service name, the server should respond with its overall
@@ -384,7 +384,7 @@ package struct Grpc_Health_V1_Health_Client: Grpc_Health_V1_Health.ClientProtoco
384384
handler: body
385385
)
386386
}
387-
387+
388388
/// Performs a watch for the serving status of the requested service.
389389
/// The server will immediately send back a message indicating the current
390390
/// serving status. It will then subsequently send a new message whenever
@@ -416,4 +416,4 @@ package struct Grpc_Health_V1_Health_Client: Grpc_Health_V1_Health.ClientProtoco
416416
handler: body
417417
)
418418
}
419-
}
419+
}

0 commit comments

Comments
 (0)