Skip to content

Commit 4c4c09c

Browse files
committed
Migrate to common GitHub Actions
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. * Remove scripts which are no longer needed. * Move scripts to `scripts/` directory in-line with most other Swift on Server repositories. Result: More test, linting, formatting coverage. More common CI with other Swift on Server projects.
1 parent fec325b commit 4c4c09c

24 files changed

+276
-199
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 & 54 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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"
19+
20+
integration-tests:
21+
name: Integration Tests
22+
# Workaround https://github.com/nektos/act/issues/1875
23+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
24+
with:
25+
name: "Integration tests"
26+
matrix_linux_5_9_enabled: false
27+
matrix_linux_5_10_enabled: false
28+
matrix_linux_command: "./dev/integration_tests.sh"

.github/workflows/pull_request.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
swift-license-check:
16+
name: Swift License Header Check
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
persist-credentials: false
23+
- name: Mark the workspace as safe
24+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
25+
- name: Run license check
26+
run: |
27+
./scripts/license-check.sh
28+
29+
unit-tests:
30+
name: Unit Tests
31+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
32+
with:
33+
linux_5_9_enabled: false
34+
linux_5_10_enabled: false
35+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
36+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
37+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
38+
39+
integration-tests:
40+
name: Integration Tests
41+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
42+
with:
43+
name: "Integration Tests"
44+
matrix_linux_5_9_enabled: false
45+
matrix_linux_5_10_enabled: false
46+
matrix_linux_command: "./dev/integration_tests.sh"
47+
48+
cxx-interop:
49+
name: Cxx Interop
50+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
51+
with:
52+
linux_5_9_enabled: false
53+
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

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

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let dependencies: [Package.Dependency] = [
6666
let defaultSwiftSettings: [SwiftSetting] = [
6767
.swiftLanguageMode(.v6),
6868
.enableUpcomingFeature("ExistentialAny"),
69-
.enableUpcomingFeature("InternalImportsByDefault")
69+
.enableUpcomingFeature("InternalImportsByDefault"),
7070
]
7171

7272
let targets: [Target] = [
@@ -87,7 +87,7 @@ let targets: [Target] = [
8787
.product(name: "NIOCore", package: "swift-nio"),
8888
.product(name: "NIOHTTP2", package: "swift-nio-http2"),
8989
.product(name: "NIOExtras", package: "swift-nio-extras"),
90-
.target(name: "CGRPCZlib")
90+
.target(name: "CGRPCZlib"),
9191
],
9292
swiftSettings: defaultSwiftSettings
9393
),
@@ -140,7 +140,7 @@ let targets: [Target] = [
140140
.product(name: "X509", package: "swift-certificates"),
141141
.product(name: "NIOSSL", package: "swift-nio-ssl"),
142142
]
143-
)
143+
),
144144
]
145145

146146
let package = Package(

Sources/GRPCNIOTransportCore/Client/Connection/ClientConnectionHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ package enum ClientConnectionEvent: Sendable {
4747
/// 2. Closing the connection if it is idle (has no open streams) for a configured amount of time.
4848
/// 3. Forwarding lifecycle events to the next handler.
4949
///
50-
/// Some of the behaviours are described in [gRFC A8](https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md).
50+
/// Some of the behaviours are described in [gRFC A8](https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A8-client-side-keepalive.md).
5151
package final class ClientConnectionHandler: ChannelInboundHandler, ChannelOutboundHandler {
5252
package typealias InboundIn = HTTP2Frame
5353
package typealias InboundOut = ClientConnectionEvent

Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/RoundRobinLoadBalancer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ extension RoundRobinLoadBalancer {
529529
mutating func updateState(_ newState: ConnectivityState) -> Bool {
530530
// The transition from transient failure to connecting is ignored.
531531
//
532-
// See: https://github.com/grpc/grpc/blob/master/doc/load-balancing.md
532+
// See: https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/load-balancing.md
533533
if case .transientFailure = self.state, newState == .connecting {
534534
return false
535535
}
@@ -733,7 +733,7 @@ extension RoundRobinLoadBalancer {
733733

734734
extension ConnectivityState {
735735
static func aggregate(_ states: some Collection<ConnectivityState>) -> ConnectivityState {
736-
// See https://github.com/grpc/grpc/blob/master/doc/load-balancing.md
736+
// See https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/load-balancing.md
737737

738738
// If any one subchannel is in READY state, the channel's state is READY.
739739
if states.contains(where: { $0 == .ready }) {

0 commit comments

Comments
 (0)