Repository navigation
Add reproducible protoc toolchain and proto-check CI (#307) #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
3d59702
341e2d3
7632f58
a5ea080
91d555c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: Protos | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'pkg/protocol/protobuf/**' | ||
| - 'Dockerfile.protoc' | ||
| - 'Makefile' | ||
| - '.github/workflows/protos.yml' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'pkg/protocol/protobuf/**' | ||
| - 'Dockerfile.protoc' | ||
| - 'Makefile' | ||
| - '.github/workflows/protos.yml' | ||
|
|
||
| jobs: | ||
| check: | ||
| name: Verify generated protos are up to date | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Run proto-check | ||
| run: make proto-check | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Dockerfile.protoc — reproducible protoc + protoc-gen-go toolchain. | ||
| # | ||
| # The versions below are pinned to match the headers of the committed | ||
| # *.pb.go files in pkg/protocol/protobuf/ (the runtime version printed | ||
| # by protoc is "3.21.9", which corresponds to the upstream release | ||
| # tag "v21.9"). Bumping either ARG will typically produce a diff in the | ||
| # regenerated code; run `make proto-gen-docker` and commit the result | ||
| # in the same change. | ||
|
|
||
| FROM golang:1.23.0-bookworm AS toolchain | ||
|
|
||
| ARG PROTOC_VERSION=21.9 | ||
| ARG PROTOC_GEN_GO_VERSION=1.28.1 | ||
| # SHA256 sums for the official protoc release archives. Update these when | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Makfile overrides the version but not the hashes, so the Makefile override is useless. Probably cleanest just to scrap it. |
||
| # bumping PROTOC_VERSION; values can be recomputed with `sha256sum` against | ||
| # the assets at https://github.com/protocolbuffers/protobuf/releases. | ||
| ARG PROTOC_SHA256_X86_64=3cd951aff8ce713b94cde55e12378f505f2b89d47bf080508cf77e3934f680b6 | ||
| ARG PROTOC_SHA256_AARCH_64=a584286dfa8ebb17032ece206ed74d5e9931e2edb9016e427be2a0dab3b21071 | ||
| ARG TARGETARCH | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get install --no-install-recommends -y curl unzip ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # protoc release archives use x86_64 / aarch_64 in their file names. | ||
| RUN case "${TARGETARCH:-amd64}" in \ | ||
| amd64) PROTOC_ARCH=x86_64; PROTOC_SHA256="${PROTOC_SHA256_X86_64}" ;; \ | ||
| arm64) PROTOC_ARCH=aarch_64; PROTOC_SHA256="${PROTOC_SHA256_AARCH_64}" ;; \ | ||
| *) echo "unsupported TARGETARCH=${TARGETARCH}" >&2; exit 1 ;; \ | ||
| esac \ | ||
| && curl -fsSL -o /tmp/protoc.zip \ | ||
| "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip" \ | ||
| && echo "${PROTOC_SHA256} /tmp/protoc.zip" | sha256sum -c - \ | ||
| && unzip -q /tmp/protoc.zip -d /usr/local/protoc \ | ||
| && rm /tmp/protoc.zip \ | ||
| && chmod +x /usr/local/protoc/bin/protoc | ||
|
Comment on lines
+31
to
+36
|
||
|
|
||
| RUN go install "google.golang.org/protobuf/cmd/protoc-gen-go@v${PROTOC_GEN_GO_VERSION}" | ||
|
|
||
| ENV PATH="/usr/local/protoc/bin:/go/bin:${PATH}" | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| ENTRYPOINT ["protoc"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add read-only permissions declaration