From 6bfd485daa8c26aa47a2783efd486e5c827a625a Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Tue, 5 Nov 2024 15:28:14 +0000 Subject: [PATCH] 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. --- .github/release.yml | 14 ++++ .github/workflows/ci.yaml | 82 ------------------- .github/workflows/main.yml | 35 ++++++++ .github/workflows/pull_request.yml | 60 ++++++++++++++ .github/workflows/pull_request_label.yml | 18 ++++ .github/workflows/soundness.yml | 37 +++++++++ .license_header_template | 13 +++ .licenseignore | 41 ++++++++++ CONTRIBUTING.md | 4 + Examples/hello-world/Protos | 37 --------- Examples/hello-world/Protos/HelloWorld.proto | 1 + IntegrationTests/Benchmarks/Package.swift | 42 +++++----- ...wiftBenchmark.Metadata_Add_binary.p90.json | 0 ...wiftBenchmark.Metadata_Add_string.p90.json | 0 ...hmark.Metadata_Iterate_all_values.p90.json | 0 ...es_when_only_binary_values_stored.p90.json | 0 ...y_values_when_only_strings_stored.p90.json | 0 ...rk.Metadata_Iterate_string_values.p90.json | 0 ...rk.Metadata_Remove_values_for_key.p90.json | 0 ...wiftBenchmark.Metadata_Add_binary.p90.json | 7 ++ ...wiftBenchmark.Metadata_Add_string.p90.json | 7 ++ ...hmark.Metadata_Iterate_all_values.p90.json | 7 ++ ...es_when_only_binary_values_stored.p90.json | 7 ++ ...y_values_when_only_strings_stored.p90.json | 7 ++ ...rk.Metadata_Iterate_string_values.p90.json | 7 ++ ...rk.Metadata_Remove_values_for_key.p90.json | 7 ++ Package.swift | 12 ++- .../GRPCCore/Configuration/MethodConfig.swift | 6 +- .../Configuration/ServiceConfig.swift | 2 +- .../Documentation.docc/Development/Design.md | 2 +- Sources/GRPCCore/Internal/Base64.swift | 4 +- Sources/GRPCCore/Internal/Metadata+GRPC.swift | 2 +- Sources/GRPCCore/Status.swift | 2 +- Sources/GRPCCore/Timeout.swift | 2 +- .../GRPCCore/Transport/RetryThrottle.swift | 2 +- .../Documentation.docc/Documentation.md | 4 +- .../InProcessTransport+Client.swift | 12 +-- .../InProcessTransport+Server.swift | 10 +-- .../Generated/rls_config.pb.swift | 2 +- .../Generated/service_config.pb.swift | 2 +- dev/build-examples.sh | 27 +++--- dev/check-generated-code.sh | 27 +++--- dev/format.sh | 30 ++++--- dev/license-check.sh | 35 ++++---- dev/protos/fetch.sh | 28 +++---- dev/protos/generate.sh | 27 +++--- .../upstream/grpc/lookup/v1/rls_config.proto | 2 +- .../grpc/service_config/service_config.proto | 2 +- dev/{sanity.sh => soundness.sh} | 32 +++----- 49 files changed, 420 insertions(+), 287 deletions(-) create mode 100644 .github/release.yml delete mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/pull_request_label.yml create mode 100644 .github/workflows/soundness.yml create mode 100644 .license_header_template create mode 100644 .licenseignore delete mode 100644 Examples/hello-world/Protos create mode 120000 Examples/hello-world/Protos/HelloWorld.proto rename IntegrationTests/Benchmarks/Thresholds/{main => nightly-6.0}/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json (100%) rename IntegrationTests/Benchmarks/Thresholds/{main => nightly-6.0}/GRPCSwiftBenchmark.Metadata_Add_string.p90.json (100%) rename IntegrationTests/Benchmarks/Thresholds/{main => nightly-6.0}/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json (100%) rename IntegrationTests/Benchmarks/Thresholds/{main => nightly-6.0}/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json (100%) rename IntegrationTests/Benchmarks/Thresholds/{main => nightly-6.0}/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json (100%) rename IntegrationTests/Benchmarks/Thresholds/{main => nightly-6.0}/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json (100%) rename IntegrationTests/Benchmarks/Thresholds/{main => nightly-6.0}/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json (100%) create mode 100644 IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json create mode 100644 IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Add_string.p90.json create mode 100644 IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json create mode 100644 IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json create mode 100644 IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json create mode 100644 IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json create mode 100644 IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json rename dev/{sanity.sh => soundness.sh} (50%) diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 000000000..f96b51492 --- /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 05a329f30..000000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,82 +0,0 @@ -name: CI -on: - push: - branches: [main] - 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: "Install protoc" - run: apt update && apt install -y protobuf-compiler - - 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 - # No TSAN because of: https://github.com/apple/swift/issues/59068 - # swift-test-flags: "--sanitize=thread" - - image: swift:6.0-jammy - # No TSAN because of: https://github.com/apple/swift/issues/59068 - # swift-test-flags: "--sanitize=thread" - 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 - performance-tests: - strategy: - fail-fast: false - matrix: - include: - - image: swiftlang/swift:nightly-jammy - swift-version: 'main' - - image: swift:6.0-jammy - swift-version: '6.0' - name: Performance Tests on ${{ matrix.image }} - runs-on: ubuntu-latest - container: - image: ${{ matrix.image }} - steps: - - uses: actions/checkout@v4 - - name: Install jemalloc for benchmarking - run: apt update && apt-get install -y libjemalloc-dev - timeout-minutes: 20 - - name: Run Benchmarks - working-directory: "./IntegrationTests/Benchmarks" - run: swift package benchmark baseline check --no-progress --check-absolute-path Thresholds/${{ matrix.swift-version }}/ - timeout-minutes: 20 - examples: - strategy: - fail-fast: false - matrix: - include: - - image: swiftlang/swift:nightly-jammy - - image: swift:6.0-jammy - name: Build examples using ${{ matrix.image }} - runs-on: ubuntu-latest - container: - image: ${{ matrix.image }} - steps: - - uses: actions/checkout@v4 - - name: Build examples - run: ./dev/build-examples.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..e1851164b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +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 + 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" + + benchmarks: + name: Benchmarks + uses: apple/swift-nio/.github/workflows/benchmarks.yml@main + with: + benchmark_package_path: "IntegrationTests/Benchmarks" + linux_5_9_enabled: false + linux_5_10_enabled: false diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 000000000..2910acd91 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,60 @@ +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" + + 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" + + examples: + name: Examples + uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + with: + name: "Examples" + matrix_linux_5_9_enabled: false + matrix_linux_5_10_enabled: false + matrix_linux_command: "./dev/build-examples.sh" + + benchmarks: + name: Benchmarks + uses: apple/swift-nio/.github/workflows/benchmarks.yml@main + with: + benchmark_package_path: "IntegrationTests/Benchmarks" + linux_5_9_enabled: false + linux_5_10_enabled: false + + 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 000000000..d83c59999 --- /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/.github/workflows/soundness.yml b/.github/workflows/soundness.yml new file mode 100644 index 000000000..35a50d70a --- /dev/null +++ b/.github/workflows/soundness.yml @@ -0,0 +1,37 @@ +name: Soundness + +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 diff --git a/.license_header_template b/.license_header_template new file mode 100644 index 000000000..a07a9ad01 --- /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 000000000..cd3a1c650 --- /dev/null +++ b/.licenseignore @@ -0,0 +1,41 @@ +.gitignore +**/.gitignore +.licenseignore +.gitattributes +.git-blame-ignore-revs +.gitmodules +.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 +LICENSE +**/*.swift +dev/protos/**/*.proto +Examples/hello-world/Protos/HelloWorld.proto diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe4675837..3d9d354a5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,3 +17,7 @@ In order to protect both you and ourselves, you will need to sign the Please see the [main gRPC repository](https://github.com/grpc/grpc) for more information about gRPC. + +### Run CI checks locally + +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 --git a/Examples/hello-world/Protos b/Examples/hello-world/Protos deleted file mode 100644 index 2be480c2f..000000000 --- a/Examples/hello-world/Protos +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 gRPC authors. -// -// 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. -syntax = "proto3"; - -option java_multiple_files = true; -option java_package = "io.grpc.examples.helloworld"; -option java_outer_classname = "HelloWorldProto"; -option objc_class_prefix = "HLW"; - -package helloworld; - -// The greeting service definition. -service Greeter { - // Sends a greeting - rpc SayHello (HelloRequest) returns (HelloReply) {} -} - -// The request message containing the user's name. -message HelloRequest { - string name = 1; -} - -// The response message containing the greetings -message HelloReply { - string message = 1; -} diff --git a/Examples/hello-world/Protos/HelloWorld.proto b/Examples/hello-world/Protos/HelloWorld.proto new file mode 120000 index 000000000..b5e1142c1 --- /dev/null +++ b/Examples/hello-world/Protos/HelloWorld.proto @@ -0,0 +1 @@ +../../..//dev/protos/upstream/grpc/examples/helloworld.proto \ No newline at end of file diff --git a/IntegrationTests/Benchmarks/Package.swift b/IntegrationTests/Benchmarks/Package.swift index 6a818aab9..3fe8b8aed 100644 --- a/IntegrationTests/Benchmarks/Package.swift +++ b/IntegrationTests/Benchmarks/Package.swift @@ -17,25 +17,25 @@ import PackageDescription let package = Package( - name: "benchmarks", - platforms: [ - .macOS(.v13), - ], - dependencies: [ - .package(path: "../../"), - .package(url: "https://github.com/ordo-one/package-benchmark", from: "1.11.2") - ], - targets: [ - .executableTarget( - name: "GRPCSwiftBenchmark", - dependencies: [ - .product(name: "Benchmark", package: "package-benchmark"), - .product(name: "GRPCCore", package: "grpc-swift") - ], - path: "Benchmarks/GRPCSwiftBenchmark", - plugins: [ - .plugin(name: "BenchmarkPlugin", package: "package-benchmark") - ] - ), - ] + name: "benchmarks", + platforms: [ + .macOS(.v13) + ], + dependencies: [ + .package(path: "../../"), + .package(url: "https://github.com/ordo-one/package-benchmark", from: "1.11.2"), + ], + targets: [ + .executableTarget( + name: "GRPCSwiftBenchmark", + dependencies: [ + .product(name: "Benchmark", package: "package-benchmark"), + .product(name: "GRPCCore", package: "grpc-swift"), + ], + path: "Benchmarks/GRPCSwiftBenchmark", + plugins: [ + .plugin(name: "BenchmarkPlugin", package: "package-benchmark") + ] + ) + ] ) diff --git a/IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json similarity index 100% rename from IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json rename to IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json diff --git a/IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Add_string.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Add_string.p90.json similarity index 100% rename from IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Add_string.p90.json rename to IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Add_string.p90.json diff --git a/IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json similarity index 100% rename from IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json rename to IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json diff --git a/IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json similarity index 100% rename from IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json rename to IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json diff --git a/IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json similarity index 100% rename from IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json rename to IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json diff --git a/IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json similarity index 100% rename from IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json rename to IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json diff --git a/IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json similarity index 100% rename from IntegrationTests/Benchmarks/Thresholds/main/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json rename to IntegrationTests/Benchmarks/Thresholds/nightly-6.0/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json diff --git a/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json new file mode 100644 index 000000000..b642696c1 --- /dev/null +++ b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Add_binary.p90.json @@ -0,0 +1,7 @@ +{ + "mallocCountTotal" : 11, + "memoryLeaked" : 0, + "releaseCount" : 3012, + "retainCount" : 2000, + "syscalls" : 0 +} diff --git a/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Add_string.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Add_string.p90.json new file mode 100644 index 000000000..7fde30a69 --- /dev/null +++ b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Add_string.p90.json @@ -0,0 +1,7 @@ +{ + "mallocCountTotal" : 11, + "memoryLeaked" : 0, + "releaseCount" : 4012, + "retainCount" : 2000, + "syscalls" : 0 +} diff --git a/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json new file mode 100644 index 000000000..1b1303873 --- /dev/null +++ b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_all_values.p90.json @@ -0,0 +1,7 @@ +{ + "mallocCountTotal" : 0, + "memoryLeaked" : 0, + "releaseCount" : 3001, + "retainCount" : 1000, + "syscalls" : 0 +} diff --git a/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json new file mode 100644 index 000000000..1b1303873 --- /dev/null +++ b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_binary_values_stored.p90.json @@ -0,0 +1,7 @@ +{ + "mallocCountTotal" : 0, + "memoryLeaked" : 0, + "releaseCount" : 3001, + "retainCount" : 1000, + "syscalls" : 0 +} diff --git a/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json new file mode 100644 index 000000000..b4aba1c3f --- /dev/null +++ b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_binary_values_when_only_strings_stored.p90.json @@ -0,0 +1,7 @@ +{ + "mallocCountTotal" : 2000, + "memoryLeaked" : 0, + "releaseCount" : 7001, + "retainCount" : 3000, + "syscalls" : 0 +} diff --git a/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json new file mode 100644 index 000000000..1b1303873 --- /dev/null +++ b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Iterate_string_values.p90.json @@ -0,0 +1,7 @@ +{ + "mallocCountTotal" : 0, + "memoryLeaked" : 0, + "releaseCount" : 3001, + "retainCount" : 1000, + "syscalls" : 0 +} diff --git a/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json new file mode 100644 index 000000000..5750750bc --- /dev/null +++ b/IntegrationTests/Benchmarks/Thresholds/nightly-main/GRPCSwiftBenchmark.Metadata_Remove_values_for_key.p90.json @@ -0,0 +1,7 @@ +{ + "mallocCountTotal" : 0, + "memoryLeaked" : 0, + "releaseCount" : 2002001, + "retainCount" : 1999000, + "syscalls" : 0 +} diff --git a/Package.swift b/Package.swift index c1aa65bfc..86cbe9c07 100644 --- a/Package.swift +++ b/Package.swift @@ -15,7 +15,6 @@ * limitations under the License. */ - import PackageDescription let products: [Product] = [ @@ -49,7 +48,7 @@ let dependencies: [Package.Dependency] = [ let defaultSwiftSettings: [SwiftSetting] = [ .swiftLanguageMode(.v6), .enableUpcomingFeature("ExistentialAny"), - .enableUpcomingFeature("InternalImportsByDefault") + .enableUpcomingFeature("InternalImportsByDefault"), ] let targets: [Target] = [ @@ -57,7 +56,7 @@ let targets: [Target] = [ .target( name: "GRPCCore", dependencies: [ - .product(name: "DequeModule", package: "swift-collections"), + .product(name: "DequeModule", package: "swift-collections") ], swiftSettings: defaultSwiftSettings ), @@ -66,7 +65,7 @@ let targets: [Target] = [ dependencies: [ .target(name: "GRPCCore"), .target(name: "GRPCInProcessTransport"), - .product(name: "SwiftProtobuf", package: "swift-protobuf") + .product(name: "SwiftProtobuf", package: "swift-protobuf"), ], resources: [ .copy("Configuration/Inputs") @@ -91,8 +90,7 @@ let targets: [Target] = [ // Code generator library for protoc-gen-grpc-swift .target( name: "GRPCCodeGen", - dependencies: [ - ], + dependencies: [], swiftSettings: defaultSwiftSettings ), .testTarget( @@ -100,7 +98,7 @@ let targets: [Target] = [ dependencies: [ .target(name: "GRPCCodeGen") ] - ) + ), ] let package = Package( diff --git a/Sources/GRPCCore/Configuration/MethodConfig.swift b/Sources/GRPCCore/Configuration/MethodConfig.swift index 13bafcf0e..23a867926 100644 --- a/Sources/GRPCCore/Configuration/MethodConfig.swift +++ b/Sources/GRPCCore/Configuration/MethodConfig.swift @@ -16,7 +16,7 @@ /// Configuration values for executing an RPC. /// -/// See also: https://github.com/grpc/grpc-proto/blob/master/grpc/service_config/service_config.proto +/// See also: https://github.com/grpc/grpc-proto/blob/0b30c8c05277ab78ec72e77c9cbf66a26684673d/grpc/service_config/service_config.proto public struct MethodConfig: Hashable, Sendable { public struct Name: Sendable, Hashable { /// The name of the service, including the namespace. @@ -211,7 +211,7 @@ public struct RPCExecutionPolicy: Hashable, Sendable { /// and `min(initialBackoff * backoffMultiplier^(n-1), maxBackoff)`. /// /// For more information see [gRFC A6 Client -/// Retries](https://github.com/grpc/proposal/blob/master/A6-client-retries.md). +/// Retries](https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A6-client-retries.md). public struct RetryPolicy: Hashable, Sendable { /// The maximum number of RPC attempts, including the original attempt. /// @@ -328,7 +328,7 @@ public struct RetryPolicy: Hashable, Sendable { /// by ``hedgingDelay``. /// /// For more information see [gRFC A6 Client -/// Retries](https://github.com/grpc/proposal/blob/master/A6-client-retries.md). +/// Retries](https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A6-client-retries.md). public struct HedgingPolicy: Hashable, Sendable { /// The maximum number of RPC attempts, including the original attempt. /// diff --git a/Sources/GRPCCore/Configuration/ServiceConfig.swift b/Sources/GRPCCore/Configuration/ServiceConfig.swift index a13bf08dc..316ad8b61 100644 --- a/Sources/GRPCCore/Configuration/ServiceConfig.swift +++ b/Sources/GRPCCore/Configuration/ServiceConfig.swift @@ -16,7 +16,7 @@ /// Service configuration values. /// -/// See also: https://github.com/grpc/grpc-proto/blob/master/grpc/service_config/service_config.proto +/// See also: https://github.com/grpc/grpc-proto/blob/0b30c8c05277ab78ec72e77c9cbf66a26684673d/grpc/service_config/service_config.proto public struct ServiceConfig: Hashable, Sendable { /// Per-method configuration. public var methodConfig: [MethodConfig] diff --git a/Sources/GRPCCore/Documentation.docc/Development/Design.md b/Sources/GRPCCore/Documentation.docc/Development/Design.md index 341580539..fe664a38d 100644 --- a/Sources/GRPCCore/Documentation.docc/Development/Design.md +++ b/Sources/GRPCCore/Documentation.docc/Development/Design.md @@ -76,7 +76,7 @@ doing this doesn't leave the other side waiting indefinitely. gRPC has mechanisms to deliver method-specific configuration at the transport layer which can also change dynamically (see [gRFC A2: ServiceConfig in -DNS](https://github.com/grpc/proposal/blob/master/A2-service-configs-in-dns.md).) +DNS](https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A2-service-configs-in-dns.md).) This configuration is used to determine how clients should interact with servers and how methods should be executed, such as the conditions under which they may be retried. Some of this is exposed via the ``ClientTransport`` as diff --git a/Sources/GRPCCore/Internal/Base64.swift b/Sources/GRPCCore/Internal/Base64.swift index f2078331f..24501f3ab 100644 --- a/Sources/GRPCCore/Internal/Base64.swift +++ b/Sources/GRPCCore/Internal/Base64.swift @@ -15,7 +15,7 @@ */ // This base64 implementation is heavily inspired by: -// https://github.com/lemire/fastbase64/blob/master/src/chromiumbase64.c +// https://github.com/lemire/fastbase64/blob/a2e0967dfcb8f0129ea45b9b24cc410e4cac117f/src/chromiumbase64.c /* Copyright (c) 2015-2016, Wojciech Muła, Alfred Klomp, Daniel Lemire (Unless otherwise stated in the source code) @@ -45,7 +45,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://github.com/client9/stringencoders/blob/master/src/modp_b64.c +// https://github.com/client9/stringencoders/blob/e1448a9415f4ebf6f559c86718193ba067cbb99d/src/modp_b64.c /* The MIT License (MIT) diff --git a/Sources/GRPCCore/Internal/Metadata+GRPC.swift b/Sources/GRPCCore/Internal/Metadata+GRPC.swift index 8920140f6..bb1c74a0d 100644 --- a/Sources/GRPCCore/Internal/Metadata+GRPC.swift +++ b/Sources/GRPCCore/Internal/Metadata+GRPC.swift @@ -91,7 +91,7 @@ extension Metadata { self = .retryAfter(Duration(secondsComponent: seconds, attosecondsComponent: attoseconds)) } else { // Negative or not parseable means stop trying. - // Source: https://github.com/grpc/proposal/blob/master/A6-client-retries.md + // Source: https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A6-client-retries.md self = .stopRetrying } } diff --git a/Sources/GRPCCore/Status.swift b/Sources/GRPCCore/Status.swift index ed6636b7f..7a78c12e1 100644 --- a/Sources/GRPCCore/Status.swift +++ b/Sources/GRPCCore/Status.swift @@ -111,7 +111,7 @@ extension Status { /// /// The outcome of every RPC is indicated by a status code. public struct Code: Hashable, CustomStringConvertible, Sendable { - // Source: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md + // Source: https://github.com/grpc/grpc/blob/6c0578099835c854b0ff36a4b8db98ed49278ed5/doc/statuscodes.md enum Wrapped: UInt8, Hashable, Sendable { case ok = 0 case cancelled = 1 diff --git a/Sources/GRPCCore/Timeout.swift b/Sources/GRPCCore/Timeout.swift index 68dfcd145..68fa49779 100644 --- a/Sources/GRPCCore/Timeout.swift +++ b/Sources/GRPCCore/Timeout.swift @@ -46,7 +46,7 @@ struct Timeout: CustomStringConvertible, Hashable, Sendable { } /// The wire encoding of this timeout as described in the gRPC protocol. - /// See "Timeout" in https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests + /// See "Timeout" in https://github.com/grpc/grpc/blob/6c0578099835c854b0ff36a4b8db98ed49278ed5/doc/PROTOCOL-HTTP2.md#requests var wireEncoding: String { "\(amount)\(unit.rawValue)" } diff --git a/Sources/GRPCCore/Transport/RetryThrottle.swift b/Sources/GRPCCore/Transport/RetryThrottle.swift index e3f3ead4f..6b52739d9 100644 --- a/Sources/GRPCCore/Transport/RetryThrottle.swift +++ b/Sources/GRPCCore/Transport/RetryThrottle.swift @@ -29,7 +29,7 @@ private import Synchronization /// ``HedgingPolicy/nonFatalStatusCodes``) or when the client receives a pushback response from /// the server. /// -/// See also [gRFC A6: client retries](https://github.com/grpc/proposal/blob/master/A6-client-retries.md). +/// See also [gRFC A6: client retries](https://github.com/grpc/proposal/blob/0e1807a6e30a1a915c0dcadc873bca92b9fa9720/A6-client-retries.md). public final class RetryThrottle: Sendable { // Note: only three figures after the decimal point from the original token ratio are used so // all computation is done a scaled number of tokens (tokens * 1000). This allows us to do all diff --git a/Sources/GRPCInProcessTransport/Documentation.docc/Documentation.md b/Sources/GRPCInProcessTransport/Documentation.docc/Documentation.md index c57b262b9..19d0ab978 100644 --- a/Sources/GRPCInProcessTransport/Documentation.docc/Documentation.md +++ b/Sources/GRPCInProcessTransport/Documentation.docc/Documentation.md @@ -13,5 +13,5 @@ use cases. ### Transports - ``InProcessTransport`` -- ``InProcessClientTransport`` -- ``InProcessServerTransport`` +- ``InProcessTransport/Client`` +- ``InProcessTransport/Server`` diff --git a/Sources/GRPCInProcessTransport/InProcessTransport+Client.swift b/Sources/GRPCInProcessTransport/InProcessTransport+Client.swift index 84c7f85a7..11828108c 100644 --- a/Sources/GRPCInProcessTransport/InProcessTransport+Client.swift +++ b/Sources/GRPCInProcessTransport/InProcessTransport+Client.swift @@ -18,13 +18,13 @@ public import GRPCCore private import Synchronization extension InProcessTransport { - /// An in-process implementation of a ``ClientTransport``. + /// An in-process implementation of a `ClientTransport`. /// /// This is useful when you're interested in testing your application without any actual networking layers /// involved, as the client and server will communicate directly with each other via in-process streams. /// - /// To use this client, you'll have to provide a ``ServerTransport`` upon creation, as well - /// as a ``ServiceConfig``. + /// To use this client, you'll have to provide a `ServerTransport` upon creation, as well + /// as a `ServiceConfig`. /// /// Once you have a client, you must keep a long-running task executing ``connect()``, which /// will return only once all streams have been finished and ``beginGracefulShutdown()`` has been called on this client; or @@ -34,7 +34,7 @@ extension InProcessTransport { /// called before ``connect()`` is called, then any streams will remain pending and the call will /// block until ``connect()`` is called or the task is cancelled. /// - /// - SeeAlso: ``ClientTransport`` + /// - SeeAlso: `ClientTransport` public final class Client: ClientTransport { private enum State: Sendable { struct UnconnectedState { @@ -187,7 +187,7 @@ extension InProcessTransport { /// Signal to the transport that no new streams may be created. /// /// Existing streams may run to completion naturally but calling ``withStream(descriptor:options:_:)`` - /// will result in an ``RPCError`` with code ``RPCError/Code/failedPrecondition`` being thrown. + /// will result in an `RPCError` with code `RPCError/Code/failedPrecondition` being thrown. /// /// If you want to forcefully cancel all active streams then cancel the task running ``connect()``. public func beginGracefulShutdown() { @@ -215,7 +215,7 @@ extension InProcessTransport { /// /// - Important: The opened stream is closed after the closure is finished. /// - /// This transport implementation throws ``RPCError/Code/failedPrecondition`` if the transport + /// This transport implementation throws `RPCError/Code/failedPrecondition` if the transport /// is closing or has been closed. /// /// This implementation will queue any streams (and thus block this call) if this function is called before diff --git a/Sources/GRPCInProcessTransport/InProcessTransport+Server.swift b/Sources/GRPCInProcessTransport/InProcessTransport+Server.swift index 02b132ac8..953d2ffdb 100644 --- a/Sources/GRPCInProcessTransport/InProcessTransport+Server.swift +++ b/Sources/GRPCInProcessTransport/InProcessTransport+Server.swift @@ -18,16 +18,16 @@ public import GRPCCore private import Synchronization extension InProcessTransport { - /// An in-process implementation of a ``ServerTransport``. + /// An in-process implementation of a `ServerTransport`. /// /// This is useful when you're interested in testing your application without any actual networking layers /// involved, as the client and server will communicate directly with each other via in-process streams. /// /// To use this server, you call ``listen(streamHandler:)`` and iterate over the returned `AsyncSequence` to get all - /// RPC requests made from clients (as ``RPCStream``s). + /// RPC requests made from clients (as `RPCStream`s). /// To stop listening to new requests, call ``beginGracefulShutdown()``. /// - /// - SeeAlso: ``ClientTransport`` + /// - SeeAlso: `ClientTransport` public final class Server: ServerTransport, Sendable { public typealias Inbound = RPCAsyncSequence public typealias Outbound = RPCWriter.Closable @@ -123,9 +123,9 @@ extension InProcessTransport { } } - /// Stop listening to any new ``RPCStream`` publications. + /// Stop listening to any new `RPCStream` publications. /// - /// - SeeAlso: ``ServerTransport`` + /// - SeeAlso: `ServerTransport` public func beginGracefulShutdown() { self.newStreamsContinuation.finish() for handle in self.handles.withLock({ $0.beginShutdown() }) { diff --git a/Tests/GRPCCoreTests/Configuration/Generated/rls_config.pb.swift b/Tests/GRPCCoreTests/Configuration/Generated/rls_config.pb.swift index bc6047eda..30b9e0419 100644 --- a/Tests/GRPCCoreTests/Configuration/Generated/rls_config.pb.swift +++ b/Tests/GRPCCoreTests/Configuration/Generated/rls_config.pb.swift @@ -141,7 +141,7 @@ struct Grpc_Lookup_V1_GrpcKeyBuilder: Sendable { /// /// Path and host patterns use the matching syntax from gRPC transcoding to /// extract named key/value pairs from the path and host components of the URL: -/// https://github.com/googleapis/googleapis/blob/master/google/api/http.proto +/// https://github.com/googleapis/googleapis/blob/bb6b53e326ce2db403d18be7158c265e07948920/google/api/http.proto /// /// It is invalid to specify the same key name in multiple places in a pattern. /// diff --git a/Tests/GRPCCoreTests/Configuration/Generated/service_config.pb.swift b/Tests/GRPCCoreTests/Configuration/Generated/service_config.pb.swift index c25062a78..9a154848d 100644 --- a/Tests/GRPCCoreTests/Configuration/Generated/service_config.pb.swift +++ b/Tests/GRPCCoreTests/Configuration/Generated/service_config.pb.swift @@ -1328,7 +1328,7 @@ struct Grpc_ServiceConfig_ServiceConfig: Sendable { /// If the deprecated load_balancing_policy field is used, note that if the /// resolver returns at least one balancer address (as opposed to backend /// addresses), gRPC will use grpclb (see - /// https://github.com/grpc/grpc/blob/master/doc/load-balancing.md), + /// https://github.com/grpc/grpc/blob/6c0578099835c854b0ff36a4b8db98ed49278ed5/doc/load-balancing.md), /// regardless of what policy is configured here. However, if the resolver /// returns at least one backend address in addition to the balancer /// address(es), the client may fall back to the requested policy if it diff --git a/dev/build-examples.sh b/dev/build-examples.sh index e44a8f5c6..4144dab2c 100755 --- a/dev/build-examples.sh +++ b/dev/build-examples.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/check-generated-code.sh b/dev/check-generated-code.sh index 67bc71b8e..3094c38b4 100755 --- a/dev/check-generated-code.sh +++ b/dev/check-generated-code.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 f1e75bc9d..7e4e46519 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 @@ -70,8 +69,7 @@ if "$lint"; then To fix, run the following command: % $here/format.sh -f - " - exit "${SWIFT_FORMAT_RC}" + " "${SWIFT_FORMAT_RC}" fi log "Ran swift format lint with no errors." diff --git a/dev/license-check.sh b/dev/license-check.sh index d540293aa..889478b31 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 01bf4d780..2032a2408 100755 --- a/dev/protos/fetch.sh +++ b/dev/protos/fetch.sh @@ -1,24 +1,22 @@ #!/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 here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" upstream="$here/upstream" -root="$here/../.." # Create a temporary directory for the repo checkouts. checkouts="$(mktemp -d)" diff --git a/dev/protos/generate.sh b/dev/protos/generate.sh index 666e87c49..5efb7018c 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/protos/upstream/grpc/lookup/v1/rls_config.proto b/dev/protos/upstream/grpc/lookup/v1/rls_config.proto index 9762be752..baf62b6a3 100644 --- a/dev/protos/upstream/grpc/lookup/v1/rls_config.proto +++ b/dev/protos/upstream/grpc/lookup/v1/rls_config.proto @@ -84,7 +84,7 @@ message GrpcKeyBuilder { // // Path and host patterns use the matching syntax from gRPC transcoding to // extract named key/value pairs from the path and host components of the URL: -// https://github.com/googleapis/googleapis/blob/master/google/api/http.proto +// https://github.com/googleapis/googleapis/blob/bb6b53e326ce2db403d18be7158c265e07948920/google/api/http.proto // // It is invalid to specify the same key name in multiple places in a pattern. // diff --git a/dev/protos/upstream/grpc/service_config/service_config.proto b/dev/protos/upstream/grpc/service_config/service_config.proto index 3367d0c45..17696c358 100644 --- a/dev/protos/upstream/grpc/service_config/service_config.proto +++ b/dev/protos/upstream/grpc/service_config/service_config.proto @@ -574,7 +574,7 @@ message ServiceConfig { // If the deprecated load_balancing_policy field is used, note that if the // resolver returns at least one balancer address (as opposed to backend // addresses), gRPC will use grpclb (see - // https://github.com/grpc/grpc/blob/master/doc/load-balancing.md), + // https://github.com/grpc/grpc/blob/6c0578099835c854b0ff36a4b8db98ed49278ed5/doc/load-balancing.md), // regardless of what policy is configured here. However, if the resolver // returns at least one backend address in addition to the balancer // address(es), the client may fall back to the requested policy if it diff --git a/dev/sanity.sh b/dev/soundness.sh similarity index 50% rename from dev/sanity.sh rename to dev/soundness.sh index de039b514..8c9f16e07 100755 --- a/dev/sanity.sh +++ b/dev/soundness.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 @@ -41,16 +40,11 @@ function check_license_headers() { run_logged "Checking license headers" "$here/license-check.sh" } -function check_formatting() { - run_logged "Checking formatting" "$here/format.sh -l" -} - function check_generated_code_is_up_to_date() { run_logged "Checking generated code is up-to-date" "$here/check-generated-code.sh" } errors=0 check_license_headers -check_formatting check_generated_code_is_up_to_date exit $errors