Skip to content

Commit bb6d8e7

Browse files
committed
Rework splint output parsing to make sure return values are always true unless
splint ran and reported error.
1 parent 3a21097 commit bb6d8e7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

.github/workflows/python-c-ext-sanity-check.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,13 @@ jobs:
8686
fetch-depth: 0 # This is necessary to get the commits
8787
- name: Lint with splint
8888
run: |
89-
touch splint.log
9089
# NOTE: we only run splint error check for changed C files to limit noise
9190
# NOTE: point splint to Ubuntu's custom /usr/include/python3.x for Python.h
9291
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$')"
9392
# NOTE: show splint warnings but don't fail unless it found critical errors
9493
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list $(python3-config --includes) &> splint.log || true
95-
cat splint.log
96-
grep '*** Cannot continue' splint.log && false
94+
[ ! -e splint.log ] || cat splint.log
95+
[ ! -e splint.log ] || ! grep -q ' Cannot continue' splint.log
9796
9897
lint-c-ext-python3-ubuntu-lts:
9998
# Mainly fallback when the above job doesn't work
@@ -113,15 +112,14 @@ jobs:
113112
fetch-depth: 0 # This is necessary to get the commits
114113
- name: Lint with splint
115114
run: |
116-
touch splint.log
117115
# NOTE: we only run splint error check for changed C files to limit noise
118116
# NOTE: point splint to Ubuntu's custom /usr/include/python3.x for Python.h
119117
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$')"
120118
# NOTE: splint complains about NATIVE_TSS_KEY_T in system header here
121119
# NOTE: show splint warnings but don't fail unless it found critical errors
122120
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list -DNATIVE_TSS_KEY_T=char $(python3-config --includes) &> splint.log || true
123-
cat splint.log
124-
grep '*** Cannot continue' splint.log && false
121+
[ ! -e splint.log ] || cat splint.log
122+
[ ! -e splint.log ] || ! grep -q ' Cannot continue' splint.log
125123
126124
lint-c-ext-python3-rocky9:
127125
name: Sanity check c-extension module code in default python3 on Rocky9
@@ -155,12 +153,11 @@ jobs:
155153
run: |
156154
# NOTE: perms are not right inside container so repeat what checkout module does.
157155
git config --global --add safe.directory "$PWD"
158-
touch splint.log
159156
# NOTE: we only run splint error check for changed C files to limit noise
160157
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$')"
161158
echo "with splint from $(which splint)"
162159
ls -l /bin/splint
163160
# NOTE: show splint warnings but don't fail unless it found critical errors
164161
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list &> splint.log || true
165-
cat splint.log
166-
grep '*** Cannot continue' splint.log && false
162+
[ ! -e splint.log ] || cat splint.log
163+
[ ! -e splint.log ] || ! grep -q ' Cannot continue' splint.log

0 commit comments

Comments
 (0)