Skip to content

Commit

Permalink
fix: run codegen during build
Browse files Browse the repository at this point in the history
  • Loading branch information
lesam committed Jul 19, 2021
1 parent a8ef6ae commit 321bb69
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [#21707](https://github.com/influxdata/influxdb/pull/21707): chore: add logging to compaction
- [#21752](https://github.com/influxdata/influxdb/pull/21752): feat: add total-buffer-bytes config parameter to subscriptions
- [#21820](https://github.com/influxdata/influxdb/pull/21820): chore: update flux to v0.120.1
- [#21882](https://github.com/influxdata/influxdb/pull/21882): chore: update protobuf library versions and remove influx_tsm

### Bugfixes

Expand Down
1 change: 1 addition & 0 deletions Dockerfile_build_ubuntu64
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
make \
mercurial \
pkg-config \
protobuf-compiler \
python \
python3-pip \
python3 \
Expand Down
8 changes: 8 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ def run_tests(race, parallel, timeout, no_vet, junit=False):
logging.error("Code not formatted. Please use 'goimports -w ./' to fix formatting errors.")
logging.error("{}".format(out))
return False

logging.info("Ensuring codegen is up to date ...")
out = run("./generate.sh")
if len(out) > 0:
logging.error("Please use 'go generate ./...' to regenerate generated code.")
logging.error("{}".format(out))
return False

if not no_vet:
logging.info("Running 'go vet'...")
out = run(go_vet_command)
Expand Down
18 changes: 18 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -e

go install github.com/gogo/protobuf/protoc-gen-gogofaster

function check_changes () {
changes="$(git status --porcelain=v1 2>/dev/null)"
if [ -n "$changes" ] ; then
echo $1
echo "$changes"
exit 1
fi
}

check_changes "git is dirty before running generate!"

go generate ./...

check_changes "git is dirty after running generate!"

0 comments on commit 321bb69

Please sign in to comment.