зеркало из https://github.com/github/vitess-gh.git
Fix the script `check_make_sizegen` (#11465)
* Fix check_make_sizegen Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Apply review suggestion Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Fail the static_check_etc workflow when a script fails Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Remove test code Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
This commit is contained in:
Родитель
bd8d5c8577
Коммит
4a49da2c96
|
@ -135,17 +135,17 @@ 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
|
||||
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
- name: run ensure_bootstrap_version
|
||||
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
|
||||
|
@ -168,7 +168,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'
|
||||
|
@ -187,4 +187,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
|
||||
|
|
|
@ -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
|
||||
second_output=$(git status --porcelain)
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче