Skip to content

Commit

Permalink
First draft of running linting and unit tests separately.
Browse files Browse the repository at this point in the history
This way we still get unit test output even if the linters fail.
  • Loading branch information
abadger authored and pirat89 committed Aug 16, 2024
1 parent 6861231 commit 7426f22
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/container-tests/Containerfile.ubi7
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions utils/container-tests/Containerfile.ubi7-lint
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion utils/container-tests/Containerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions utils/container-tests/Containerfile.ubi8-lint
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion utils/container-tests/Containerfile.ubi9
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions utils/container-tests/Containerfile.ubi9-lint
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7426f22

Please sign in to comment.