Skip to content

Commit

Permalink
Merge pull request #223 from authzed/use-remote-plugins-and-bump-version
Browse files Browse the repository at this point in the history
Use remote plugins for build
  • Loading branch information
vroldanbet authored Nov 13, 2024
2 parents f01b2d4 + cb13b75 commit 4d44ce1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 86 deletions.
43 changes: 4 additions & 39 deletions .github/workflows/automatic-api-update.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
name: "Called update for API change"
on:
repository_dispatch:
types: ["api_update"]
jobs:
test:
name: "Create PR for API update"
timeout-minutes: 10
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
Expand All @@ -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 }}"
Expand All @@ -27,50 +27,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/[email protected]"
if: "steps.buf-update.outputs.updated == 'true'"
with:
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 }}"
43 changes: 4 additions & 39 deletions .github/workflows/manual-api-update.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: "Update for API change"
on:
workflow_dispatch:
Expand All @@ -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"
Expand All @@ -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 }}"
Expand All @@ -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/[email protected]"
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 }}"
14 changes: 6 additions & 8 deletions buf.gen.yaml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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.38.0"

0 comments on commit 4d44ce1

Please sign in to comment.