From 0ba409e86d0a75e4955821ffe570873f0a52f2ab Mon Sep 17 00:00:00 2001 From: Ana Guerrero Lopez Date: Mon, 9 Aug 2021 13:51:05 +0200 Subject: [PATCH 1/2] Makefile: update check target Sync inspekt command with the one used by GitHub Actions. Add spell check to the check target. Remove superfluous installation of pip. Typo and format fixes. Signed-off-by: Ana Guerrero Lopez --- Makefile | 7 ++----- spell.ignore | 1 + virttest/libvirt_xml/base.py | 2 +- virttest/utils_libvirt/libvirt_embedded_qemu.py | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7cc7f8fcd4..cf5d857278 100644 --- a/Makefile +++ b/Makefile @@ -42,11 +42,11 @@ all: @echo requirements: pip - - $(PYTHON) -m pip install "pip>=6.0.1" - $(PYTHON) -m pip install -r requirements.txt check: - inspekt checkall --disable-lint W,R,C,E1002,E1101,E1103,E1120,F0401,I0011,E1003 --no-license-check + inspekt checkall --disable-lint W,R,C,E1002,E1101,E1103,E1120,F0401,I0011,E1003,W605 --disable-style W605,W606,E501,E265,W601,E402,E722,E741 --exclude avocado-libs,scripts/github --no-license-check + pylint --errors-only --disable=all --enable=spelling --spelling-dict=en_US --spelling-private-dict-file=spell.ignore * clean: $(PYTHON) setup.py clean @@ -67,9 +67,6 @@ unlink: [ -L ../$(AVOCADO_DIRNAME)/$$CONF ] && rm -f ../$(AVOCADO_DIRNAME)/$$CONF || true;\ done -spell: - pylint --errors-only --disable=all --enable=spelling --spelling-dict=en_US --spelling-private-dict-file=spell.ignore * && echo OK - pypi: clean if test ! -d PYPI_UPLOAD; then mkdir PYPI_UPLOAD; fi $(PYTHON) setup.py bdist_wheel -d PYPI_UPLOAD diff --git a/spell.ignore b/spell.ignore index 23a853d2e3..4d94c70e5a 100644 --- a/spell.ignore +++ b/spell.ignore @@ -752,6 +752,7 @@ superclass's LENOVO idmap gid +tc # The list below needs a second review abc diff --git a/virttest/libvirt_xml/base.py b/virttest/libvirt_xml/base.py index 4825edd485..142fff41e8 100644 --- a/virttest/libvirt_xml/base.py +++ b/virttest/libvirt_xml/base.py @@ -308,7 +308,7 @@ def setup_attrs(self, **attrs): value.pop('reset_all') # If Element tag is not found, we need to create a new instance # to set the attributes. - # If reset_all, it means we will discard the exising instance + # If reset_all, it means we will discard the existing instance # of current sub-xml and create a new one to replace it. if reset_all or not self.xmltreefile.find(key): # Get args to create an instance of subclass diff --git a/virttest/utils_libvirt/libvirt_embedded_qemu.py b/virttest/utils_libvirt/libvirt_embedded_qemu.py index 009217509f..48eb73bee2 100644 --- a/virttest/utils_libvirt/libvirt_embedded_qemu.py +++ b/virttest/utils_libvirt/libvirt_embedded_qemu.py @@ -24,6 +24,7 @@ class EmbeddedQemuSession(object): """ Interaction embeddedQemu session can start a qemu process. """ + def __init__(self, logging_handler=None, logging_params=(), From ac52469021c247c3fd13364e652ad7701014547d Mon Sep 17 00:00:00 2001 From: Ana Guerrero Lopez Date: Tue, 10 Aug 2021 10:57:34 +0200 Subject: [PATCH 2/2] CI: Add new checks for spell, signed-off and build eggs Add job to build package (egg) Check signed-off-by to make sure new commits are signed by the author. Add spellchecker together with its requirements on pyenchant to requirements-travis.txt Sphinx is already listed in requirements-travis.txt, remove it. Signed-off-by: Ana Guerrero Lopez --- .github/workflows/ci.yml | 33 ++++++++++++++++++++++++++++++--- requirements-travis.txt | 1 + selftests/signedoff-check.sh | 10 ++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100755 selftests/signedoff-check.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ce6a11be2..acaff6614d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - pip install Sphinx==1.3b1 - pip install -r requirements-travis.txt + run: pip install -r requirements-travis.txt - name: Check out Avocado libs uses: actions/checkout@v2 with: @@ -56,4 +54,33 @@ jobs: run: AVOCADO_LOG_DEBUG=yes avocado vt-bootstrap --vt-skip-verify-download-assets --yes-to-all - name: Run tests run: inspekt checkall --disable-lint W,R,C,E1002,E1101,E1103,E1120,F0401,I0011,E1003,W605 --disable-style W605,W606,E501,E265,W601,E402,E722,E741 --exclude avocado-libs,scripts/github --no-license-check + - name: Run spellchecker + run: pylint --errors-only --disable=all --ignore=avocado-libs --enable=spelling --spelling-dict=en_US --spelling-private-dict-file=spell.ignore * + - name: Check signed-off-by + run: ./selftests/signedoff-check.sh - run: echo "This job's status is ${{ job.status }}." + + package-build: + name: Build Package for Python ${{ matrix.python-version }} + runs-on: ubuntu-20.04 + + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Build eggs + run: python setup.py bdist_egg + - run: echo "🥑 This job's status is ${{ job.status }}." diff --git a/requirements-travis.txt b/requirements-travis.txt index 807e16e9e7..a5321b864f 100644 --- a/requirements-travis.txt +++ b/requirements-travis.txt @@ -6,3 +6,4 @@ aexpect==1.6.0 simplejson==3.8.0 netaddr==0.7.19 netifaces>=0.10.5 +pyenchant diff --git a/selftests/signedoff-check.sh b/selftests/signedoff-check.sh new file mode 100755 index 0000000000..3e05fbbeed --- /dev/null +++ b/selftests/signedoff-check.sh @@ -0,0 +1,10 @@ +#!/bin/sh -e + +echo "** Running signedoff-check..." + +AUTHOR="$(git log --no-merges -1 --pretty='format:%aN <%aE>')" +git log --no-merges -1 --pretty=format:%B | grep -i "Signed-off-by: $AUTHOR" +if [ $? != 0 ]; then + echo "The commit message does not contain author's signature (Signed-off-by: $AUTHOR)" + exit 1 +fi