2020-07-30 10:37:14 +02:00
|
|
|
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
|
|
|
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
|
|
|
|
name: scriptcheck
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
2022-08-26 23:25:07 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-07-30 10:37:14 +02:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2022-05-31 19:55:57 +02:00
|
|
|
# 'ubuntu-22.04' removes Python 2.7, 3.6 and 3.6 so keep the previous LTS version
|
2020-12-15 10:59:09 +01:00
|
|
|
runs-on: ubuntu-20.04
|
2021-12-11 15:21:39 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2022-08-27 15:06:16 +02:00
|
|
|
- name: ccache
|
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
|
|
with:
|
|
|
|
key: scriptcheck-${{ runner.os }}
|
|
|
|
|
2021-12-11 15:21:39 +01:00
|
|
|
- name: Cache Cppcheck
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: cppcheck
|
|
|
|
key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }}
|
|
|
|
|
|
|
|
- name: build cppcheck
|
|
|
|
run: |
|
2022-08-27 15:06:16 +02:00
|
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
2021-12-11 15:21:39 +01:00
|
|
|
make -j$(nproc) -s
|
|
|
|
strip -s ./cppcheck
|
|
|
|
|
|
|
|
scriptcheck:
|
|
|
|
|
|
|
|
needs: build
|
2022-05-31 19:55:57 +02:00
|
|
|
# 'ubuntu-22.04' removes Python 2.7, 3.5 and 3.6 so keep the previous LTS version
|
2021-12-11 15:21:39 +01:00
|
|
|
runs-on: ubuntu-20.04
|
2021-02-20 13:26:28 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-05-05 21:49:01 +02:00
|
|
|
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10']
|
2021-03-31 22:09:42 +02:00
|
|
|
fail-fast: false
|
2020-07-30 10:37:14 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2021-12-11 15:21:39 +01:00
|
|
|
- name: Restore Cppcheck
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: cppcheck
|
|
|
|
key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }}
|
|
|
|
|
2021-02-20 13:26:28 +01:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2021-04-09 07:47:11 +02:00
|
|
|
- name: Install missing software on ubuntu
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install tidy libxml2-utils
|
|
|
|
|
2021-02-20 13:26:28 +01:00
|
|
|
- name: Install missing software on ubuntu (Python 2)
|
|
|
|
if: matrix.python-version == '2.7'
|
|
|
|
run: |
|
|
|
|
python -m pip install pip --upgrade
|
2022-02-24 16:08:59 +01:00
|
|
|
python -m pip install pathlib
|
2021-02-20 13:26:28 +01:00
|
|
|
python -m pip install pytest
|
2021-04-09 07:47:11 +02:00
|
|
|
python -m pip install pygments
|
2021-02-20 13:26:28 +01:00
|
|
|
|
|
|
|
- name: Install missing software on ubuntu (Python 3)
|
|
|
|
if: matrix.python-version != '2.7'
|
2020-07-30 10:37:14 +02:00
|
|
|
run: |
|
2021-04-09 07:47:11 +02:00
|
|
|
sudo apt-get install shellcheck
|
2021-02-20 13:26:28 +01:00
|
|
|
python -m pip install pip --upgrade
|
|
|
|
python -m pip install natsort
|
|
|
|
python -m pip install pexpect
|
|
|
|
python -m pip install pylint
|
|
|
|
python -m pip install unittest2
|
|
|
|
python -m pip install pytest
|
2022-05-16 12:58:54 +02:00
|
|
|
python -m pip install pygments
|
2021-02-20 13:26:28 +01:00
|
|
|
python -m pip install requests
|
2021-02-27 03:19:08 +01:00
|
|
|
python -m pip install psutil
|
2021-02-20 13:26:28 +01:00
|
|
|
|
2020-07-30 10:37:14 +02:00
|
|
|
- name: run Shellcheck
|
2021-10-11 19:14:46 +02:00
|
|
|
if: matrix.python-version == '3.10'
|
2020-07-30 10:37:14 +02:00
|
|
|
run: |
|
2021-01-20 18:43:49 +01:00
|
|
|
find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231
|
2020-07-30 10:37:14 +02:00
|
|
|
|
|
|
|
- name: run pylint
|
2021-10-11 19:14:46 +02:00
|
|
|
if: matrix.python-version == '3.10'
|
2020-07-30 10:37:14 +02:00
|
|
|
run: |
|
2022-06-16 10:28:55 +02:00
|
|
|
echo "FIXME pylint is disabled for now because it fails to import files:"
|
|
|
|
echo "FIXME addons/runaddon.py:1:0: E0401: Unable to import 'cppcheckdata' (import-error)"
|
|
|
|
echo "FIXME addons/runaddon.py:1:0: E0401: Unable to import 'cppcheck' (import-error)"
|
2022-06-16 09:09:44 +02:00
|
|
|
# pylint --rcfile=pylintrc_travis --jobs $(nproc) addons/*.py htmlreport/cppcheck-htmlreport htmlreport/*.py tools/*.py
|
2020-09-05 18:29:19 +02:00
|
|
|
|
|
|
|
- name: check .json files
|
2021-10-11 19:14:46 +02:00
|
|
|
if: matrix.python-version == '3.10'
|
2020-09-05 18:29:19 +02:00
|
|
|
run: |
|
2021-02-20 13:26:28 +01:00
|
|
|
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
|
|
|
|
|
2021-02-21 14:17:02 +01:00
|
|
|
- name: Validate
|
2021-10-11 19:14:46 +02:00
|
|
|
if: matrix.python-version == '3.10'
|
2021-02-21 14:17:02 +01:00
|
|
|
run: |
|
|
|
|
make -j$(nproc) validateCFG validatePlatforms validateRules
|
|
|
|
|
2021-02-20 13:26:28 +01:00
|
|
|
- name: check python syntax
|
|
|
|
if: matrix.python-version != '2.7'
|
|
|
|
run: |
|
2021-03-31 22:09:42 +02:00
|
|
|
python -m py_compile addons/*.py
|
|
|
|
python -m py_compile htmlreport/cppcheck-htmlreport
|
|
|
|
python -m py_compile htmlreport/*.py
|
|
|
|
python -m py_compile tools/*.py
|
2021-02-20 13:26:28 +01:00
|
|
|
|
|
|
|
- name: compile addons
|
|
|
|
run: |
|
|
|
|
python -m compileall ./addons
|
2020-11-24 07:48:13 +01:00
|
|
|
|
2021-04-03 21:22:39 +02:00
|
|
|
- name: test matchcompiler
|
|
|
|
run: |
|
|
|
|
python tools/test_matchcompiler.py
|
|
|
|
|
2021-04-09 07:47:11 +02:00
|
|
|
- name: test addons
|
|
|
|
run: |
|
2022-07-13 21:09:29 +02:00
|
|
|
python -m pytest -v addons/test/test-*.py
|
2021-04-09 07:47:11 +02:00
|
|
|
env:
|
|
|
|
PYTHONPATH: ./addons
|
|
|
|
|
|
|
|
- name: test htmlreport
|
|
|
|
run: |
|
|
|
|
htmlreport/test_htmlreport.py
|
|
|
|
cd htmlreport
|
|
|
|
./check.sh
|
2021-02-21 14:17:02 +01:00
|
|
|
|
2022-03-19 19:42:44 +01:00
|
|
|
- name: test reduce
|
|
|
|
run: |
|
2022-07-13 21:09:29 +02:00
|
|
|
python -m pytest -v tools/test_reduce.py
|
|
|
|
env:
|
|
|
|
PYTHONPATH: ./tools
|
|
|
|
|
|
|
|
- name: test donate_cpu_lib
|
|
|
|
if: matrix.python-version != '2.7'
|
|
|
|
run: |
|
|
|
|
python -m pytest -v tools/test_donate_cpu_lib.py
|
2022-03-19 19:42:44 +01:00
|
|
|
env:
|
|
|
|
PYTHONPATH: ./tools
|
|
|
|
|
2021-02-21 14:17:02 +01:00
|
|
|
- name: dmake
|
2021-10-11 19:14:46 +02:00
|
|
|
if: matrix.python-version == '3.10'
|
2021-02-21 14:17:02 +01:00
|
|
|
run: |
|
|
|
|
make -j$(nproc) run-dmake
|
|
|
|
git diff --exit-code
|