From 7426f22d4d614a05c4aa7de0edbe1c437d031e6d Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 16 Aug 2024 01:44:03 -0700 Subject: [PATCH] First draft of running linting and unit tests separately. This way we still get unit test output even if the linters fail. --- .github/workflows/unit-tests.yml | 24 ++++++++++++++++++ utils/container-tests/Containerfile.ubi7 | 2 +- utils/container-tests/Containerfile.ubi7-lint | 25 +++++++++++++++++++ utils/container-tests/Containerfile.ubi8 | 2 +- utils/container-tests/Containerfile.ubi8-lint | 9 +++++++ utils/container-tests/Containerfile.ubi9 | 2 +- utils/container-tests/Containerfile.ubi9-lint | 9 +++++++ 7 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 utils/container-tests/Containerfile.ubi7-lint create mode 100644 utils/container-tests/Containerfile.ubi8-lint create mode 100644 utils/container-tests/Containerfile.ubi9-lint diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index f73a61e923..2a05106e15 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -20,28 +20,52 @@ jobs: python: python3.12 repos: 'el9toel10,common' container: ubi9 + - name: Run python linters for el9toel10 and common repositories on python 3.12 + python: python3.12 + repos: 'el9toel10,common' + container: ubi9-lint - name: Run unit tests for el9toel10 and common repositories on python 3.9 python: python3.9 repos: 'el9toel10,common' container: ubi9 + - name: Run python linters for el9toel10 and common repositories on python 3.9 + python: python3.9 + repos: 'el9toel10,common' + container: ubi9-lint # 8to9 - name: Run unit tests for el8toel9 and common repositories on python 3.9 python: python3.9 repos: 'el8toel9,common' container: ubi9 + - name: Run python linters for el8toel9 and common repositories on python 3.9 + python: python3.9 + repos: 'el8toel9,common' + container: ubi9-lint - name: Run unit tests for el8toel9 and common repositories on python 3.6 python: python3.6 repos: 'el8toel9,common' container: ubi8 + - name: Run python linters for el8toel9 and common repositories on python 3.6 + python: python3.6 + repos: 'el8toel9,common' + container: ubi8-lint # 7to8 - name: Run unit tests for el7toel8 and common repositories on python 3.6 python: python3.6 repos: 'el7toel8,common' container: ubi8 + - name: Run python linters for el7toel8 and common repositories on python 3.6 + python: python3.6 + repos: 'el7toel8,common' + container: ubi8-lint - name: Run unit tests for el7toel8 and common repositories on python 2.7 python: python2.7 repos: 'el7toel8,common' container: ubi7 + - name: Run python linters for el7toel8 and common repositories on python 2.7 + python: python2.7 + repos: 'el7toel8,common' + container: ubi7-lint steps: - name: Checkout code diff --git a/utils/container-tests/Containerfile.ubi7 b/utils/container-tests/Containerfile.ubi7 index c38489e738..44625a7688 100644 --- a/utils/container-tests/Containerfile.ubi7 +++ b/utils/container-tests/Containerfile.ubi7 @@ -22,4 +22,4 @@ RUN yum -y install python27-python-pip && \ python -m pip install --ignore-installed pip==20.3.4 ipaddress virtualenv WORKDIR /payload -ENTRYPOINT make install-deps && make test +ENTRYPOINT make install-deps && make test_no_lint diff --git a/utils/container-tests/Containerfile.ubi7-lint b/utils/container-tests/Containerfile.ubi7-lint new file mode 100644 index 0000000000..ed54898592 --- /dev/null +++ b/utils/container-tests/Containerfile.ubi7-lint @@ -0,0 +1,25 @@ +FROM registry.access.redhat.com/ubi7/ubi:7.9 + +VOLUME /payload + +RUN yum update -y && \ + yum install python-virtualenv python-setuptools make git -y + +# NOTE(ivasilev,pstodulk) We need at least pip v10.0.1, however centos:7 +# provides just v8.1.2 (via EPEL). So do this: install epel repos -> install +# python2-pip -> use pip to update to specific pip version we require. period +# NOTE(pstodulk) I see we take care about pip for py3 inside the Makefile, +# however I am afraid of additional possible troubles in future because of the +# archaic pip3 version (v9.0.1). As we want to run tests for Py2 and Py3 in ci +# always anyway, let's put py3 installation here as well.. +# Dropped Python3 as it is now added in its own container on RHEL8 + +# This is some trickery: We install python27-python-pip from the scl, use the scl to bootstrap the python +# module of pip version 20.3.0 and then make it update to 20.3.4 resulting the 'pip' command to be available. +# The --target approach doesn't add it, but at least we now have pip 20.3.4 installed ;-) +RUN yum -y install python27-python-pip && \ + scl enable python27 -- pip install -U --target /usr/lib/python2.7/site-packages/ pip==20.3.0 && \ + python -m pip install --ignore-installed pip==20.3.4 ipaddress virtualenv + +WORKDIR /payload +ENTRYPOINT make install-deps && make lint diff --git a/utils/container-tests/Containerfile.ubi8 b/utils/container-tests/Containerfile.ubi8 index 24cee963a2..4da60c18c4 100644 --- a/utils/container-tests/Containerfile.ubi8 +++ b/utils/container-tests/Containerfile.ubi8 @@ -6,4 +6,4 @@ RUN dnf update -y && \ dnf install python3-virtualenv python3-setuptools python3-pip make git -y WORKDIR /payload -ENTRYPOINT make install-deps && make test +ENTRYPOINT make install-deps && make test_no_lint diff --git a/utils/container-tests/Containerfile.ubi8-lint b/utils/container-tests/Containerfile.ubi8-lint new file mode 100644 index 0000000000..5b5c48b2b8 --- /dev/null +++ b/utils/container-tests/Containerfile.ubi8-lint @@ -0,0 +1,9 @@ +FROM registry.access.redhat.com/ubi8/ubi:latest + +VOLUME /payload + +RUN dnf update -y && \ + dnf install python3-virtualenv python3-setuptools python3-pip make git -y + +WORKDIR /payload +ENTRYPOINT make install-deps && make lint diff --git a/utils/container-tests/Containerfile.ubi9 b/utils/container-tests/Containerfile.ubi9 index 1e616a9954..4d5d9985c8 100644 --- a/utils/container-tests/Containerfile.ubi9 +++ b/utils/container-tests/Containerfile.ubi9 @@ -8,4 +8,4 @@ RUN dnf update -y && \ RUN pip install virtualenv WORKDIR /payload -ENTRYPOINT make install-deps && make test +ENTRYPOINT make install-deps && make test_no_lint diff --git a/utils/container-tests/Containerfile.ubi9-lint b/utils/container-tests/Containerfile.ubi9-lint new file mode 100644 index 0000000000..117a02d522 --- /dev/null +++ b/utils/container-tests/Containerfile.ubi9-lint @@ -0,0 +1,9 @@ +FROM registry.access.redhat.com/ubi9/ubi:latest + +VOLUME /payload + +RUN dnf update -y && \ + dnf install python3-virtualenv python3-setuptools python3-pip make git -y + +WORKDIR /payload +ENTRYPOINT make install-deps && make lint