-
Notifications
You must be signed in to change notification settings - Fork 20
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 Makefile and CI to run make build #11
Merged
Merged
Changes from all commits
Commits
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,17 @@ | ||
name: protoc | ||
|
||
on: | ||
pull_request: | ||
branches: [ '*' ] | ||
|
||
jobs: | ||
test-protoc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: generate go libs using protoc | ||
run: | | ||
make build | ||
make check-changes |
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,8 @@ | ||
# binary dir | ||
bin | ||
|
||
# pkg dir | ||
dist | ||
|
||
# dependency dir | ||
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,76 @@ | ||
# Copyright 2021 The kube-storage Authors. All rights reserved. | ||
# | ||
# 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. | ||
|
||
SHELL:=/bin/bash | ||
iamniting marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
PROTOC_VERSION := 3.14.0 | ||
PROTOC_GEN_GO_VERSION := 1.25.0 | ||
PROTOC_GEN_GO_GRPC_VERSION := 1.1.0 | ||
|
||
PROTOC_FOUND := $(shell ./bin/protoc --version 2> /dev/null) | ||
PROTOC_GEN_GO_FOUND := $(shell ./bin/protoc-gen-go --version 2> /dev/null) | ||
PROTOC_GEN_GO_GRPC_FOUND := $(shell ./bin/protoc-gen-go-grpc --version 2> /dev/null) | ||
|
||
|
||
ifeq ("${PROTOC_FOUND}","libprotoc ${PROTOC_VERSION}") | ||
HAVE_PROTOC = "yes" | ||
endif | ||
|
||
ifeq ("${PROTOC_GEN_GO_FOUND}","protoc-gen-go v${PROTOC_GEN_GO_VERSION}") | ||
HAVE_PROTOC_GEN_GO = "yes" | ||
endif | ||
|
||
ifeq ("${PROTOC_GEN_GO_GRPC_FOUND}","protoc-gen-go-grpc ${PROTOC_GEN_GO_GRPC_VERSION}") | ||
HAVE_PROTOC_GEN_GO_GRPC = "yes" | ||
endif | ||
|
||
iamniting marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
all: install-deps build | ||
|
||
build: install-deps | ||
# generate libs | ||
./bin/protoc --go_out=lib/go/replication --go_opt=paths=source_relative --plugin=./bin/protoc-gen-go replication.proto | ||
./bin/protoc --go-grpc_out=lib/go/replication --go-grpc_opt=paths=source_relative --plugin=./bin/protoc-gen-go-grpc replication.proto | ||
|
||
install-deps: | ||
mkdir -p bin dist google/protobuf | ||
ifndef HAVE_PROTOC | ||
# download protoc | ||
wget -P dist/ --backups=1 \ | ||
https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip | ||
unzip -jod bin dist/protoc-${PROTOC_VERSION}-linux-x86_64.zip bin/protoc | ||
|
||
# extract include/google/protobuf/descriptor.proto | ||
unzip -jod google/protobuf dist/protoc-${PROTOC_VERSION}-linux-x86_64.zip include/google/protobuf/descriptor.proto | ||
endif | ||
|
||
ifndef HAVE_PROTOC_GEN_GO | ||
# download protoc-gen-go | ||
wget -P dist/ --backups=1 \ | ||
https://github.com/protocolbuffers/protobuf-go/releases/download/v${PROTOC_GEN_GO_VERSION}/protoc-gen-go.v${PROTOC_GEN_GO_VERSION}.linux.386.tar.gz | ||
tar -C bin -zxvf dist/protoc-gen-go.v${PROTOC_GEN_GO_VERSION}.linux.386.tar.gz protoc-gen-go | ||
endif | ||
|
||
ifndef HAVE_PROTOC_GEN_GO_GRPC | ||
# download protoc-gen-go-grpc | ||
wget -P dist/ --backups=1 \ | ||
https://github.com/grpc/grpc-go/releases/download/cmd%2Fprotoc-gen-go-grpc%2Fv${PROTOC_GEN_GO_GRPC_VERSION}/protoc-gen-go-grpc.v${PROTOC_GEN_GO_GRPC_VERSION}.linux.386.tar.gz | ||
tar -C bin -zxvf dist/protoc-gen-go-grpc.v${PROTOC_GEN_GO_GRPC_VERSION}.linux.386.tar.gz ./protoc-gen-go-grpc | ||
endif | ||
|
||
check-changes: | ||
output=`git status -z *.go | tr '\0' '\n'`; if test -z "$$output"; then echo "all good"; else echo "files got changed" exit 1; fi | ||
|
||
clean-deps: | ||
rm -rf bin dist google |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
can we check that pushed*.go files are not having any changes once we do make the build here?
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.
Done