-
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7079d79
add proto code gen
asraa 664d32f
update
asraa ea8c293
update
asraa decf85e
fix image
asraa e1db5aa
use generated go packages
asraa d1d4d05
update
asraa d005d7e
update
asraa 346a912
only on proto changes
asraa a8d46f4
Add dockerfile for updates
asraa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.pb.go linguist-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/sigstore/protobuf-specs/gen/pb-go | ||
docker run -v ${PWD}:/defs ${PROTOC_IMAGE} -i protos -f sigstore_common.proto -l go --go-module-prefix github.com/sigstore/protobuf-specs/gen/pb-go | ||
docker run -v ${PWD}:/defs ${PROTOC_IMAGE} -i protos -f sigstore_rekor.proto -l go --go-module-prefix github.com/sigstore/protobuf-specs/gen/pb-go | ||
docker run -v ${PWD}:/defs ${PROTOC_IMAGE} -i protos -f sigstore_bundle.proto -l go --go-module-prefix github.com/sigstore/protobuf-specs/gen/pb-go | ||
asraa marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/`. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!