Skip to content

Commit b8ecccf

Browse files
Enable githubAction for lint check against any code changes in repo
Enable githubAction for lint check against any code changes in repo Signed-off-by: Praveen K Pandey <praveen@linux.vnet.ibm.com>
1 parent 40a48c7 commit b8ecccf

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/lint_cehck.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
on:
2+
push:
3+
branches:
4+
- 'master'
5+
pull_request:
6+
branches:
7+
- 'master'
8+
workflow_dispatch: # manual trigger
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10"]
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: |
24+
pip install -r requirements-travis.txt
25+
- name: List files in the repository
26+
run: |
27+
ls ${{ github.workspace }}
28+
- name: Analysing the code with pylint
29+
run: |
30+
inspekt checkall --disable-lint W,R,C,E1002,E1101,E1103,E1120,F0401,I0011,E0203,E711,W605,E721 --no-license-check
31+
inspekt indent
32+
inspekt style
33+
error=""
34+
for COMMIT in $(git rev-list ${{github.event.before}}..${{github.event.after}}); do
35+
echo "-----< $(git log -1 --oneline $COMMIT) >-----"
36+
msg=$(git show -s --format=%B $COMMIT)
37+
# Skip merge commits
38+
if [ $(echo "${msg::4}") == 'Merg' ]
39+
then
40+
continue
41+
fi
42+
# Skip some commits which make travis fail due to commit message
43+
list='8fd5b57 840e774 c35ffeb'
44+
for item in $list
45+
do
46+
if [ "$COMMIT" == "$item" ]; then
47+
echo "In the list"
48+
continue
49+
fi
50+
done
51+
# Test commit message size
52+
if [ $(echo "$msg" | wc -l) -ge 5 ]
53+
then
54+
echo "OK: Commit message size."
55+
else
56+
echo "ERR: Commit message is too short (less than 5 lines)."
57+
echo " Here a minimal template:"
58+
echo " ------------------------------------"
59+
echo " header <- Limited to 50 characters. No period."
60+
echo " <- Blank line"
61+
echo " message <- Any number of lines, limited to 72 characters per line."
62+
echo " <- Blank line"
63+
echo " Signed-off-by: <- Signature (created by git commit -s)"
64+
echo " ------------------------------------"
65+
error=true
66+
fi
67+
# Test commit message signature
68+
if echo "$msg" | grep -q 'Signed-off-by:'
69+
then
70+
echo "OK: 'Signed-off-by:' present."
71+
else
72+
echo "ERR: 'Signed-off-by:' not found (use '-s' in 'git commit')."
73+
error=true
74+
fi
75+
done
76+
# Look for errors
77+
if [ "$error" ]; then
78+
echo
79+
echo "Incremental smokecheck failed."
80+
exit 1
81+
fi

0 commit comments

Comments
 (0)