From bf590f114c4a8ed705a019a2b886e3e405d72447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rold=C3=A1n=20Betancort?= Date: Mon, 25 Mar 2024 08:38:32 +0000 Subject: [PATCH 1/3] generate multiple java files From https://protobuf.dev/reference/java/java-generated/#invocation When the option java_multiple_files = true is enabled, Then the compiler will also create separate .java files for each of the classes/enums which it will generate for each top-level message, enumeration, and service declared in the .proto file. The goal is to have this option stop generating "OuterClass" named classes for better ergonomics. --- authzed/api/v1/core.proto | 1 + authzed/api/v1/debug.proto | 1 + authzed/api/v1/error_reason.proto | 1 + authzed/api/v1/experimental_service.proto | 1 + authzed/api/v1/openapi.proto | 1 + authzed/api/v1/permission_service.proto | 1 + authzed/api/v1/schema_service.proto | 1 + authzed/api/v1/watch_service.proto | 1 + 8 files changed, 8 insertions(+) diff --git a/authzed/api/v1/core.proto b/authzed/api/v1/core.proto index 72d98d2..1e67cab 100644 --- a/authzed/api/v1/core.proto +++ b/authzed/api/v1/core.proto @@ -3,6 +3,7 @@ package authzed.api.v1; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_package = "com.authzed.api.v1"; +option java_multiple_files = true; import "google/protobuf/struct.proto"; import "validate/validate.proto"; diff --git a/authzed/api/v1/debug.proto b/authzed/api/v1/debug.proto index f17cbcf..3f72f0a 100644 --- a/authzed/api/v1/debug.proto +++ b/authzed/api/v1/debug.proto @@ -8,6 +8,7 @@ import "google/protobuf/duration.proto"; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_package = "com.authzed.api.v1"; +option java_multiple_files = true; // DebugInformation defines debug information returned by an API call in a footer when // requested with a specific debugging header. diff --git a/authzed/api/v1/error_reason.proto b/authzed/api/v1/error_reason.proto index 1526852..b6cb014 100644 --- a/authzed/api/v1/error_reason.proto +++ b/authzed/api/v1/error_reason.proto @@ -3,6 +3,7 @@ package authzed.api.v1; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_package = "com.authzed.api.v1"; +option java_multiple_files = true; // Defines the supported values for `google.rpc.ErrorInfo.reason` for the // `authzed.com` error domain. diff --git a/authzed/api/v1/experimental_service.proto b/authzed/api/v1/experimental_service.proto index d24e1c8..8e5990a 100644 --- a/authzed/api/v1/experimental_service.proto +++ b/authzed/api/v1/experimental_service.proto @@ -3,6 +3,7 @@ package authzed.api.v1; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_package = "com.authzed.api.v1"; +option java_multiple_files = true; import "google/api/annotations.proto"; import "validate/validate.proto"; diff --git a/authzed/api/v1/openapi.proto b/authzed/api/v1/openapi.proto index 693f52a..d6bcbff 100644 --- a/authzed/api/v1/openapi.proto +++ b/authzed/api/v1/openapi.proto @@ -3,6 +3,7 @@ package authzed.api.v1; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_package = "com.authzed.api.v1"; +option java_multiple_files = true; import "protoc-gen-openapiv2/options/annotations.proto"; diff --git a/authzed/api/v1/permission_service.proto b/authzed/api/v1/permission_service.proto index 22afeea..9ad6c33 100644 --- a/authzed/api/v1/permission_service.proto +++ b/authzed/api/v1/permission_service.proto @@ -3,6 +3,7 @@ package authzed.api.v1; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_package = "com.authzed.api.v1"; +option java_multiple_files = true; import "google/protobuf/struct.proto"; import "google/api/annotations.proto"; diff --git a/authzed/api/v1/schema_service.proto b/authzed/api/v1/schema_service.proto index e13f554..08c3a66 100644 --- a/authzed/api/v1/schema_service.proto +++ b/authzed/api/v1/schema_service.proto @@ -3,6 +3,7 @@ package authzed.api.v1; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_package = "com.authzed.api.v1"; +option java_multiple_files = true; import "google/api/annotations.proto"; import "validate/validate.proto"; diff --git a/authzed/api/v1/watch_service.proto b/authzed/api/v1/watch_service.proto index f8f49df..263985e 100644 --- a/authzed/api/v1/watch_service.proto +++ b/authzed/api/v1/watch_service.proto @@ -3,6 +3,7 @@ package authzed.api.v1; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_package = "com.authzed.api.v1"; +option java_multiple_files = true; import "google/api/annotations.proto"; import "validate/validate.proto"; From 7a8b8183e50febeb5d1651380331c35ee28a19f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rold=C3=A1n=20Betancort?= Date: Mon, 25 Mar 2024 08:45:09 +0000 Subject: [PATCH 2/3] only report breakage at the binary+json level --- buf.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buf.yaml b/buf.yaml index ba500ff..b50e11a 100644 --- a/buf.yaml +++ b/buf.yaml @@ -8,3 +8,6 @@ deps: lint: ignore: - "authzed/api/v0" # legacy from before we used buf +breaking: + use: + - "WIRE_JSON" From db4a5c7460f1926142f9c3627077a5798959d1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rold=C3=A1n=20Betancort?= Date: Mon, 25 Mar 2024 08:49:51 +0000 Subject: [PATCH 3/3] push branches once validated --- .github/workflows/lint.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index f510454..4d81237 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -10,14 +10,14 @@ on: - "*" jobs: lint: - name: "Lint" + name: "Lint & Publish Draft/Branch" runs-on: "ubuntu-latest" steps: - uses: "actions/checkout@v3" - uses: "authzed/actions/yaml-lint@main" - - uses: "bufbuild/buf-setup-action@v1" + - uses: "bufbuild/buf-setup-action@v1.30.0" with: - version: "1.22.0" + version: "1.30.0" - uses: "bufbuild/buf-lint-action@v1" - uses: "bufbuild/buf-breaking-action@v1" if: "github.event_name == 'pull_request'" @@ -33,3 +33,15 @@ jobs: env: BUF_TOKEN: "${{ secrets.BUF_REGISTRY_TOKEN }}" run: "buf push --draft ${{ github.sha }}" + - name: "Push to BSR a Draft" + if: "github.event_name == 'push' && github.ref == 'refs/heads/main'" + shell: "bash" + env: + BUF_TOKEN: "${{ secrets.BUF_REGISTRY_TOKEN }}" + run: "buf push --draft ${{ github.sha }}" + - name: "Push to BSR a Branch" + if: "github.event_name == 'push' && github.ref != 'refs/heads/main'" + shell: "bash" + env: + BUF_TOKEN: "${{ secrets.BUF_REGISTRY_TOKEN }}" + run: "buf push --branch ${{ github.sha }}"