[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 44/44] gitlab: add python linters to CI
From: |
John Snow |
Subject: |
[PULL 44/44] gitlab: add python linters to CI |
Date: |
Thu, 27 May 2021 22:32:20 -0400 |
Add a Python container that has just enough juice for us to run the
Python code quality analysis tools. Base this container on Fedora,
because Fedora has very convenient packaging for testing multiple Python
versions.
We need python3, pip (for pulling packages), pipenv and virtualenv for
creating virtual environments, and tox for running tests. make is needed
for running 'make check-tox' and 'make venv-check' targets. Python3.10
is needed explicitly because the tox package only pulls in 3.6-3.9, but
we wish to test the forthcoming release of Python as well to help
predict any problems. Lastly, we need gcc to compile PyPI packages that
may not have a binary distribution available.
Add two tests:
check-python-pipenv uses pipenv to test a frozen, very explicit set of
packages against our minimum supported python version, Python 3.6. This
test is not allowed to fail. The dependencies this test uses do not
change unless python/Pipfile.lock is changed.
check-python-tox uses tox to install the latest versions of required
python dependencies against a wide array of Python versions from 3.6 to
3.9, even including the yet-to-be-released Python 3.10. This test is
allowed to fail with a warning.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-id: 20210527211715.394144-32-jsnow@redhat.com
[Fix rebase conflict over .gitlab-ci.yml --js]
Signed-off-by: John Snow <jsnow@redhat.com>
---
.gitlab-ci.d/containers.yml | 5 +++++
.gitlab-ci.d/static_checks.yml | 21 +++++++++++++++++++++
tests/docker/dockerfiles/python.docker | 18 ++++++++++++++++++
3 files changed, 44 insertions(+)
create mode 100644 tests/docker/dockerfiles/python.docker
diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml
index bd01ae8f802..1ca455f8e10 100644
--- a/.gitlab-ci.d/containers.yml
+++ b/.gitlab-ci.d/containers.yml
@@ -43,3 +43,8 @@ amd64-opensuse-leap-container:
extends: .container_job_template
variables:
NAME: opensuse-leap
+
+python-container:
+ extends: .container_job_template
+ variables:
+ NAME: python
diff --git a/.gitlab-ci.d/static_checks.yml b/.gitlab-ci.d/static_checks.yml
index 91247a6f670..8e308721640 100644
--- a/.gitlab-ci.d/static_checks.yml
+++ b/.gitlab-ci.d/static_checks.yml
@@ -24,3 +24,24 @@ check-dco:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH ==
$CI_DEFAULT_BRANCH'
when: never
- when: on_success
+
+check-python-pipenv:
+ stage: test
+ image: $CI_REGISTRY_IMAGE/qemu/python:latest
+ script:
+ - make -C python venv-check
+ variables:
+ GIT_DEPTH: 1
+ needs:
+ job: python-container
+
+check-python-tox:
+ stage: test
+ image: $CI_REGISTRY_IMAGE/qemu/python:latest
+ script:
+ - make -C python check-tox
+ variables:
+ GIT_DEPTH: 1
+ needs:
+ job: python-container
+ allow_failure: true
diff --git a/tests/docker/dockerfiles/python.docker
b/tests/docker/dockerfiles/python.docker
new file mode 100644
index 00000000000..56d88417df4
--- /dev/null
+++ b/tests/docker/dockerfiles/python.docker
@@ -0,0 +1,18 @@
+# Python library testing environment
+
+FROM fedora:latest
+MAINTAINER John Snow <jsnow@redhat.com>
+
+# Please keep this list sorted alphabetically
+ENV PACKAGES \
+ gcc \
+ make \
+ pipenv \
+ python3 \
+ python3-pip \
+ python3-tox \
+ python3-virtualenv \
+ python3.10
+
+RUN dnf install -y $PACKAGES
+RUN rpm -q $PACKAGES | sort > /packages.txt
--
2.31.1
- [PULL 33/44] python: Add flake8 to pipenv, (continued)
- [PULL 33/44] python: Add flake8 to pipenv, John Snow, 2021/05/27
- [PULL 34/44] python: move mypy.ini into setup.cfg, John Snow, 2021/05/27
- [PULL 36/44] python: move .isort.cfg into setup.cfg, John Snow, 2021/05/27
- [PULL 35/44] python: add mypy to pipenv, John Snow, 2021/05/27
- [PULL 37/44] python/qemu: add isort to pipenv, John Snow, 2021/05/27
- [PULL 38/44] python/qemu: add qemu package itself to pipenv, John Snow, 2021/05/27
- [PULL 40/44] python: add avocado-framework and tests, John Snow, 2021/05/27
- [PULL 39/44] python: add devel package requirements to setuptools, John Snow, 2021/05/27
- [PULL 42/44] python: add .gitignore, John Snow, 2021/05/27
- [PULL 41/44] python: add Makefile for some common tasks, John Snow, 2021/05/27
- [PULL 44/44] gitlab: add python linters to CI,
John Snow <=
- [PULL 43/44] python: add tox support, John Snow, 2021/05/27
- Re: [PULL 00/44] Python patches, Peter Maydell, 2021/05/30