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
|
|
|
|
|
2023-09-01 18:52:20 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'releases/**'
|
|
|
|
tags:
|
|
|
|
- '2.*'
|
|
|
|
pull_request:
|
2020-07-30 10:37:14 +02:00
|
|
|
|
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:
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-12-11 15:21:39 +01:00
|
|
|
|
2022-08-27 15:06:16 +02:00
|
|
|
- name: ccache
|
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
|
|
with:
|
2022-09-03 21:21:24 +02:00
|
|
|
key: ${{ github.workflow }}-${{ runner.os }}
|
2022-08-27 15:06:16 +02:00
|
|
|
|
2021-12-11 15:21:39 +01:00
|
|
|
- name: Cache Cppcheck
|
2022-10-11 19:50:59 +02:00
|
|
|
uses: actions/cache@v3
|
2021-12-11 15:21:39 +01:00
|
|
|
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
|
2023-08-01 13:06:12 +02:00
|
|
|
# 'ubutunu-20.04' no longer works on 2.7 - TODO: re-added in a different way or remove support for it?
|
2021-12-11 15:21:39 +01:00
|
|
|
runs-on: ubuntu-20.04
|
2021-02-20 13:26:28 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-08-01 13:06:12 +02:00
|
|
|
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
|
2021-03-31 22:09:42 +02:00
|
|
|
fail-fast: false
|
2020-07-30 10:37:14 +02:00
|
|
|
|
|
|
|
steps:
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/checkout@v3
|
2020-07-30 10:37:14 +02:00
|
|
|
|
2021-12-11 15:21:39 +01:00
|
|
|
- name: Restore Cppcheck
|
2022-10-11 19:50:59 +02:00
|
|
|
uses: actions/cache@v3
|
2021-12-11 15:21:39 +01:00
|
|
|
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 }}
|
2022-10-11 19:50:59 +02:00
|
|
|
uses: actions/setup-python@v4
|
2021-02-20 13:26:28 +01:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2022-10-25 21:53:02 +02:00
|
|
|
check-latest: true
|
2021-02-20 13:26:28 +01:00
|
|
|
|
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: |
|
2022-10-25 21:53:02 +02:00
|
|
|
# shellcheck cannot be installed via pip
|
|
|
|
# ERROR: Could not find a version that satisfies the requirement shellcheck (from versions: none)
|
|
|
|
# ERROR: No matching distribution found for shellcheck
|
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
|
2022-10-25 21:53:02 +02:00
|
|
|
if: matrix.python-version == '3.11'
|
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
|
2022-10-25 21:53:02 +02:00
|
|
|
if: matrix.python-version == '3.11'
|
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
|
2022-10-25 21:53:02 +02:00
|
|
|
if: matrix.python-version == '3.11'
|
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
|
2022-10-25 21:53:02 +02:00
|
|
|
if: matrix.python-version == '3.11'
|
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
|
|
|
|
|
2022-09-29 21:55:44 +02:00
|
|
|
- name: test donate_cpu_server
|
|
|
|
if: matrix.python-version != '2.7'
|
|
|
|
run: |
|
|
|
|
python -m pytest -v tools/test_donate_cpu_server.py
|
|
|
|
env:
|
|
|
|
PYTHONPATH: ./tools
|
|
|
|
|
2021-02-21 14:17:02 +01:00
|
|
|
- name: dmake
|
2022-10-25 21:53:02 +02:00
|
|
|
if: matrix.python-version == '3.11'
|
2021-02-21 14:17:02 +01:00
|
|
|
run: |
|
|
|
|
make -j$(nproc) run-dmake
|
|
|
|
git diff --exit-code
|