Skip to content
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

CI should check that generated code has been committed #127

Merged
merged 3 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ PROTOC_VERSION="3.5.1"
echo "Downloading protoc v${PROTOC_VERSION} for ${platform}..."
mkdir -p protoc
if [[ $platform == 'Linux' ]]; then
curl -L https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip | tar xz -C protoc
PROTOC_URL="https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip"
elif [[ $platform == 'Mac' ]]; then
curl -L https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-x86_64.zip | tar xz -C protoc
PROTOC_URL="https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-x86_64.zip"
else
echo "Cannot download protoc. ${platform} is not currently supported by ts-protoc-gen"
exit 1
fi

wget ${PROTOC_URL} --output-document="protoc-${PROTOC_VERSION}.zip"
unzip "protoc-${PROTOC_VERSION}.zip" -d protoc
rm "protoc-${PROTOC_VERSION}.zip"

PROTOC=./protoc/bin/protoc

echo "Generating proto definitions..."
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions travis-ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@ set -ex

npm run lint
npm test

./generate.sh
MODIFIED_FILES=$(git diff --name-only)
if [[ -n $MODIFIED_FILES ]]; then
echo "ERROR: Changes detected in generated code, please run './generate.sh' and check-in the changes."
Copy link
Contributor

@easyCZ easyCZ Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will unfortunately NOT be invisible to our users and hence they won't be able to self-fix this. Not sure if we have a fix for this. We could make the project visible but not modifiable to the public?

exit 1
fi

bazel build //...:all