Skip to content
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
10 changes: 5 additions & 5 deletions .github/workflows/static_checks_etc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:

- name: Run golangci-lint
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.go_files == 'true'
run: $(go env GOPATH)/bin/golangci-lint run go/...
run: $(go env GOPATH)/bin/golangci-lint run go/... || exit 1

- name: Run go mod tidy
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.go_files == 'true'
Expand All @@ -156,19 +156,19 @@ jobs:
- name: check_make_parser
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.parser_changes == 'true'
run: |
tools/check_make_parser.sh
tools/check_make_parser.sh || exit 1

## Sizegen
- name: check_make_sizegen
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.sizegen == 'true'
run: |
tools/check_make_sizegen.sh
tools/check_make_sizegen.sh || exit 1

## Visitor
- name: check_make_visitor
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.visitor == 'true'
run: |
misc/git/hooks/asthelpers
misc/git/hooks/asthelpers || exit 1

## Docker
- name: run ensure_bootstrap_version
Expand All @@ -182,4 +182,4 @@ jobs:
- name: check_make_proto
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.proto_changes == 'true'
run: |
tools/check_make_proto.sh
tools/check_make_proto.sh || exit 1
45 changes: 9 additions & 36 deletions tools/check_make_sizegen.sh
Original file line number Diff line number Diff line change
@@ -1,49 +1,22 @@
#!/bin/bash

#
# Validate that the current version of the generated cache_size files match the output
# generated by sizegen.
#
# This is used in Travis to verify that the currently committed version was
# generated with the proper cache_size files.

source build.env

TMP="/tmp/cached_size.$$.go"
ALL_FILES=$(find . -name "cached_size.go")

set +e

goimports -local vitess.io/vitess -w $ALL_FILES

for SRC in $ALL_FILES
do
TMP="/tmp/"$(echo "$SRC" | sed 's/\//_/g' | sed "s/cached_size.go/cached_size_$$.go/g")
mv "$SRC" "$TMP"
done
first_output=$(git status --porcelain)

make sizegen

STATUS=0

for SRC in $ALL_FILES
do
TMP="/tmp/"$(echo "$SRC" | sed 's/\//_/g' | sed "s/cached_size.go/cached_size_$$.go/g")

if [ ! -f "$SRC" ]; then
mv "$TMP" "$SRC"
continue
fi

if ! diff -q "$SRC" "$TMP" > /dev/null ; then
echo "ERROR: Regenerated file for $SRC does not match the current version:"
diff -u "$SRC" "$TMP"

echo
echo "Please re-run 'make sizegen' to generate."
STATUS=1
fi
mv "$TMP" "$SRC"
done
second_output=$(git status --porcelain)

exit $STATUS
diff=$(diff <( echo "$first_output") <( echo "$second_output"))

if [[ "$diff" != "" ]]; then
echo "ERROR: Regenerated cached_size files do not match the current version."
echo -e "List of files containing differences:\n$diff"
exit 1
fi