some Python-related CI cleanups (#3066)

This commit is contained in:
Oliver Stöneberg 2021-02-20 13:26:28 +01:00 committed by GitHub
parent b434752e51
commit b1ccad5f02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 35 deletions

View File

@ -19,7 +19,8 @@ jobs:
sudo apt-get install libz3-dev libz3-4 sudo apt-get install libz3-dev libz3-4
sudo apt-get install lcov sudo apt-get install lcov
sudo apt-get install libcppunit-dev 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 - name: Compile instrumented
run: | run: |

View File

@ -8,44 +8,66 @@ jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
steps: steps:
- uses: actions/checkout@v2 - 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: | run: |
sudo apt-get update
sudo apt-get install shellcheck sudo apt-get install shellcheck
sudo apt-get install python3-setuptools python -m pip install pip --upgrade
sudo pip3 install natsort python -m pip install natsort
sudo pip3 install pexpect python -m pip install pexpect
sudo pip3 install pylint python -m pip install pylint
sudo pip3 install unittest2 python -m pip install unittest2
sudo pip install pytest python -m pip install pytest
sudo pip3 install pytest python -m pip install pygments
python -m pip install requests
- name: run Shellcheck - name: run Shellcheck
if: matrix.python-version == '3.8'
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'
run: | run: |
pylint --rcfile=pylintrc_travis addons/*.py
pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport
pylint --rcfile=pylintrc_travis htmlreport/*.py pylint --rcfile=pylintrc_travis htmlreport/*.py
pylint --rcfile=pylintrc_travis tools/*.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 - name: compile addons
run: | run: |
python -m compileall ./addons 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 - name: test addons
run: | run: |
make -s make -j$(nproc) -s
PYTHONPATH=./addons python -m pytest addons/test/test-*.py PYTHONPATH=./addons python -m pytest addons/test/test-*.py
PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py

View File

@ -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 - 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 # Python 2 modules
- travis_retry python2 -m pip install --user pytest==4.6.4 - 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 unittest2
- travis_retry python2 -m pip install --user pexpect # imported by tools/ci.py - travis_retry python2 -m pip install --user pexpect # imported by tools/ci.py
- travis_retry python2 -m pip install --user pygments - travis_retry python2 -m pip install --user pygments
# Python 3 modules # Python 3 modules
- travis_retry python3 -m pip install --user setuptools --upgrade - travis_retry python3 -m pip install --user setuptools --upgrade
- travis_retry python3 -m pip install --user pytest - 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 unittest2
- travis_retry python3 -m pip install --user pexpect # imported by tools/ci.py - 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 - travis_retry python3 -m pip install --user requests # imported by tools/pr.py
@ -91,18 +89,6 @@ matrix:
# check --dump # check --dump
- ${CPPCHECK} test/testpreprocessor.cpp --dump - ${CPPCHECK} test/testpreprocessor.cpp --dump
- xmllint --noout 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 # check addons/misc.py
- cd addons/test - cd addons/test
- ${CPPCHECK} --dump misc-test.cpp - ${CPPCHECK} --dump misc-test.cpp

View File

@ -56,7 +56,8 @@ environment:
# MYQTDIR: C:\Qt\5.11\msvc2015_64 # MYQTDIR: C:\Qt\5.11\msvc2015_64
install: install:
- pip install pytest - python -m pip install --user pip --upgrade
- python -m pip install --user pytest
- SET p=x86 - SET p=x86
- IF "%platform%"=="x64" SET p=x64 - 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 - 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