From 60f4776d1659c3e2156d1efdb661dd1ff549b4cb Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Fri, 1 Nov 2024 16:55:52 -0600 Subject: [PATCH 1/4] Reformat to buf v2 and add input module --- buf.gen.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) mode change 100755 => 100644 buf.gen.yaml diff --git a/buf.gen.yaml b/buf.gen.yaml old mode 100755 new mode 100644 index aff055c..d214b31 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,13 +1,11 @@ -#!/usr/bin/env -S buf generate buf.build/authzed/api:v1.38.0 --template --- -version: "v1" +version: "v2" plugins: - - name: "python" + - remote: buf.build/protocolbuffers/python:v28.3 out: "." - - name: "grpc-python" + - remote: buf.build/grpc/python:v1.67.1 out: "." - path: "grpc_python_plugin" - - name: "mypy" - out: "." - - name: "mypy_grpc" + - remote: buf.build/community/nipunn1313-mypy:v3.6.0 out: "." +inputs: + - module: "buf.build/authzed/api:v1.37.0" From 9256b6551c153e27a2d2d93bc6053679947de678 Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Fri, 1 Nov 2024 16:56:45 -0600 Subject: [PATCH 2/4] Bump api version and regenerate --- buf.gen.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index d214b31..ba1aa0b 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -8,4 +8,4 @@ plugins: - remote: buf.build/community/nipunn1313-mypy:v3.6.0 out: "." inputs: - - module: "buf.build/authzed/api:v1.37.0" + - module: "buf.build/authzed/api:v1.38.0" From 33d1a9f3c7b247e5865cd7121b4a43f9fa67ba9b Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Fri, 1 Nov 2024 17:06:16 -0600 Subject: [PATCH 3/4] Make update actions use buf direclty --- .github/workflows/automatic-api-update.yaml | 43 ++------------------- .github/workflows/manual-api-update.yaml | 43 ++------------------- 2 files changed, 8 insertions(+), 78 deletions(-) diff --git a/.github/workflows/automatic-api-update.yaml b/.github/workflows/automatic-api-update.yaml index 2c92864..d9f5042 100644 --- a/.github/workflows/automatic-api-update.yaml +++ b/.github/workflows/automatic-api-update.yaml @@ -1,3 +1,4 @@ +--- name: "Called update for API change" on: repository_dispatch: @@ -5,7 +6,6 @@ on: jobs: test: name: "Create PR for API update" - timeout-minutes: 10 runs-on: "ubuntu-latest" steps: - uses: "actions/checkout@v4" @@ -16,7 +16,7 @@ jobs: with: api-commit: "${{ github.event.client_payload.BUFTAG }}" spec-path: "buf.gen.yaml" - file-format: "generate-shell-script" + file-format: "buf-gen-yaml" - name: "Output update status" env: UPDATED_STATUS: "${{ steps.buf-update.outputs.updated }}" @@ -27,45 +27,9 @@ jobs: with: github_token: "${{ secrets.GITHUB_TOKEN }}" if: "steps.buf-update.outputs.updated == 'true'" - - name: "Install Python" - uses: "actions/setup-python@v5" - if: "steps.buf-update.outputs.updated == 'true'" - with: - python-version: "3.10" - - name: "Setup Python Environment" - if: "steps.buf-update.outputs.updated == 'true'" - run: "pip install -U pip virtualenv" - - name: "Install Homebrew & gRPC" - if: "steps.buf-update.outputs.updated == 'true'" - run: | - bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/runner/.bash_profile - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH - brew install grpc - ls /home/linuxbrew/.linuxbrew/bin - - name: "Install Python Dependencies" - if: "steps.buf-update.outputs.updated == 'true'" - run: | - virtualenv ~/.cache/virtualenv/authzedpy - source ~/.cache/virtualenv/authzedpy/bin/activate - pip install poetry - poetry env info - poetry install - echo "/home/runner/.cache/virtualenv/authzedpy/bin" >> $GITHUB_PATH - python -V - whereis grpc_python_plugin - whereis protoc-gen-mypy - whereis protoc-gen-mypy_grpc - echo $GITHUB_PATH - name: "Run buf generate" if: "steps.buf-update.outputs.updated == 'true'" - run: | - ./buf.gen.yaml - - name: "Run poetry lock" - if: "steps.buf-update.outputs.updated == 'true'" - run: | - poetry lock + run: "buf generate" - name: "Create Pull Request" uses: "peter-evans/create-pull-request@v7.0.5" if: "steps.buf-update.outputs.updated == 'true'" @@ -73,4 +37,5 @@ jobs: delete-branch: "true" title: "Update API to ${{ github.event.client_payload.BUFTAG }}" branch: "api-change/${{ github.event.client_payload.BUFTAG }}" + base: "main" token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/manual-api-update.yaml b/.github/workflows/manual-api-update.yaml index 46c9b4b..39894bc 100644 --- a/.github/workflows/manual-api-update.yaml +++ b/.github/workflows/manual-api-update.yaml @@ -1,3 +1,4 @@ +--- name: "Update for API change" on: workflow_dispatch: @@ -9,7 +10,6 @@ on: jobs: test: name: "Create PR for API update" - timeout-minutes: 10 runs-on: "ubuntu-latest" steps: - uses: "actions/checkout@v4" @@ -20,7 +20,7 @@ jobs: with: api-commit: "${{ inputs.buftag }}" spec-path: "buf.gen.yaml" - file-format: "generate-shell-script" + file-format: "buf-gen-yaml" - name: "Output update status" env: UPDATED_STATUS: "${{ steps.buf-update.outputs.updated }}" @@ -31,50 +31,15 @@ jobs: with: github_token: "${{ secrets.GITHUB_TOKEN }}" if: "steps.buf-update.outputs.updated == 'true'" - - name: "Install Python" - uses: "actions/setup-python@v5" - if: "steps.buf-update.outputs.updated == 'true'" - with: - python-version: "3.10" - - name: "Setup Python Environment" - if: "steps.buf-update.outputs.updated == 'true'" - run: "pip install -U pip virtualenv" - - name: "Install Homebrew & gRPC" - if: "steps.buf-update.outputs.updated == 'true'" - run: | - bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/runner/.bash_profile - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH - brew install grpc - ls /home/linuxbrew/.linuxbrew/bin - - name: "Install Python Dependencies" - if: "steps.buf-update.outputs.updated == 'true'" - run: | - virtualenv ~/.cache/virtualenv/authzedpy - source ~/.cache/virtualenv/authzedpy/bin/activate - pip install poetry - poetry env info - poetry install - echo "/home/runner/.cache/virtualenv/authzedpy/bin" >> $GITHUB_PATH - python -V - whereis grpc_python_plugin - whereis protoc-gen-mypy - whereis protoc-gen-mypy_grpc - echo $GITHUB_PATH - name: "Run buf generate" if: "steps.buf-update.outputs.updated == 'true'" - run: | - ./buf.gen.yaml - - name: "Run poetry lock" - if: "steps.buf-update.outputs.updated == 'true'" - run: | - poetry lock + run: "buf generate" - name: "Create Pull Request" uses: "peter-evans/create-pull-request@v7.0.5" if: "steps.buf-update.outputs.updated == 'true'" with: delete-branch: "true" title: "Update API to ${{ inputs.buftag }}" + base: "main" branch: "api-change/${{ inputs.buftag }}" token: "${{ secrets.GITHUB_TOKEN }}" From cb13b75c3465a1ae72662c3f7887ffd0a5197745 Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Tue, 12 Nov 2024 16:58:22 -0700 Subject: [PATCH 4/4] Add quotes --- buf.gen.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index ba1aa0b..e6877ea 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,11 +1,11 @@ --- version: "v2" plugins: - - remote: buf.build/protocolbuffers/python:v28.3 + - remote: "buf.build/protocolbuffers/python:v28.3" out: "." - - remote: buf.build/grpc/python:v1.67.1 + - remote: "buf.build/grpc/python:v1.67.1" out: "." - - remote: buf.build/community/nipunn1313-mypy:v3.6.0 + - remote: "buf.build/community/nipunn1313-mypy:v3.6.0" out: "." inputs: - module: "buf.build/authzed/api:v1.38.0"