extended the Python script checks in the CI and adjusted some scripts (#3186)
This commit is contained in:
parent
182ae75290
commit
4d526dcbf7
|
@ -10,7 +10,8 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
|
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -41,12 +42,12 @@ jobs:
|
||||||
python -m pip install psutil
|
python -m pip install psutil
|
||||||
|
|
||||||
- name: run Shellcheck
|
- name: run Shellcheck
|
||||||
if: matrix.python-version == '3.8'
|
if: matrix.python-version == '3.9'
|
||||||
run: |
|
run: |
|
||||||
find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231
|
find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231
|
||||||
|
|
||||||
- name: run pylint
|
- name: run pylint
|
||||||
if: matrix.python-version == '3.8'
|
if: matrix.python-version == '3.9'
|
||||||
run: |
|
run: |
|
||||||
pylint --rcfile=pylintrc_travis addons/*.py
|
pylint --rcfile=pylintrc_travis addons/*.py
|
||||||
pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport
|
pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport
|
||||||
|
@ -54,20 +55,22 @@ jobs:
|
||||||
pylint --rcfile=pylintrc_travis tools/*.py
|
pylint --rcfile=pylintrc_travis tools/*.py
|
||||||
|
|
||||||
- name: check .json files
|
- name: check .json files
|
||||||
if: matrix.python-version == '3.8'
|
if: matrix.python-version == '3.9'
|
||||||
run: |
|
run: |
|
||||||
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
|
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
|
||||||
|
|
||||||
- name: Validate
|
- name: Validate
|
||||||
if: matrix.python-version == '3.8'
|
if: matrix.python-version == '3.9'
|
||||||
run: |
|
run: |
|
||||||
make -j$(nproc) validateCFG validatePlatforms validateRules
|
make -j$(nproc) validateCFG validatePlatforms validateRules
|
||||||
|
|
||||||
- name: check python syntax
|
- name: check python syntax
|
||||||
if: matrix.python-version != '2.7'
|
if: matrix.python-version != '2.7'
|
||||||
run: |
|
run: |
|
||||||
python -m py_compile ./tools/donate-cpu.py
|
python -m py_compile addons/*.py
|
||||||
python -m py_compile ./tools/donate-cpu-server.py
|
python -m py_compile htmlreport/cppcheck-htmlreport
|
||||||
|
python -m py_compile htmlreport/*.py
|
||||||
|
python -m py_compile tools/*.py
|
||||||
|
|
||||||
- name: compile addons
|
- name: compile addons
|
||||||
run: |
|
run: |
|
||||||
|
@ -79,7 +82,7 @@ jobs:
|
||||||
PYTHONPATH=./addons python -m pytest addons/test/test-*.py
|
PYTHONPATH=./addons python -m pytest addons/test/test-*.py
|
||||||
|
|
||||||
- name: dmake
|
- name: dmake
|
||||||
if: matrix.python-version == '3.8'
|
if: matrix.python-version == '3.9'
|
||||||
run: |
|
run: |
|
||||||
make -j$(nproc) run-dmake
|
make -j$(nproc) run-dmake
|
||||||
git diff --exit-code
|
git diff --exit-code
|
||||||
|
|
|
@ -12,7 +12,7 @@ import subprocess
|
||||||
CPPCHECK = os.path.expanduser('~/cppcheck/cppcheck')
|
CPPCHECK = os.path.expanduser('~/cppcheck/cppcheck')
|
||||||
|
|
||||||
def run_cppcheck(cppcheck_parameters:str, clang:str):
|
def run_cppcheck(cppcheck_parameters:str, clang:str):
|
||||||
cmd = f'{CPPCHECK} {cppcheck_parameters} {clang} --debug --verbose'
|
cmd = '{} {} {} --debug --verbose'.format(CPPCHECK, cppcheck_parameters, clang)
|
||||||
#print(cmd)
|
#print(cmd)
|
||||||
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
comm = p.communicate()
|
comm = p.communicate()
|
||||||
|
@ -63,7 +63,7 @@ def compare_ast_symdb(cppcheck_parameters: str):
|
||||||
ast1 = get_ast(debug1)
|
ast1 = get_ast(debug1)
|
||||||
ast2 = get_ast(debug2)
|
ast2 = get_ast(debug2)
|
||||||
if ast1 != ast2:
|
if ast1 != ast2:
|
||||||
print(f"ast is not the same: {cppcheck_parameters}")
|
print("ast is not the same: {}".format(cppcheck_parameters))
|
||||||
with open('cppcheck.ast', 'wt') as f:
|
with open('cppcheck.ast', 'wt') as f:
|
||||||
f.write(ast1)
|
f.write(ast1)
|
||||||
with open('clang.ast', 'wt') as f:
|
with open('clang.ast', 'wt') as f:
|
||||||
|
@ -73,7 +73,7 @@ def compare_ast_symdb(cppcheck_parameters: str):
|
||||||
symdb1 = get_symdb(debug1)
|
symdb1 = get_symdb(debug1)
|
||||||
symdb2 = get_symdb(debug2)
|
symdb2 = get_symdb(debug2)
|
||||||
if symdb1 != symdb2:
|
if symdb1 != symdb2:
|
||||||
print(f"symdb is not the same: {cppcheck_parameters}")
|
print("symdb is not the same: {}".format(cppcheck_parameters))
|
||||||
with open('cppcheck.symdb', 'wt') as f:
|
with open('cppcheck.symdb', 'wt') as f:
|
||||||
f.write(symdb1)
|
f.write(symdb1)
|
||||||
with open('clang.symdb', 'wt') as f:
|
with open('clang.symdb', 'wt') as f:
|
||||||
|
|
|
@ -6,7 +6,6 @@ TRACDB = 'trac.db'
|
||||||
|
|
||||||
|
|
||||||
def readdb():
|
def readdb():
|
||||||
global TRACDB
|
|
||||||
cmds = ['sqlite3', TRACDB, 'SELECT id,keywords FROM ticket WHERE status<>"closed";']
|
cmds = ['sqlite3', TRACDB, 'SELECT id,keywords FROM ticket WHERE status<>"closed";']
|
||||||
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
comm = p.communicate()
|
comm = p.communicate()
|
||||||
|
@ -25,9 +24,9 @@ def readdb():
|
||||||
ret[kw].append(nr)
|
ret[kw].append(nr)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if arg.endswith('/trac.db'):
|
if arg.endswith('/trac.db'):
|
||||||
global TRACDB
|
|
||||||
TRACDB = arg
|
TRACDB = arg
|
||||||
|
|
||||||
data = readdb()
|
data = readdb()
|
||||||
|
|
Loading…
Reference in New Issue