Files
lidm/assets/github_scripts/build.sh
javalsai 8f0213db74 misc batch of fixes before v1.2.3 (#65)
* fix some formatter and linter issues
* make clang-tidy/clang-format fail with error status and output in github error format
* docs, add kmscon thing
* and some CI stuff
2025-07-20 21:50:12 +02:00

49 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if [ -z "$ARCH" ]; then
echo "\$ARCH not present" >&2
exit 1
fi
ERR=0
# shellcheck disable=SC2034
make -j"$(nproc)" "$@" 2> /tmp/stderr || ERR=$?
BSIZE=$(stat --printf="%s" lidm)
HSIZE=$(numfmt --to=iec-i<<<"$BSIZE")B
WARNS=$(
sed -nE \
's/^([^ ]+\.[ch]):([0-9]+):([0-9]+): ([a-z]+): (.*)$/::\4 file=\1,line=\2,col=\3::\5/p' \
/tmp/stderr
)
WARNS_NUM=$({ [[ "$WARNS" == "" ]] && echo 0; } || wc -l <<<"$WARNS")
echo "$WARNS"
{
echo "# Build for $ARCH"
echo ""
if [ -s "/tmp/stderr" ]; then
echo "<details><summary><code>stderr</code></summary>"
echo ""
echo "\`\`\`"
cat "/tmp/stderr"
echo "\`\`\`"
echo ""
echo "</details>"
else
echo "*no \`stderr\` to show*"
fi
echo ""
echo "## Stats"
echo "* **Filesize:** $HSIZE ($BSIZE B)"
echo "* **Warnings & Errors:** $WARNS_NUM"
} >> "$GITHUB_STEP_SUMMARY"
if [ "$ERR" -ne 0 ]; then exit "$ERR"; fi
mv lidm lidm-"$ARCH"
echo "DESCR='$HSIZE, $WARNS_NUM warnings'" >> "$GITHUB_OUTPUT"