Skip to content

Commit

Permalink
Merge pull request #155 from thom311/th/external-ktoolbox
Browse files Browse the repository at this point in the history
[th/external-ktoolbox] ktoolbox: move package to a separate pip module
  • Loading branch information
wizhaoredhat authored Oct 17, 2024
2 parents fb7ebf5 + ca5e98e commit a9dbf20
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 5,639 deletions.
44 changes: 6 additions & 38 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
branches:

jobs:
check3_11:
check:
strategy:
matrix:
version: [ "3.11", "3.12" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: ${{matrix.version}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -40,39 +43,4 @@ jobs:
- name: Run tests with Pytest
run: |
pytest --version
pytest
check3_9:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black==22.12.0
python -m pip install flake8
python -m pip install mypy
python -m pip install pytest
python -m pip install types-PyYAML>=6.0.1
python -m pip install types-paramiko
python -m pip install -r requirements.txt
- name: Check code formatting with Black
run: |
black --version
black --check --diff .
- name: flake8
run: |
flake8 --version
flake8
- name: Type check with Mypy
run: |
mypy --version
mypy --strict --config-file mypy.ini ktoolbox/
- name: Run tests with Pytest
run: |
pytest --version
pytest ktoolbox/
pytest -vvv
23 changes: 9 additions & 14 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,19 @@ RUN dnf install \
wget \
-y


RUN python3.11 -m venv /opt/pyvenv3.11
RUN /opt/pyvenv3.11/bin/python -m pip install --upgrade pip
RUN /opt/pyvenv3.11/bin/python -m pip install \
PyYAML>=6.0.1 \
dataclasses \
jc \
jinja2 \
paramiko \
pyserial \
pytest
RUN ln -s /opt/pyvenv3.11/bin/python /usr/bin/python-pyvenv3.11

COPY \
ktoolbox/README.md \
ktoolbox/*.py \
/opt/ocp-tft/ktoolbox/

RUN echo -e "#!/bin/bash\ncd /opt/ocp-tft/ && exec /opt/pyvenv3.11/bin/python -m ktoolbox.netdev \"\$@\"" > /usr/bin/ocp-tft-netdev && chmod +x /usr/bin/ocp-tft-netdev
COPY requirements.txt /tmp/
RUN /opt/pyvenv3.11/bin/python -m pip install -r /tmp/requirements.txt && \
rm -rf /tmp/requirements.txt
RUN \
echo -e "#/bin/sh\nexec /opt/pyvenv3.11/bin/python \"\$@\"" > /usr/bin/python-pyvenv3.11 && \
chmod +x /usr/bin/python-pyvenv3.11 && \
echo -e "#!/bin/sh\ncd /opt/ocp-tft/ && exec /opt/pyvenv3.11/bin/python -m ktoolbox.netdev \"\$@\"" > /usr/bin/ocp-tft-netdev && \
chmod +x /usr/bin/ocp-tft-netdev

RUN mkdir -p /etc/ocp-traffic-flow-tests && echo "ocp-traffic-flow-tests" > /etc/ocp-traffic-flow-tests/data

Expand Down
11 changes: 0 additions & 11 deletions ktoolbox/README.md

This file was deleted.

Empty file removed ktoolbox/__init__.py
Empty file.
Loading

0 comments on commit a9dbf20

Please sign in to comment.