From b1ccad5f02dab255f6b41d189c7d83153e0de315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sat, 20 Feb 2021 13:26:28 +0100 Subject: [PATCH] some Python-related CI cleanups (#3066) --- .github/workflows/coverage.yml | 3 +- .github/workflows/scriptcheck.yml | 60 +++++++++++++++++++++---------- .travis.yml | 14 -------- appveyor.yml | 3 +- 4 files changed, 45 insertions(+), 35 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b5f16d499..4d85940a8 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -19,7 +19,8 @@ jobs: sudo apt-get install libz3-dev libz3-4 sudo apt-get install lcov sudo apt-get install libcppunit-dev - pip install lcov_cobertura + python -m pip install pip --upgrade + python -m pip install lcov_cobertura - name: Compile instrumented run: | diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml index 8652fbafc..624ac74bf 100644 --- a/.github/workflows/scriptcheck.yml +++ b/.github/workflows/scriptcheck.yml @@ -8,44 +8,66 @@ jobs: build: runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [2.7, 3.5, 3.6, 3.7, 3.8] steps: - uses: actions/checkout@v2 - - name: Install missing software on ubuntu + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install missing software on ubuntu (Python 2) + if: matrix.python-version == '2.7' + run: | + python -m pip install pip --upgrade + python -m pip install pytest + + - name: Install missing software on ubuntu (Python 3) + if: matrix.python-version != '2.7' run: | - sudo apt-get update sudo apt-get install shellcheck - sudo apt-get install python3-setuptools - sudo pip3 install natsort - sudo pip3 install pexpect - sudo pip3 install pylint - sudo pip3 install unittest2 - sudo pip install pytest - sudo pip3 install pytest - + 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 + python -m pip install pygments + python -m pip install requests + - name: run Shellcheck + if: matrix.python-version == '3.8' run: | find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231 - name: run pylint + if: matrix.python-version == '3.8' run: | + pylint --rcfile=pylintrc_travis addons/*.py pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport pylint --rcfile=pylintrc_travis htmlreport/*.py pylint --rcfile=pylintrc_travis tools/*.py - + + - name: check .json files + if: matrix.python-version == '3.8' + run: | + find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null + + - name: check python syntax + if: matrix.python-version != '2.7' + run: | + python -m py_compile ./tools/donate-cpu.py + python -m py_compile ./tools/donate-cpu-server.py + - name: compile addons run: | python -m compileall ./addons - python3 -m compileall ./addons - - - name: check .json files - run: | - find . -name '*.json' | xargs -n 1 python3 -m json.tool > /dev/null - name: test addons run: | - make -s + make -j$(nproc) -s PYTHONPATH=./addons python -m pytest addons/test/test-*.py - PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py - diff --git a/.travis.yml b/.travis.yml index 2e143302f..0d0eef52f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,14 +23,12 @@ before_install: - travis_retry sudo apt-get install -qq python3-pip libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy libopencv-dev libz3-dev # Python 2 modules - travis_retry python2 -m pip install --user pytest==4.6.4 -# - travis_retry python2 -m pip install --user pylint - travis_retry python2 -m pip install --user unittest2 - travis_retry python2 -m pip install --user pexpect # imported by tools/ci.py - travis_retry python2 -m pip install --user pygments # Python 3 modules - travis_retry python3 -m pip install --user setuptools --upgrade - travis_retry python3 -m pip install --user pytest -# - travis_retry python3 -m pip install --user pylint - travis_retry python3 -m pip install --user unittest2 - travis_retry python3 -m pip install --user pexpect # imported by tools/ci.py - travis_retry python3 -m pip install --user requests # imported by tools/pr.py @@ -91,18 +89,6 @@ matrix: # check --dump - ${CPPCHECK} test/testpreprocessor.cpp --dump - xmllint --noout test/testpreprocessor.cpp.dump -# run pylint -- FIXME these are temporarily commented out because there is a syntax error in pylint -# - pylint --rcfile=pylintrc_travis addons/*.py -# - pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport -# - pylint --rcfile=pylintrc_travis htmlreport/*.py -# - pylint --rcfile=pylintrc_travis --ignore=donate-cpu-server.py --ignore=donate-cpu.py --ignore=donate_cpu_lib.py --ignore=test-my-pr.py tools/*.py -# - python3 -m pylint --rcfile=pylintrc_travis addons/*.py -# - python3 -m pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport -# - python3 -m pylint --rcfile=pylintrc_travis htmlreport/*.py -# - python3 -m pylint --rcfile=pylintrc_travis tools/*.py -# check python syntax by compiling some selected scripts - - python3 -m py_compile ./tools/donate-cpu.py - - python3 -m py_compile ./tools/donate-cpu-server.py # check addons/misc.py - cd addons/test - ${CPPCHECK} --dump misc-test.cpp diff --git a/appveyor.yml b/appveyor.yml index 29ba60254..73f61c472 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -56,7 +56,8 @@ environment: # MYQTDIR: C:\Qt\5.11\msvc2015_64 install: - - pip install pytest + - python -m pip install --user pip --upgrade + - python -m pip install --user pytest - SET p=x86 - IF "%platform%"=="x64" SET p=x64 - curl -fsSL https://github.com/Z3Prover/z3/releases/download/z3-4.8.9/z3-4.8.9-%p%-win.zip -o z3-4.8.9-win.zip