Skip to content

Commit

Permalink
Separate lint and unittest runs
Browse files Browse the repository at this point in the history
  • Loading branch information
abadger committed Sep 12, 2024
1 parent 9787116 commit bb9ab79
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 52 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,27 @@ jobs:
- name: Run unit tests with python3.12 on el9
python: python3.12
container: ubi10
- name: Run python linters with python3.12 on el9
python: python3.12
container: ubi10-lint
- name: Run unit tests with python3.9 on el9
python: python3.9
container: ubi9
- name: Run python linters with python3.9 on el9
python: python3.9
container: ubi9-lint
- name: Run unit tests with python 3.6 on el8
python: python3.6
container: ubi8
- name: Run python linters with python 3.6 on el8
python: python3.6
container: ubi8-lint
- name: Run unit tests with python2.7 on el7
python: python2.7
container: ubi7
- name: Run python linters with python2.7 on el7
python: python2.7
container: ubi7-lint

steps:
- name: Checkout code
Expand Down
13 changes: 0 additions & 13 deletions res/container-tests/Containerfile.ubi10
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \
pip install -U pytest && \
pip install -U six && \
pip install -U . && \
export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running pylint ===============' && \
echo '==================================================' && \
echo '==================================================' && \
echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running flake8 ===============' && \
echo '==================================================' && \
echo '==================================================' && \
flake8 $LINTABLES && echo '===> flake8 PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running tests ===============' && \
Expand Down
35 changes: 35 additions & 0 deletions res/container-tests/Containerfile.ubi10-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM registry.access.redhat.com/ubi9/ubi:latest

VOLUME /payload

RUN dnf update -y && \
dnf install python3 python312 python3-pip make -y && \
python3 -m pip install --upgrade pip==20.3.4

RUN pip install virtualenv

WORKDIR /payload
ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \
source testenv/bin/activate && \
pip install -U setuptools && \
pip install -U funcsigs && \
pip install -U -r requirements-tests.txt && \
# NOTE(mmatuska): The pytest ver defined in requirements-tests is too old \
# for Python 3.12 (missing imp module), there do an update here until we \
# bump that. Similarly for six. \
pip install -U pytest && \
pip install -U six && \
pip install -U . && \
export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running pylint ===============' && \
echo '==================================================' && \
echo '==================================================' && \
echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running flake8 ===============' && \
echo '==================================================' && \
echo '==================================================' && \
flake8 $LINTABLES && echo '===> flake8 PASSED'
13 changes: 0 additions & 13 deletions res/container-tests/Containerfile.ubi7
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ ENTRYPOINT virtualenv testenv && \
pip install -U funcsigs && \
pip install -U -r requirements-tests.txt && \
pip install -U . && \
export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running pylint ===============' && \
echo '==================================================' && \
echo '==================================================' && \
echo $LINTABLES | xargs pylint --py3k && echo '===> pylint PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running flake8 ===============' && \
echo '==================================================' && \
echo '==================================================' && \
flake8 $LINTABLES && echo '===> flake8 PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running tests ===============' && \
Expand Down
28 changes: 28 additions & 0 deletions res/container-tests/Containerfile.ubi7-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM registry.access.redhat.com/ubi7/ubi:7.9

VOLUME /payload

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 virtualenv

WORKDIR /payload
ENTRYPOINT virtualenv testenv && \
source testenv/bin/activate && \
pip install -U setuptools && \
pip install -U funcsigs && \
pip install -U -r requirements-tests.txt && \
pip install -U . && \
export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running pylint ===============' && \
echo '==================================================' && \
echo '==================================================' && \
echo $LINTABLES | xargs pylint --py3k && echo '===> pylint PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running flake8 ===============' && \
echo '==================================================' && \
echo '==================================================' && \
flake8 $LINTABLES && echo '===> flake8 PASSED'
13 changes: 0 additions & 13 deletions res/container-tests/Containerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \
pip install -U funcsigs && \
pip install -U -r requirements-tests.txt && \
pip install -U . && \
export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running pylint ===============' && \
echo '==================================================' && \
echo '==================================================' && \
echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running flake8 ===============' && \
echo '==================================================' && \
echo '==================================================' && \
flake8 $LINTABLES && echo '===> flake8 PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running tests ===============' && \
Expand Down
31 changes: 31 additions & 0 deletions res/container-tests/Containerfile.ubi8-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM registry.access.redhat.com/ubi8/ubi:latest

VOLUME /payload

ENV PYTHON_VENV "python3.6"

RUN yum update -y && \
yum install python3 python39 python3-virtualenv make -y && \
yum -y install python3-pip && \
python3 -m pip install --upgrade pip==20.3.4

WORKDIR /payload
ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \
source testenv/bin/activate && \
pip install -U setuptools && \
pip install -U funcsigs && \
pip install -U -r requirements-tests.txt && \
pip install -U . && \
export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running pylint ===============' && \
echo '==================================================' && \
echo '==================================================' && \
echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running flake8 ===============' && \
echo '==================================================' && \
echo '==================================================' && \
flake8 $LINTABLES && echo '===> flake8 PASSED'
13 changes: 0 additions & 13 deletions res/container-tests/Containerfile.ubi9
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@ ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \
pip install -U funcsigs && \
pip install -U -r requirements-tests.txt && \
pip install -U . && \
export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running pylint ===============' && \
echo '==================================================' && \
echo '==================================================' && \
echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running flake8 ===============' && \
echo '==================================================' && \
echo '==================================================' && \
flake8 $LINTABLES && echo '===> flake8 PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running tests ===============' && \
Expand Down
30 changes: 30 additions & 0 deletions res/container-tests/Containerfile.ubi9-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM registry.access.redhat.com/ubi9/ubi:latest

VOLUME /payload

RUN dnf update -y && \
dnf install python3 python39 make python3-pip -y && \
python3 -m pip install --upgrade pip==20.3.4

RUN pip install virtualenv

WORKDIR /payload
ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \
source testenv/bin/activate && \
pip install -U setuptools && \
pip install -U funcsigs && \
pip install -U -r requirements-tests.txt && \
pip install -U . && \
export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running pylint ===============' && \
echo '==================================================' && \
echo '==================================================' && \
echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \
echo '==================================================' && \
echo '==================================================' && \
echo '=============== Running flake8 ===============' && \
echo '==================================================' && \
echo '==================================================' && \
flake8 $LINTABLES && echo '===> flake8 PASSED'

0 comments on commit bb9ab79

Please sign in to comment.