Merge pull request #15753 from miri64/dist/enh/vera++-annotate

dist/tools/vera++: annotate errors in Github Action
This commit is contained in:
Martine Lenders 2021-01-13 12:13:24 +01:00 committed by GitHub
commit 3c688e31ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ CURDIR=$(cd "$(dirname "$0")" && pwd)
: "${WARNING:=1}"
. "$RIOTBASE"/dist/tools/ci/changed_files.sh
. "$RIOTBASE"/dist/tools/ci/github_annotate.sh
# tests/pkg_utensor/models/deep_mlp_weight.hpp is an auto-generated file
# with lots of commas so T009 takes very long. Since it is auto-generated, just
# exclude it.
@ -29,5 +30,39 @@ fi
VERA_CMD="vera++ --root $CURDIR --exclusions $CURDIR/exclude $_QUIET"
# sets
# - LOG to tee output into for later parsing
# - LOGFILE to parse GitHub annotations into
github_annotate_setup
RESULT=0 # remove if script should error
echo "$FILES" | $VERA_CMD --profile riot \
--parameters $CURDIR/profiles/riot_params.txt -w
--parameters $CURDIR/profiles/riot_params.txt -w 2>&1 | ${LOG}
# Uncomment when the script should error
# RESULT=${PIPESTATUS[0]}
if github_annotate_is_on; then
_annotate() {
FILENAME=$(echo "${line}" | cut -d: -f1)
LINENUM=$(echo "${line}" | cut -d: -f2)
DETAILS=$(echo "${line}" | cut -d: -f3- |
sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
# parse if warning (errors don't have a label)
if echo "$DETAILS" | grep -q "^warning: "; then
DETAILS=$(echo "$DETAILS" | sed 's/^warning: //')
github_annotate_warning "$FILENAME" "$LINENUM" "$DETAILS"
else
# errors might start with "error:" (but don't have to)
DETAILS=$(echo "$DETAILS" | sed 's/^error: //')
github_annotate_error "$FILENAME" "$LINENUM" "$DETAILS"
fi
}
github_annotate_parse_log_default _annotate
fi
github_annotate_teardown
exit ${RESULT}