Skip to content

Commit 8464eff

Browse files
committed
Add CI pipeline
- Shellcheck (errors only) - Python compileall for most Python versions supported
1 parent dab2f0b commit 8464eff

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
ShellCheck:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v7
15+
- name: Run ShellCheck (errors only)
16+
# Check every tracked file that has a .sh extension or an sh/bash
17+
# shebang. SC2148 (missing shebang) is excluded because many .sh
18+
# files are sourced fragments or dracut hooks; ShellCheck then
19+
# falls back to checking them as bash.
20+
run: |
21+
{
22+
git ls-files '*.sh'
23+
git ls-files | while IFS= read -r f; do
24+
[ -f "$f" ] || continue
25+
head -c 200 "$f" | head -n 1 | \
26+
grep -qE '^#!.*[/ ](sh|bash|dash|ash|ksh)([ \t]|$)' && echo "$f"
27+
done
28+
} | sort -u | xargs -d '\n' shellcheck --severity=error --exclude=SC2148
29+
30+
python-compileall:
31+
name: Python compileall
32+
runs-on: ubuntu-latest
33+
env:
34+
# One entry per Python version shipped by the distros confluent
35+
# targets, limited to versions actions/setup-python still provides
36+
# on current runners (sles15/alma8 ship 3.6, which is unavailable).
37+
# Newline-separated so it feeds both setup-python (multiline input)
38+
# and the shell loop below (word-split on whitespace).
39+
PYTHON_VERSIONS: |
40+
3.8
41+
3.9
42+
3.10
43+
3.12
44+
3.13
45+
3.14
46+
steps:
47+
- uses: actions/checkout@v7
48+
- uses: actions/setup-python@v6
49+
with:
50+
python-version: ${{ env.PYTHON_VERSIONS }}
51+
- name: Compile all Python files
52+
run: |
53+
rc=0
54+
for v in $PYTHON_VERSIONS; do
55+
echo "::group::Python $v"
56+
if "python$v" -W error -m compileall -q -x '/\.git/' .; then
57+
echo "::endgroup::"
58+
else
59+
echo "::endgroup::"
60+
echo "::error::Python $v compileall failed"
61+
rc=1
62+
fi
63+
done
64+
exit "$rc"

0 commit comments

Comments
 (0)