Skip to content

Commit

Permalink
Merge pull request #2673 from OSInside/remove_tox
Browse files Browse the repository at this point in the history
Remove tox dependency
  • Loading branch information
schaefi authored Nov 6, 2024
2 parents eade3d4 + 50c96d4 commit 463f044
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 448 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install poetry
- name: Run code checks
run: |
tox -e check
make check
17 changes: 8 additions & 9 deletions .github/workflows/ci-config-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ on:
- "kiwi/config/functions.sh"
- ".github/workflows/**"
- "test/scripts/**"
- "tox.ini"
- "*requirements.txt"
- "pyproject.toml"
pull_request:
paths:
# copy-pasta from the above because workflows don't support anchors :-(
- "kiwi/config/functions.sh"
- ".github/workflows/**"
- "test/scripts/**"
- "tox.ini"
- "*requirements.txt"
- "pyproject.toml"

jobs:
scripts_integration_tests:
Expand All @@ -28,14 +26,13 @@ jobs:
fail-fast: false
matrix:
container_runtime:
- DOCKER
- PODMAN
steps:
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
.tox/
~/.cache/pypoetry
key: pip-${{ hashFiles('.virtualenv.dev-requirements.txt') }}-${{ hashFiles('.virtualenv.requirements.txt') }}
restore-keys: |
-pip-
Expand All @@ -44,10 +41,12 @@ jobs:
uses: actions/checkout@v3
- name: set up Python
uses: actions/setup-python@v4
- name: Install Tox
run: sudo apt update && sudo apt install tox
- name: Install Poetry
run: |
sudo python -m pip install --upgrade pip
sudo python -m pip install poetry
- name: Run the scripts integration tests
run: sudo tox -e scripts
run: sudo make test_scripts
env:
CONTAINER_RUNTIME: ${{ matrix.container_runtime }}
9 changes: 5 additions & 4 deletions .github/workflows/ci-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.11]

steps:
- uses: actions/checkout@v3
- name: Python${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
- name: Install Poetry
run: |
sudo apt update && sudo apt install tox
python -m pip install --upgrade pip
python -m pip install poetry
- name: Run sphinx build
run: |
tox -e doc
make docs
4 changes: 2 additions & 2 deletions .github/workflows/ci-publish-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install poetry
- name: Render
run: |
tox -e doc_gh_pages
make prepare_for_docs
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install poetry
- name: Prepare
run: |
tox -e doc_man,release
make prepare_for_pypi
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 3 additions & 3 deletions .github/workflows/ci-units-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install poetry
- name: Run unit and type tests
run: tox -e "unit_py${PY_VER/./_}" -- -n auto
run: make test
env:
PY_VER: ${{ matrix.python-version }}
59 changes: 0 additions & 59 deletions .virtualenv.dev-requirements.txt

This file was deleted.

35 changes: 0 additions & 35 deletions .virtualenv.requirements.txt

This file was deleted.

62 changes: 52 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ docdir = /usr/share/doc/packages
python_version = 3
python_lookup_name = python$(python_version)
python = $(shell which $(python_lookup_name))
sc_disable = SC1091,SC1090,SC2001,SC2174,SC1117,SC2048,SC2004

LC = LC_MESSAGES

Expand Down Expand Up @@ -43,9 +44,6 @@ install:
install -d -m 755 ${buildroot}usr/share/kiwi
cp -a helper/xsl_to_v74 ${buildroot}usr/share/kiwi/

tox:
tox -- "-n 5"

kiwi/schema/kiwi.rng: kiwi/schema/kiwi.rnc
# whenever the schema is changed this target will convert
# the short form of the RelaxNG schema to the format used
Expand Down Expand Up @@ -92,16 +90,48 @@ clean_git_attributes:
# for details on when this target is called see setup.py
git checkout kiwi/version.py

build: clean
setup:
poetry install --all-extras
bash -c 'shellcheck -e SC1091,SC1090,SC2001,SC2174,SC1117,SC2048,SC2004 dracut/modules.d/*/*.sh -s bash'
bash -c 'shellcheck -e SC1091,SC1090,SC2001,SC2174,SC1117,SC2048,SC2004 kiwi/config/functions.sh -s bash'
poetry run make -C doc man

docs: setup
poetry run make -C doc man html

docs_suse: setup
poetry run make -C doc xml
rm -rf doc/build/restxml
mv doc/build/xml doc/build/restxml
poetry run pip install \
git+https://github.com/openSUSE/rstxml2docbook.git@feature/kiwi
poetry run bash -c 'pushd doc && rstxml2docbook \
-v --no-split -o build/xml/book.xml build/restxml/index.xml'
bash -c 'mkdir -p doc/build/images/src/png && \
cp -a doc/source/.images/* doc/build/images/src/png'
cp doc/DC-kiwi doc/build/
bash -c 'pushd doc/build && daps -d DC-kiwi html'

test_scripts: setup
poetry run bash -c \
'pip install pytest-container && pushd test/scripts && pytest -s -vv'

check: setup
# shell code checks
bash -c 'shellcheck -e ${sc_disable} dracut/modules.d/*/*.sh -s bash'
bash -c 'shellcheck -e ${sc_disable} kiwi/config/functions.sh -s bash'
# python flake tests
poetry run flake8 --statistics -j auto --count kiwi
poetry run flake8 --statistics -j auto --count test/unit
poetry run flake8 --statistics -j auto --count test/scripts

test: setup
# python static code checks
poetry run mypy kiwi
poetry run bash -c 'pushd test/unit && pytest -n 5 --doctest-modules --no-cov-on-fail --cov=kiwi --cov-report=term-missing --cov-fail-under=100 --cov-config .coveragerc'
# unit tests
poetry run bash -c 'pushd test/unit && pytest -n 5 \
--doctest-modules --no-cov-on-fail --cov=kiwi \
--cov-report=term-missing --cov-fail-under=100 \
--cov-config .coveragerc'

build: clean check test
# build the sdist source tarball
poetry build --format=sdist
# provide rpm source tarball
Expand All @@ -124,9 +154,21 @@ build: clean
# provide patches
cp package/*.patch dist

pypi: clean tox
prepare_for_pypi: clean setup
# documentation render and tests
poetry run make -C doc man
# sdist tarball, the actual publishing happens via the
# ci-publish-to-pypi.yml github action
poetry build --format=sdist
poetry publish --repository=pypi

prepare_for_docs: clean setup
# documentation man pages
poetry run make -C doc man
# documentation github pages, the actual publishing via
# the ci-publish-pages.yml github action
poetry run bash -c 'pushd doc && \
travis-sphinx --outdir build_gh_pages build --nowarn --source ./source'
bash -c 'touch ./doc/build_gh_pages/.nojekyll'

clean: clean_git_attributes
rm -rf dist
Expand Down
2 changes: 1 addition & 1 deletion doc/source/troubleshooting/boxbuild_tweaks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ To do so, follow these steps:
$ qemu-img resize Ubuntu-Box.x86_64-1.22.04-System-BuildBox.qcow2 +20G
2. When relaunching your `kiwi` box build, make sure you use `--no-snapshot`
2. When relaunching your `kiwi-ng` box build, make sure you use `--no-snapshot`
and `--box-debug` options within your build command/script. Example:

.. code:: bash
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ sphinx = ">=5.0.0"
sphinx_rtd_theme = "*"
sphinxcontrib-spelling = "*"
pyenchant = "*"
travis-sphinx = "*"
ghp-import = "*"

[build-system]
requires = ["poetry-core>=1.2.0"]
Expand Down
37 changes: 8 additions & 29 deletions test/scripts/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,27 @@
CONTAINERS = [
DerivedContainer(base=url, containerfile=FUNCTIONS_COPY_CONTAINERFILE)
for url in [
"registry.opensuse.org/opensuse/leap:15.4",
"registry.opensuse.org/opensuse/leap:15.3",
"registry.opensuse.org/opensuse/leap:15.2",
"registry.opensuse.org/opensuse/leap:15.5",
"registry.opensuse.org/opensuse/tumbleweed:latest",
"registry.suse.com/suse/sle15:15.4",
"registry.suse.com/suse/sle15:15.3",
"registry.suse.com/suse/sle15:15.2",
"registry.suse.com/suse/sle15:15.1",
"registry.suse.com/suse/sles12sp5:latest",
"quay.io/centos/centos:stream8",
"quay.io/centos/centos:stream9",
"registry.fedoraproject.org/fedora:latest"
]
]

(
LEAP_15_4,
LEAP_15_3,
LEAP_15_2,
LEAP_15_5,
TUMBLEWEED,
SLE_15_SP4,
SLE_15_SP3,
SLE_15_SP2,
SLE_15_SP1,
SLE_12_SP5,
CENTOS_STREAM_8,
CENTOS_STREAM_9,
FEDORA
) = CONTAINERS


CONTAINERS_WITH_ZYPPER = [
LEAP_15_4,
LEAP_15_3,
LEAP_15_2,
TUMBLEWEED,
SLE_15_SP4,
SLE_15_SP3,
LEAP_15_5,
TUMBLEWEED
]


CONTAINERS_WITH_YUM = [
CENTOS_STREAM_8,
CENTOS_STREAM_9,
CONTAINERS_WITH_DNF = [
FEDORA
]


Expand Down
Loading

0 comments on commit 463f044

Please sign in to comment.