Skip to content

Commit 07e38e9

Browse files
authored
Migrate CI to use swiftlang / SwiftNIO common GitHub Actions. (#2105)
### 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 07e38e9

File tree

47 files changed

+404
-283
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

+404
-283
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 & 82 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
benchmarks:
21+
name: Benchmarks
22+
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
23+
with:
24+
benchmark_package_path: "IntegrationTests/Benchmarks"
25+
linux_5_9_enabled: false
26+
linux_5_10_enabled: false

.github/workflows/pull_request.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
examples:
30+
name: Examples
31+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
32+
with:
33+
name: "Examples"
34+
matrix_linux_5_9_enabled: false
35+
matrix_linux_5_10_enabled: false
36+
matrix_linux_command: "./dev/build-examples.sh"
37+
38+
benchmarks:
39+
name: Benchmarks
40+
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
41+
with:
42+
benchmark_package_path: "IntegrationTests/Benchmarks"
43+
linux_5_9_enabled: false
44+
linux_5_10_enabled: false
45+
46+
cxx-interop:
47+
name: Cxx interop
48+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
49+
with:
50+
linux_5_9_enabled: false
51+
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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
.swiftformatignore
39+
LICENSE
40+
**/*.swift
41+
dev/protos/**/*.proto
42+
Examples/hello-world/Protos/HelloWorld.proto

.swiftformatignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.grpc.swift
2+
*.pb.swift

.unacceptablelanguageignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/*.pb.swift
2+
**/*.grpc.swift
3+
dev/protos/upstream/**/*.proto

0 commit comments

Comments
 (0)