Skip to content
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

Migrate CI to use swiftlang / SwiftNIO common GitHub Actions. #9

Merged
merged 2 commits into from
Nov 7, 2024
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
14 changes: 14 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
changelog:
categories:
- title: SemVer Major
labels:
- ⚠️ semver/major
- title: SemVer Minor
labels:
- semver/minor
- title: SemVer Patch
labels:
- semver/patch
- title: Other Changes
labels:
- semver/none
39 changes: 0 additions & 39 deletions .github/workflows/ci.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Main

on:
push:
branches: [main]
schedule:
- cron: "0 8,20 * * *"

jobs:
unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_enabled: false
linux_5_10_enabled: false
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
34 changes: 34 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PR

on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]

jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_project_name: "gRPC"

grpc-soundness:
name: Soundness
uses: ./.github/workflows/soundness.yml

unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_enabled: false
linux_5_10_enabled: false
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
with:
linux_5_9_enabled: false
linux_5_10_enabled: false
18 changes: 18 additions & 0 deletions .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR

on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

jobs:
semver-label-check:
name: Semantic version label check
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Check for Semantic Version label
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main
37 changes: 37 additions & 0 deletions .github/workflows/soundness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Soundness
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we inline this in pull_request.yml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can but then it won't display as PR / Soundness / Swift license headers check (pull_request) as the other soundness and license header checks do, that's the reason for the split-out.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would it display as?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think PR / Swift license headers check (pull_request)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought grouping the like-checks was nice. So that both license header checks appeared in the same part of the hierarchy and are grouped if you look at the Checks tab.


on:
workflow_call:

jobs:
swift-license-check:
name: Swift license headers check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Mark the workspace as safe
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Run license check
run: |
./dev/license-check.sh

check-generated-code:
name: Check generated code
runs-on: ubuntu-latest
container:
image: swift:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Mark the workspace as safe
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Install protoc
run: apt update && apt install -y protobuf-compiler
- name: Run soundness checks
run: |
./dev/check-generated-code.sh
13 changes: 13 additions & 0 deletions .license_header_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@@ Copyright YEARS, gRPC Authors All rights reserved.
@@
@@ Licensed under the Apache License, Version 2.0 (the "License");
@@ you may not use this file except in compliance with the License.
@@ You may obtain a copy of the License at
@@
@@ http://www.apache.org/licenses/LICENSE-2.0
@@
@@ Unless required by applicable law or agreed to in writing, software
@@ distributed under the License is distributed on an "AS IS" BASIS,
@@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ See the License for the specific language governing permissions and
@@ limitations under the License.
41 changes: 41 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.gitignore
**/.gitignore
.licenseignore
.gitattributes
.git-blame-ignore-revs
.gitmodules
.mailfilter
.mailmap
.spi.yml
.swift-format
.swiftformatignore
.editorconfig
.github/*
*.md
*.txt
*.yml
*.yaml
*.json
Package.swift
**/Package.swift
Package@-*.swift
**/Package@-*.swift
Package.resolved
**/Package.resolved
Makefile
*.modulemap
**/*.modulemap
**/*.docc/*
*.xcprivacy
**/*.xcprivacy
*.symlink
**/*.symlink
Dockerfile
**/Dockerfile
Snippets/*
dev/git.commit.template
dev/version-bump.commit.template
.unacceptablelanguageignore
LICENSE
**/*.swift
dev/protos/**/*.proto
2 changes: 2 additions & 0 deletions .swiftformatignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.grpc.swift
*.pb.swift
3 changes: 3 additions & 0 deletions .unacceptablelanguageignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/*.pb.swift
**/*.grpc.swift
dev/protos/upstream/**/*.proto
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ let dependencies: [Package.Dependency] = [
let defaultSwiftSettings: [SwiftSetting] = [
.swiftLanguageMode(.v6),
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("InternalImportsByDefault")
.enableUpcomingFeature("InternalImportsByDefault"),
]

let targets: [Target] = [
Expand Down Expand Up @@ -91,7 +91,7 @@ let targets: [Target] = [
dependencies: [
.target(name: "GRPCInterceptors"),
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "Tracing", package: "swift-distributed-tracing")
.product(name: "Tracing", package: "swift-distributed-tracing"),
],
swiftSettings: defaultSwiftSettings
),
Expand All @@ -114,7 +114,7 @@ let targets: [Target] = [
.product(name: "GRPCInProcessTransport", package: "grpc-swift"),
],
swiftSettings: defaultSwiftSettings
)
),
]

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion Sources/GRPCHealthService/Health.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public import GRPCCore

/// ``Health`` is gRPC’s mechanism for checking whether a server is able to handle RPCs. Its semantics are documented in
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
/// https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/doc/health-checking.md.
///
/// `Health` initializes a new ``Health/Service-swift.struct`` and ``Health/Provider-swift.struct``.
/// - `Health.Service` implements the Health service from the `grpc.health.v1` package and can be registered with a server
Expand Down
2 changes: 1 addition & 1 deletion Sources/GRPCInteropTests/InteroperabilityTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public protocol InteroperabilityTest {
}

/// Test cases as listed by the [gRPC interoperability test description specification]
/// (https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md).
/// (https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/doc/interop-test-descriptions.md).
///
/// This is not a complete list, the following tests have not been implemented:
/// - cacheable_unary (caching not supported)
Expand Down
2 changes: 1 addition & 1 deletion Sources/GRPCInteropTests/TestService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol {

/// This is not implemented as it is not described in the specification.
///
/// See: https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md
/// See: https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/doc/interop-test-descriptions.md
public func halfDuplexCall(
request: StreamingServerRequest<Grpc_Testing_StreamingOutputCallRequest>,
context: ServerContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ Note that when specifying a service, a method or a symbol, we have to use the fu

[grpcurl-setup]: https://github.com/fullstorydev/grpcurl#grpcurl
[grpcurl]: https://github.com/fullstorydev/grpcurl
[grpc-cli]: https://github.com/grpc/grpc/blob/master/doc/command_line_tool.md
[grpc-cli]: https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/doc/command_line_tool.md
[v1]: ../v1/reflection-v1.proto
[v1alpha]: ../v1Alpha/reflection-v1alpha.proto
[reflection-server]: ../../Examples/v1/ReflectionService/ReflectionServer.swift
Expand Down
4 changes: 2 additions & 2 deletions Sources/GRPCReflectionService/Server/ReflectionService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ extension ReflectionService {
var wrapped: Wrapped
private init(_ wrapped: Wrapped) { self.wrapped = wrapped }

/// The v1 version of reflection service: https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1/reflection.proto.
/// The v1 version of reflection service: https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/src/proto/grpc/reflection/v1/reflection.proto.
public static var v1: Self { Self(.v1) }
/// The v1alpha version of reflection service: https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto.
/// The v1alpha version of reflection service: https://github.com/grpc/grpc/blob/5011420f160b91129a7baebe21df9444a07896a6/src/proto/grpc/reflection/v1alpha/reflection.proto.
public static var v1Alpha: Self { Self(.v1Alpha) }
}

Expand Down
27 changes: 13 additions & 14 deletions dev/check-generated-code.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/bin/bash

# Copyright 2024, gRPC Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## Copyright 2024, gRPC Authors All rights reserved.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.

set -euo pipefail

Expand Down
30 changes: 14 additions & 16 deletions dev/format.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/bin/bash

# Copyright 2020, gRPC Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## Copyright 2020, gRPC Authors All rights reserved.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.

set -eu

Expand Down Expand Up @@ -68,8 +67,7 @@ if "$lint"; then
To fix, run the following command:

% $THIS_SCRIPT -f
"
exit "${SWIFT_FORMAT_RC}"
" "${SWIFT_FORMAT_RC}"
fi

log "Ran swift format lint with no errors."
Expand Down
Loading
Loading