diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..f96b514 --- /dev/null +++ b/.github/release.yml @@ -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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index aec3b0c..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: CI -on: - pull_request: - branches: [main] -jobs: - preflight: - name: License Header and Formatting Checks - runs-on: ubuntu-latest - container: - image: swift:6.0-jammy - steps: - - name: "Checkout repository" - uses: actions/checkout@v4 - - name: Mark the workspace as safe - run: git config --global --add safe.directory ${GITHUB_WORKSPACE} - - name: "Formatting, License Headers, and Generated Code check" - run: | - ./dev/sanity.sh - unit-tests: - strategy: - fail-fast: false - matrix: - include: - - image: swiftlang/swift:nightly-jammy - - image: swift:6.0-jammy - name: Build and Test on ${{ matrix.image }} - runs-on: ubuntu-latest - container: - image: ${{ matrix.image }} - steps: - - uses: actions/checkout@v4 - - name: 🔧 Build - run: swift build ${{ matrix.swift-build-flags }} - timeout-minutes: 20 - - name: 🧪 Test - run: swift test ${{ matrix.swift-test-flags }} - timeout-minutes: 20 - integration-tests: - strategy: - fail-fast: false - matrix: - include: - - image: swiftlang/swift:nightly-jammy - - image: swift:6.0-jammy - name: Run integration tests using ${{ matrix.image }} - runs-on: ubuntu-latest - container: - image: ${{ matrix.image }} - steps: - - uses: actions/checkout@v4 - - name: Build performance tests - run: ./dev/build-performance-tests.sh - - name: Run interop tests - run: ./dev/run-interop-tests.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4b7d9aa --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,28 @@ +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" + + integration-tests: + name: Integration Tests + # Workaround https://github.com/nektos/act/issues/1875 + uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + with: + name: "Integration tests" + matrix_linux_5_9_enabled: false + matrix_linux_5_10_enabled: false + matrix_linux_command: "./dev/integration_tests.sh" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..45ad768 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,53 @@ +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" + + swift-license-check: + name: Swift License Header 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 + + 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" + + integration-tests: + name: Integration Tests + uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + with: + name: "Integration Tests" + matrix_linux_5_9_enabled: false + matrix_linux_5_10_enabled: false + matrix_linux_command: "./dev/integration_tests.sh" + + 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 diff --git a/.github/workflows/pull_request_label.yml b/.github/workflows/pull_request_label.yml new file mode 100644 index 0000000..a161419 --- /dev/null +++ b/.github/workflows/pull_request_label.yml @@ -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 diff --git a/.license_header_template b/.license_header_template new file mode 100644 index 0000000..a07a9ad --- /dev/null +++ b/.license_header_template @@ -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. diff --git a/.licenseignore b/.licenseignore new file mode 100644 index 0000000..72aab0f --- /dev/null +++ b/.licenseignore @@ -0,0 +1,41 @@ +.gitignore +**/.gitignore +.licenseignore +.gitattributes +.git-blame-ignore-revs +.mailfilter +.mailmap +.spi.yml +.swift-format +.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 +IntegrationTests/grpc-performance-tests/Sources/Generated/* +LICENSE +**/*.swift +Sources/CGRPCZlib/* +dev/protos/**/*.proto diff --git a/Package.swift b/Package.swift index e22ecd2..0c1fb2b 100644 --- a/Package.swift +++ b/Package.swift @@ -66,7 +66,7 @@ let dependencies: [Package.Dependency] = [ let defaultSwiftSettings: [SwiftSetting] = [ .swiftLanguageMode(.v6), .enableUpcomingFeature("ExistentialAny"), - .enableUpcomingFeature("InternalImportsByDefault") + .enableUpcomingFeature("InternalImportsByDefault"), ] let targets: [Target] = [ @@ -87,7 +87,7 @@ let targets: [Target] = [ .product(name: "NIOCore", package: "swift-nio"), .product(name: "NIOHTTP2", package: "swift-nio-http2"), .product(name: "NIOExtras", package: "swift-nio-extras"), - .target(name: "CGRPCZlib") + .target(name: "CGRPCZlib"), ], swiftSettings: defaultSwiftSettings ), @@ -140,7 +140,7 @@ let targets: [Target] = [ .product(name: "X509", package: "swift-certificates"), .product(name: "NIOSSL", package: "swift-nio-ssl"), ] - ) + ), ] let package = Package( diff --git a/Sources/GRPCNIOTransportCore/Client/Connection/ClientConnectionHandler.swift b/Sources/GRPCNIOTransportCore/Client/Connection/ClientConnectionHandler.swift index 8886597..ef3b5ea 100644 --- a/Sources/GRPCNIOTransportCore/Client/Connection/ClientConnectionHandler.swift +++ b/Sources/GRPCNIOTransportCore/Client/Connection/ClientConnectionHandler.swift @@ -47,7 +47,7 @@ package enum ClientConnectionEvent: Sendable { /// 2. Closing the connection if it is idle (has no open streams) for a configured amount of time. /// 3. Forwarding lifecycle events to the next handler. /// -/// Some of the behaviours are described in [gRFC A8](https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md). +/// Some of the behaviours are described in [gRFC A8](https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A8-client-side-keepalive.md). package final class ClientConnectionHandler: ChannelInboundHandler, ChannelOutboundHandler { package typealias InboundIn = HTTP2Frame package typealias InboundOut = ClientConnectionEvent diff --git a/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/RoundRobinLoadBalancer.swift b/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/RoundRobinLoadBalancer.swift index abdacb1..df917e5 100644 --- a/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/RoundRobinLoadBalancer.swift +++ b/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/RoundRobinLoadBalancer.swift @@ -529,7 +529,7 @@ extension RoundRobinLoadBalancer { mutating func updateState(_ newState: ConnectivityState) -> Bool { // The transition from transient failure to connecting is ignored. // - // See: https://github.com/grpc/grpc/blob/master/doc/load-balancing.md + // See: https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/load-balancing.md if case .transientFailure = self.state, newState == .connecting { return false } @@ -733,7 +733,7 @@ extension RoundRobinLoadBalancer { extension ConnectivityState { static func aggregate(_ states: some Collection) -> ConnectivityState { - // See https://github.com/grpc/grpc/blob/master/doc/load-balancing.md + // See https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/load-balancing.md // If any one subchannel is in READY state, the channel's state is READY. if states.contains(where: { $0 == .ready }) { diff --git a/Sources/GRPCNIOTransportCore/GRPCStreamStateMachine.swift b/Sources/GRPCNIOTransportCore/GRPCStreamStateMachine.swift index 7801f6d..00d26b5 100644 --- a/Sources/GRPCNIOTransportCore/GRPCStreamStateMachine.swift +++ b/Sources/GRPCNIOTransportCore/GRPCStreamStateMachine.swift @@ -638,7 +638,7 @@ extension GRPCStreamStateMachine { headers.reserveCapacity(7 + customMetadata.count) // Add required headers. - // See https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests + // See https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/PROTOCOL-HTTP2.md#requests // The order is important here: reserved HTTP2 headers (those starting with `:`) // must come before all other headers. @@ -851,7 +851,7 @@ extension GRPCStreamStateMachine { if (100 ... 199).contains(httpStatusCode.code) { // For 1xx status codes, the entire header should be skipped and a // subsequent header should be read. - // See https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md + // See https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/http-grpc-status-mapping.md return .invalid(.doNothing) } @@ -1868,7 +1868,7 @@ extension Metadata { } extension Status.Code { - // See https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md + // See https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/http-grpc-status-mapping.md init(httpStatusCode: HTTPResponseStatus) { switch httpStatusCode { case .badRequest: diff --git a/Sources/GRPCNIOTransportCore/Internal/ContentType.swift b/Sources/GRPCNIOTransportCore/Internal/ContentType.swift index 2e098d3..76c17b0 100644 --- a/Sources/GRPCNIOTransportCore/Internal/ContentType.swift +++ b/Sources/GRPCNIOTransportCore/Internal/ContentType.swift @@ -15,7 +15,7 @@ */ // See: -// - https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md +// - https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/PROTOCOL-HTTP2.md enum ContentType { case grpc diff --git a/Sources/GRPCNIOTransportCore/Internal/GRPCStatusMessageMarshaller.swift b/Sources/GRPCNIOTransportCore/Internal/GRPCStatusMessageMarshaller.swift index 4f8b1eb..00969a4 100644 --- a/Sources/GRPCNIOTransportCore/Internal/GRPCStatusMessageMarshaller.swift +++ b/Sources/GRPCNIOTransportCore/Internal/GRPCStatusMessageMarshaller.swift @@ -56,7 +56,7 @@ extension GRPCStatusMessageMarshaller { for char in message.utf8 { switch char { - // See: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#responses + // See: https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/PROTOCOL-HTTP2.md#responses case 0x20 ... 0x24, 0x26 ... 0x7E: bytes.append(char) diff --git a/Sources/GRPCNIOTransportCore/Server/CommonHTTP2ServerTransport.swift b/Sources/GRPCNIOTransportCore/Server/CommonHTTP2ServerTransport.swift index db06969..420732f 100644 --- a/Sources/GRPCNIOTransportCore/Server/CommonHTTP2ServerTransport.swift +++ b/Sources/GRPCNIOTransportCore/Server/CommonHTTP2ServerTransport.swift @@ -235,7 +235,7 @@ package final class CommonHTTP2ServerTransport< // - If we get an error because the http2Stream failed to close, then there's nothing we can do // - If we get an error because the inner closure threw, then the only possible scenario in which // that could happen is if methodDescriptor.get() throws - in which case, it means we never got - // the RPC metadata, which means we can't do anything either and it's okay to just kill the stream. + // the RPC metadata, which means we can't do anything either and it's okay to just close the stream. try? await stream.executeThenClose { inbound, outbound in guard let descriptor = try? await descriptor.get() else { return diff --git a/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler+StateMachine.swift b/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler+StateMachine.swift index f10387f..fbaebf5 100644 --- a/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler+StateMachine.swift +++ b/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler+StateMachine.swift @@ -333,7 +333,7 @@ extension ServerConnectionManagementHandler.StateMachine { // If there are no open streams and keep alive pings aren't allowed without calls then // use an interval of two hours. // - // This comes from gRFC A8: https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md + // This comes from gRFC A8: https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A8-client-side-keepalive.md interval = .hours(2) } diff --git a/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler.swift b/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler.swift index fe3ccb8..0f43e59 100644 --- a/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler.swift +++ b/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler.swift @@ -37,8 +37,8 @@ private import NIOTLS /// too many pings. /// /// Some of the behaviours are described in: -/// - [gRFC A8](https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md), and -/// - [gRFC A9](https://github.com/grpc/proposal/blob/master/A9-server-side-conn-mgt.md). +/// - [gRFC A8](https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A8-client-side-keepalive.md), and +/// - [gRFC A9](https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A9-server-side-conn-mgt.md). package final class ServerConnectionManagementHandler: ChannelDuplexHandler { package typealias InboundIn = HTTP2Frame package typealias InboundOut = HTTP2Frame diff --git a/Tests/GRPCNIOTransportHTTP2Tests/HTTP2TransportTests.swift b/Tests/GRPCNIOTransportHTTP2Tests/HTTP2TransportTests.swift index 342b5a3..14f7533 100644 --- a/Tests/GRPCNIOTransportHTTP2Tests/HTTP2TransportTests.swift +++ b/Tests/GRPCNIOTransportHTTP2Tests/HTTP2TransportTests.swift @@ -1274,7 +1274,7 @@ final class HTTP2TransportTests: XCTestCase { } private static let httpToStatusCodePairs: [(Int, RPCError.Code)] = [ - // See https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md + // See https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/http-grpc-status-mapping.md (400, .internalError), (401, .unauthenticated), (403, .permissionDenied), diff --git a/dev/build-performance-tests.sh b/dev/build-performance-tests.sh index fb92113..08a31d2 100755 --- a/dev/build-performance-tests.sh +++ b/dev/build-performance-tests.sh @@ -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 diff --git a/dev/format.sh b/dev/format.sh index 952e433..508ac1c 100755 --- a/dev/format.sh +++ b/dev/format.sh @@ -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 @@ -69,8 +68,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." diff --git a/dev/integration_tests.sh b/dev/integration_tests.sh new file mode 100755 index 0000000..b350e4a --- /dev/null +++ b/dev/integration_tests.sh @@ -0,0 +1,24 @@ +#!/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. + +set -euo pipefail + +here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +echo "Build performance tests" +eval "$here/build-performance-tests.sh" + +echo "Run interop tests" +eval "$here/run-interop-tests.sh" diff --git a/dev/license-check.sh b/dev/license-check.sh index b3312a1..26b964d 100755 --- a/dev/license-check.sh +++ b/dev/license-check.sh @@ -1,18 +1,17 @@ #!/bin/bash - -# Copyright 2019, 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 2019, 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. # This script checks the copyright headers in source *.swift source files and # exits if they do not match the expected header. The year, or year range in @@ -38,10 +37,6 @@ read -r -d '' COPYRIGHT_HEADER_SWIFT << 'EOF' EOF SWIFT_SHA=$(echo "$COPYRIGHT_HEADER_SWIFT" | shasum | awk '{print $1}') -replace_years() { - sed -e 's/201[56789]-20[12][0-9]/YEARS/' -e 's/201[56789]/YEARS/' -} - # Checks the Copyright headers for *.swift files in this repository against the # expected headers. # @@ -74,12 +69,12 @@ check_copyright_headers() { drop_first=1 expected_lines=15 ;; - */Package@swift-*.swift) + */Package@swift-*.*.swift) expected_sha="$SWIFT_SHA" drop_first=1 expected_lines=15 ;; - */Package@swift-*.*.swift) + */Package@swift-*.swift) expected_sha="$SWIFT_SHA" drop_first=1 expected_lines=15 diff --git a/dev/protos/fetch.sh b/dev/protos/fetch.sh index 0fac251..4fb1454 100755 --- a/dev/protos/fetch.sh +++ b/dev/protos/fetch.sh @@ -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 -eu diff --git a/dev/protos/generate.sh b/dev/protos/generate.sh index f3ce881..3841200 100755 --- a/dev/protos/generate.sh +++ b/dev/protos/generate.sh @@ -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 -eu diff --git a/dev/run-interop-tests.sh b/dev/run-interop-tests.sh index 06e56ea..c28fd16 100755 --- a/dev/run-interop-tests.sh +++ b/dev/run-interop-tests.sh @@ -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 @@ -56,7 +55,7 @@ bound_port=$(grep -o "$pattern" < "$server_output_file" | grep -o '[0-9]*$') if [[ -z "$bound_port" ]]; then error "Failed to get the bound port." - kill $server_pid + kill $server_pid # ignore-unacceptable-language exit 1 else log "Started server on $host:$bound_port" @@ -91,7 +90,7 @@ done # Stop the server log "Stopping the server..." -kill $server_pid +kill $server_pid # ignore-unacceptable-language if [[ $failed_tests -gt 0 ]]; then error "$failed_tests tests failed." diff --git a/dev/sanity.sh b/dev/sanity.sh deleted file mode 100755 index 44088ae..0000000 --- a/dev/sanity.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/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. - -set -eu - -here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -function run_logged() { - local message=$1 - local command=$2 - - log=$(mktemp) - - printf '==> %s ... ' "$message" - - if $command > "$log" 2>&1; then - printf "\033[0;32mOK\033[0m\n" - else - errors=$(( errors + 1)) - printf "\033[0;31mFAILED\033[0m\n" - echo "=== Captured output:" - cat "$log" - echo "===" - fi -} - -function check_license_headers() { - run_logged "Checking license headers" "$here/license-check.sh" -} - -function check_formatting() { - run_logged "Checking formatting" "$here/format.sh -l" -} - -errors=0 -check_license_headers -check_formatting -exit $errors