From d8fae8fc92e95f7233e6a36a12f22327f6205bb4 Mon Sep 17 00:00:00 2001 From: "Philip K. Warren" Date: Fri, 3 Nov 2023 14:29:31 -0500 Subject: [PATCH] Update buf to version with protovalidate linter (#15) --- .github/workflows/buf.yaml | 30 ++++++++++++++----- Makefile | 2 +- buf/registry/owner/v1beta1/organization.proto | 8 ++--- buf/registry/owner/v1beta1/owner.proto | 8 ++--- buf/registry/owner/v1beta1/user.proto | 8 ++--- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/buf.yaml b/.github/workflows/buf.yaml index e850a7c..94ad9be 100644 --- a/.github/workflows/buf.yaml +++ b/.github/workflows/buf.yaml @@ -3,20 +3,34 @@ on: push: jobs: lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1 - - uses: bufbuild/buf-lint-action@v1.0.3 + - uses: actions/checkout@v4 + - name: install + uses: actions/setup-go@v4 + with: + go-version: 1.21.x + - name: cache + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-registry-proto-ci-${{ hashFiles('**/Makefile') }} + restore-keys: ${{ runner.os }}-registry-proto-ci- + - name: Lint + run: | + make lint push: environment: production - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' needs: - lint steps: - - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1 - - uses: bufbuild/buf-push-action@v1.1.1 + - uses: actions/checkout@v4 + - name: Install buf cli + uses: bufbuild/buf-setup-action@v1 + with: + github_token: ${{ github.token }} + - uses: bufbuild/buf-push-action@v1 with: buf_token: ${{ secrets.BUF_TOKEN }} diff --git a/Makefile b/Makefile index fc73706..a536dbc 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ BIN := .tmp/bin export PATH := $(BIN):$(PATH) export GOBIN := $(abspath $(BIN)) -BUF_VERSION := v1.27.1 +BUF_VERSION := 21ba19590be4afe6fa3af0406e138c4fdc36fedf COPYRIGHT_YEARS := 2023 .PHONY: help diff --git a/buf/registry/owner/v1beta1/organization.proto b/buf/registry/owner/v1beta1/organization.proto index ba8ee05..fd1e1c9 100644 --- a/buf/registry/owner/v1beta1/organization.proto +++ b/buf/registry/owner/v1beta1/organization.proto @@ -78,9 +78,9 @@ message OrganizationRef { // The id of the Organization. string id = 1 [(buf.validate.field).string.uuid = true]; // The name of the Organization. - string name = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.max_len = 255 - ]; + string name = 2 [(buf.validate.field).string = { + min_len: 1; + max_len: 255; + }]; } } diff --git a/buf/registry/owner/v1beta1/owner.proto b/buf/registry/owner/v1beta1/owner.proto index f86fc13..0330f33 100644 --- a/buf/registry/owner/v1beta1/owner.proto +++ b/buf/registry/owner/v1beta1/owner.proto @@ -47,9 +47,9 @@ message OwnerRef { // The id of the User or Organization. string id = 1 [(buf.validate.field).string.uuid = true]; // The name of the User or Organization. - string name = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.max_len = 255 - ]; + string name = 2 [(buf.validate.field).string = { + min_len: 1; + max_len: 255; + }]; } } diff --git a/buf/registry/owner/v1beta1/user.proto b/buf/registry/owner/v1beta1/user.proto index deb0f12..788ac58 100644 --- a/buf/registry/owner/v1beta1/user.proto +++ b/buf/registry/owner/v1beta1/user.proto @@ -116,9 +116,9 @@ message UserRef { // The id of the User. string id = 1 [(buf.validate.field).string.uuid = true]; // The name of the User. - string name = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.max_len = 255 - ]; + string name = 2 [(buf.validate.field).string = { + min_len: 1; + max_len: 255; + }]; } }