Add CI step to detect possible problematic usage of trap

see for example this change:
https://github.com/osbuild/osbuild-composer/pull/3681/commits/13a3ca24ceef05164a77db1c71b929e262098f41
This commit is contained in:
Alexander Todorov 2024-02-27 10:45:24 +02:00 committed by Alexander Todorov
parent 1fa98e4253
commit c534689d57

View file

@ -215,6 +215,7 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38
with:
@ -224,6 +225,20 @@ jobs:
# allow seemingly unreachable commands
SHELLCHECK_OPTS: -e SC1091 -e SC2002 -e SC2317
- name: Do not doube trap signals inside test scripts
run: |
FILES_WITH_DOUBLE_TRAP=$(grep trap test/cases/* -R | cut -f1 -d: | sort | uniq -c | grep -v 1 || echo -n)
echo "INFO: ----- files with possible double calls to 'trap' -----"
echo "$FILES_WITH_DOUBLE_TRAP"
echo "---------- END ----------"
if [ -n "$FILES_WITH_DOUBLE_TRAP" ]; then
echo "FAIL: Do not double 'trap' signals"
echo "INFO: because this may lead to cleanup() function not being executed"
exit 1
fi
rpmlint:
name: "📦 RPMlint"
runs-on: ubuntu-20.04