forked from container-storage-interface/spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch versions the generated CSI protobuf and provides a Travis-CI build step that verifies the protobuf is up-to-date before allowing any changes to be merged. Additionally this patch also adds minimal Go language bindings in order to verify the specification. Finally, scaffolding was put into place in order to support Cxx language bindings in the future as well.
- Loading branch information
Showing
13 changed files
with
7,362 additions
and
212 deletions.
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
csi.proto | ||
csi.pb.go | ||
/csi.proto.tmp | ||
.DS_Store |
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,26 +1,38 @@ | ||
go_import_path: github.com/container-storage-interface/spec | ||
# Setting "sudo" to false forces Travis-CI to use its | ||
# container-based build infrastructure, which has shorter | ||
# queue times. | ||
sudo: false | ||
|
||
language: go | ||
# Use the newer Travis-CI build templates based on the | ||
# Debian Linux distribution "Trusty" release. | ||
dist: trusty | ||
|
||
go: | ||
- 1.8.x | ||
# Selecting C as the language keeps the container to a | ||
# minimum footprint. | ||
language: c | ||
|
||
before_install: | ||
- gem install gist | ||
- curl -LO https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip | ||
- unzip protoc-3.3.0-linux-x86_64.zip | ||
- chmod +x bin/protoc | ||
- export PATH="$(pwd)/bin:$PATH" | ||
jobs: | ||
include: | ||
|
||
install: | ||
- go get -u github.com/golang/protobuf/proto | ||
- go get -u github.com/golang/protobuf/protoc-gen-go | ||
- go get -u google.golang.org/grpc | ||
- CSI_SPEC_FILE=spec.md make csi.proto | ||
# The test stage validates that the protobuf file was updated | ||
# correctly prior to being committed. | ||
- stage: test | ||
script: make | ||
|
||
script: | ||
- make csi.pb.go | ||
# The lang stages validate the specification using | ||
# language-specific bindings. | ||
|
||
after_success: | ||
- printf "%s" "$GITHUB_API_TOKEN" > "${HOME}/.gist" | ||
- gist -d "https://travis-ci.org/container-storage-interface/spec/jobs/${TRAVIS_BUILD_ID}" *.{proto,go} | ||
# Lang stage: Cxx | ||
- stage: lang | ||
script: make -C lib/cxx | ||
|
||
# Lang stage: Go | ||
- stage: lang | ||
language: go | ||
go: 1.8.3 | ||
go_import_path: github.com/container-storage-interface/spec | ||
install: | ||
- make -C lib/go protoc | ||
- make -C lib/go protoc-gen-go | ||
script: | ||
- make -C lib/go |
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
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,8 +1,46 @@ | ||
all: build | ||
|
||
include csi.mk | ||
CSI_SPEC := spec.md | ||
CSI_PROTO := csi.proto | ||
|
||
build: $(CSI_PROTO) $(CSI_GOSRC) | ||
# This is the target for building the temporary CSI protobuf file. | ||
# | ||
# The temporary file is not versioned, and thus will always be | ||
# built on Travis-CI. | ||
$(CSI_PROTO).tmp: $(CSI_SPEC) | ||
cat $? | \ | ||
sed -n -e '/```protobuf$$/,/```$$/ p' | \ | ||
sed -e 's@^```.*$$@////////@g' > $@ | ||
|
||
# This is the target for building the CSI protobuf file. | ||
# | ||
# This target depends on its temp file, which is not versioned. | ||
# Therefore when built on Travis-CI the temp file will always | ||
# be built and trigger this target. On Travis-CI the temp file | ||
# is compared with the real file, and if they differ the build | ||
# will fail. | ||
# | ||
# Locally the temp file is simply copied over the real file. | ||
$(CSI_PROTO): $(CSI_PROTO).tmp | ||
ifeq (true,$(TRAVIS)) | ||
diff "$@" "$?" | ||
else | ||
diff "$@" "$?" > /dev/null 2>&1 || cp -f "$?" "$@" | ||
endif | ||
|
||
build: $(CSI_PROTO) | ||
|
||
# If this is not running on Travis-CI then for sake of convenience | ||
# go ahead and update the language bindings as well. | ||
ifneq (true,$(TRAVIS)) | ||
build: | ||
$(MAKE) -C lib/go | ||
$(MAKE) -C lib/cxx | ||
endif | ||
|
||
clean: | ||
rm -f $(CSI_PROTO) $(CSI_GOSRC) | ||
|
||
clobber: clean | ||
rm -f $(CSI_PROTO) $(CSI_PROTO).tmp | ||
|
||
.PHONY: clean clobber |
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
Oops, something went wrong.