Skip to content

Commit fa5b4fe

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 fa5b4fe

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/lint_cehck.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
echo $(git rev-list ${{github.event.before}}...${{github.event.after}})
35+
for COMMIT in $(git rev-list ${{github.event.before}}...${{github.event.after}}); do
36+
echo "-----< $(git log -1 --oneline $COMMIT) >-----"
37+
msg=$(git show -s --format=%B $COMMIT)
38+
# Skip merge commits
39+
if [ $(echo "${msg::4}") == 'Merg' ]
40+
then
41+
continue
42+
fi
43+
# Skip some commits which make travis fail due to commit message
44+
list='8fd5b57 840e774 c35ffeb'
45+
for item in $list
46+
do
47+
if [ "$COMMIT" == "$item" ]; then
48+
echo "In the list"
49+
continue
50+
fi
51+
done
52+
# Test commit message size
53+
if [ $(echo "$msg" | wc -l) -ge 5 ]
54+
then
55+
echo "OK: Commit message size."
56+
else
57+
echo "ERR: Commit message is too short (less than 5 lines)."
58+
echo " Here a minimal template:"
59+
echo " ------------------------------------"
60+
echo " header <- Limited to 50 characters. No period."
61+
echo " <- Blank line"
62+
echo " message <- Any number of lines, limited to 72 characters per line."
63+
echo " <- Blank line"
64+
echo " Signed-off-by: <- Signature (created by git commit -s)"
65+
echo " ------------------------------------"
66+
error=true
67+
fi
68+
# Test commit message signature
69+
if echo "$msg" | grep -q 'Signed-off-by:'
70+
then
71+
echo "OK: 'Signed-off-by:' present."
72+
else
73+
echo "ERR: 'Signed-off-by:' not found (use '-s' in 'git commit')."
74+
error=true
75+
fi
76+
done
77+
# Look for errors
78+
if [ "$error" ]; then
79+
echo
80+
echo "Incremental smokecheck failed."
81+
exit 1
82+
fi

0 commit comments

Comments
 (0)