What's needed?
Once we move away the Python generation from API repositories, we'll still need to make sure proto files can be properly generated.
Proposed solution
Use the protoc compiler to build the proto files, ideally for all language we make bindings for, and the most mainstream languages (like go or C++). Generating more languages might surface issues not present in every language, and we want to ideally stay as compatible as possible with all.
Additional context
One example is detection of unused imports, python and rust generation doesn't detect this, but go generation does.
Please see this CI job adding an extra CI step to do this in the microgrid API:
protoc:
name: Test with protoc
runs-on: ubuntu-20.04
steps:
- name: Fetch sources
uses: actions/checkout@v4
with:
submodules: true
- name: Source protoc
run: |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip
mkdir protoc
unzip protoc-25.1-linux-x86_64.zip -d protoc
sudo cp -r protoc/bin/* /usr/bin/
sudo cp -r protoc/include/* /usr/include/
rm -r protoc-25.1-linux-x86_64.zip protoc
- name: Run sanity tests
run: |
protoc \
--fatal_warnings \
-I proto \
-I submodules/frequenz-api-common/proto \
-I submodules/api-common-protos \
--python_out=. \
frequenz/api/microgrid/v1/microgrid.proto
From:
What's needed?
Once we move away the Python generation from API repositories, we'll still need to make sure proto files can be properly generated.
Proposed solution
Use the
protoccompiler to build the proto files, ideally for all language we make bindings for, and the most mainstream languages (like go or C++). Generating more languages might surface issues not present in every language, and we want to ideally stay as compatible as possible with all.Additional context
One example is detection of unused imports, python and rust generation doesn't detect this, but go generation does.
Please see this CI job adding an extra CI step to do this in the microgrid API:
From:
protocwith fatal warnings frequenz-api-microgrid#237