Skip to content

Test proto files are properly generated in every language we use #238

@llucax

Description

@llucax

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:

Metadata

Metadata

Assignees

Labels

part:ciAffects the GitHub workflow and other parts for running CIpart:only-apiAffects the configuration of a api repopart:templateAffects the cookiecutter template filestype:enhancementNew feature or enhancement visitble to users

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions