-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add protobuf generated code for Go #12
Changes from 4 commits
7079d79
664d32f
ea8c293
decf85e
e1db5aa
d1d4d05
d005d7e
346a912
a8d46f4
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 @@ | ||
*.pb.go linguist-generated |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# | ||
# Copyright 2022 The Sigstore Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: Generate code | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
generate_go: | ||
name: Generate go code | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3 | ||
|
||
- name: Compile protobuf | ||
run: | | ||
make proto | ||
|
||
- name: Ensure no files were modified as a result of the codegen | ||
run: git update-index --refresh && git diff-index --quiet HEAD -- || git diff --exit-code |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,24 @@ | ||||||
# | ||||||
# Copyright 2022 The Sigstore Authors. | ||||||
# | ||||||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
# you may not use this file except in compliance with the License. | ||||||
# You may obtain a copy of the License at | ||||||
# | ||||||
# http://www.apache.org/licenses/LICENSE-2.0 | ||||||
# | ||||||
# Unless required by applicable law or agreed to in writing, software | ||||||
# distributed under the License is distributed on an "AS IS" BASIS, | ||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
# See the License for the specific language governing permissions and | ||||||
# limitations under the License. | ||||||
|
||||||
PROTOC_IMAGE := namely/protoc-all:1.50_0 | ||||||
asraa marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
# generate Go protobuf code | ||||||
proto: | ||||||
@echo "Generating Protobuf files" | ||||||
docker run -v ${PWD}:/defs ${PROTOC_IMAGE} -i protos -f envelope.proto -l go --go-module-prefix github.com/secure-systems-lab | ||||||
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. Cool that this works! I think the correct package path is this though:
Suggested change
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. This I was actually unsure about: the generated DSSE code lives here in protobuf-specs for now, and without that the imports for the other files that depend on it might get messed up. I actually think I might be able ot preserve the secure-systems-lab part, let me see. 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. Yeah :| I'm not sure I can preserve the module path outside of protobuf-specs... if I do, I end up with this error:
|
||||||
docker run -v ${PWD}:/defs ${PROTOC_IMAGE} -i protos -f sigstore_common.proto -l go --go-module-prefix github.com/sigstore | ||||||
docker run -v ${PWD}:/defs ${PROTOC_IMAGE} -i protos -f sigstore_rekor.proto -l go --go-module-prefix github.com/sigstore | ||||||
docker run -v ${PWD}:/defs ${PROTOC_IMAGE} -i protos -f sigstore_bundle.proto -l go --go-module-prefix github.com/sigstore |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
# protobuf-specs | ||
|
||
This repository holds protobuf specifications for Sigstore messages. | ||
|
||
## Protobuf | ||
|
||
If you change protobuf definitions, you will need to regenerate the code by running the protocol buffer compiler on the changed `.proto` files. | ||
|
||
You will need [Docker](https://docs.docker.com/get-docker/) installed to generate the protobuf stubs. Then run, | ||
|
||
``` | ||
$ make proto | ||
``` | ||
|
||
to generate the `*.pb.go` files under `gen/`. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Assuming we want this running on all pull requests, prior to merge, I think this needs to not have a
branches
key.Edit: updated with
types
andpaths
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.
I'm not an Actions expert, so you might need to play with these settings a bit until it starts building this PR.
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.
Ohhh i think i can leave it blank maybe, with the paths
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.
I think the branches is for targetted against, so understood if it's meant to capture all branches.
Either new workflows aren't triggered in the pull request itself or I've done something wrong still
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.
Yeah, maybe it needs to be merged before it starts working. We can fix in a follow-up if not!