Skip to content

Commit 3f145d1

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. * Define a gRPC-specific soundness check which retains bespoke license-checking code for .swift files as the gRPC header style is very different to most templates and checks that generated code is up-to-date. Result: More test, linting, formatting coverage. More common CI with other Swift on Server projects.
1 parent 54227cb commit 3f145d1

File tree

47 files changed

+389
-251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+389
-251
lines changed

Diff for: .github/release.yml

+14
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

Diff for: .github/workflows/ci.yaml

-82
This file was deleted.

Diff for: .github/workflows/main.yml

+28
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"

Diff for: .github/workflows/pull_request.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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: gRPC-specific Soundness
17+
runs-on: ubuntu-latest
18+
container:
19+
image: swift:6.0-noble
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
persist-credentials: false
25+
- name: Mark the workspace as safe
26+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
27+
- name: Install protoc
28+
run: apt update && apt install -y protobuf-compiler
29+
- name: Run soundness checks
30+
run: |
31+
./dev/soundness.sh
32+
33+
unit-tests:
34+
name: Unit Tests
35+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
36+
with:
37+
linux_5_9_enabled: false
38+
linux_5_10_enabled: false
39+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
40+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
41+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
42+
43+
integration-tests:
44+
name: Integration Tests
45+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
46+
with:
47+
name: "Integration Tests"
48+
matrix_linux_5_9_enabled: false
49+
matrix_linux_5_10_enabled: false
50+
matrix_linux_command: "./dev/integration_tests.sh"
51+
52+
examples:
53+
name: Examples
54+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
55+
with:
56+
name: "Examples"
57+
matrix_linux_5_9_enabled: false
58+
matrix_linux_5_10_enabled: false
59+
matrix_linux_command: "./dev/build-examples.sh"
60+
61+
benchmarks:
62+
name: Benchmarks
63+
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
64+
with:
65+
benchmark_package_path: "IntegrationTests/Benchmarks"
66+
linux_5_9_enabled: false
67+
linux_5_10_enabled: false
68+
69+
cxx-interop:
70+
name: Cxx Interop
71+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
72+
with:
73+
linux_5_9_enabled: false
74+
linux_5_10_enabled: false

Diff for: .github/workflows/pull_request_label.yml

+18
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

Diff for: .license_header_template

+13
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.

Diff for: .licenseignore

+40
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

Diff for: CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ In order to protect both you and ourselves, you will need to sign the
1717

1818
Please see the [main gRPC repository](https://github.com/grpc/grpc) for
1919
more information about gRPC.
20+
21+
### Run CI checks locally
22+
23+
You can run the Github Actions workflows locally using [act](https://github.com/nektos/act) or in some cases calling scripts directly. For detailed steps on how to do this please see [https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally](https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally).

Diff for: Examples/hello-world/Protos renamed to Examples/hello-world/Protos.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015 gRPC authors.
1+
// Copyright 2015, gRPC Authors All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: IntegrationTests/Benchmarks/Package.swift

+21-21
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@
1717
import PackageDescription
1818

1919
let package = Package(
20-
name: "benchmarks",
21-
platforms: [
22-
.macOS(.v13),
23-
],
24-
dependencies: [
25-
.package(path: "../../"),
26-
.package(url: "https://github.com/ordo-one/package-benchmark", from: "1.11.2")
27-
],
28-
targets: [
29-
.executableTarget(
30-
name: "GRPCSwiftBenchmark",
31-
dependencies: [
32-
.product(name: "Benchmark", package: "package-benchmark"),
33-
.product(name: "GRPCCore", package: "grpc-swift")
34-
],
35-
path: "Benchmarks/GRPCSwiftBenchmark",
36-
plugins: [
37-
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
38-
]
39-
),
40-
]
20+
name: "benchmarks",
21+
platforms: [
22+
.macOS(.v13)
23+
],
24+
dependencies: [
25+
.package(path: "../../"),
26+
.package(url: "https://github.com/ordo-one/package-benchmark", from: "1.11.2"),
27+
],
28+
targets: [
29+
.executableTarget(
30+
name: "GRPCSwiftBenchmark",
31+
dependencies: [
32+
.product(name: "Benchmark", package: "package-benchmark"),
33+
.product(name: "GRPCCore", package: "grpc-swift"),
34+
],
35+
path: "Benchmarks/GRPCSwiftBenchmark",
36+
plugins: [
37+
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
38+
]
39+
)
40+
]
4141
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mallocCountTotal" : 11,
3+
"memoryLeaked" : 0,
4+
"releaseCount" : 3012,
5+
"retainCount" : 2000,
6+
"syscalls" : 0
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mallocCountTotal" : 11,
3+
"memoryLeaked" : 0,
4+
"releaseCount" : 4012,
5+
"retainCount" : 2000,
6+
"syscalls" : 0
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mallocCountTotal" : 0,
3+
"memoryLeaked" : 0,
4+
"releaseCount" : 3001,
5+
"retainCount" : 1000,
6+
"syscalls" : 0
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mallocCountTotal" : 0,
3+
"memoryLeaked" : 0,
4+
"releaseCount" : 3001,
5+
"retainCount" : 1000,
6+
"syscalls" : 0
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mallocCountTotal" : 2000,
3+
"memoryLeaked" : 0,
4+
"releaseCount" : 7001,
5+
"retainCount" : 3000,
6+
"syscalls" : 0
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mallocCountTotal" : 0,
3+
"memoryLeaked" : 0,
4+
"releaseCount" : 3001,
5+
"retainCount" : 1000,
6+
"syscalls" : 0
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mallocCountTotal" : 0,
3+
"memoryLeaked" : 0,
4+
"releaseCount" : 2002001,
5+
"retainCount" : 1999000,
6+
"syscalls" : 0
7+
}

0 commit comments

Comments
 (0)