From 4fb0a981a1a611ad7511c82975b33209d6c8b23a Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Mon, 17 Jul 2023 13:39:15 +0200 Subject: [PATCH] ci: use packaged salt and python-shaptools --- .github/workflows/salt-shaptools-ci.yml | 23 +++++++++++++++-------- tests/run.sh | 7 ++++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/salt-shaptools-ci.yml b/.github/workflows/salt-shaptools-ci.yml index fef3e779..39d08c27 100644 --- a/.github/workflows/salt-shaptools-ci.yml +++ b/.github/workflows/salt-shaptools-ci.yml @@ -168,25 +168,32 @@ jobs: run: | zypper -n in -y make python if test -f /usr/bin/python3; then - # minimal python packages and compilers - zypper -n in -y python3-pip python3-devel gcc + # minimal salt, python packages and compilers + zypper -n in -y salt python3-pip python3-devel gcc # use current salt version shipped with SLE 15 git clone --branch=openSUSE/release/3006.0 --depth=50 https://github.com/openSUSE/salt ../salt # python 3.6 - official requirements from salt (works with python >3.6) pip install -r ../salt/requirements/pytest.txt pip install -r tests/requirements.3.6.yaml # pinned pytest-cov + # install shaptools + zypper addrepo https://download.opensuse.org/repositories/network:/ha-clustering:/sap-deployments:/devel/SLE_15_SP5/network:ha-clustering:sap-deployments:devel.repo + zypper --gpg-auto-import-keys ref + zypper -n in -y python3-shaptools else - # minimal python packages and compilers - zypper -n in -y python-pip python-devel gcc gcc-c++ + zypper -n in -y SUSEConnect + SUSEConnect -p sle-module-adv-systems-management/12/x86_64 + # minimal salt, python packages and compilers + zypper -n in -y salt python-pip python-devel gcc gcc-c++ # python 2.7 - latest available versions for old python release - pip install -r tests/requirements.2.7.yaml + pip install --ignore-installed -r tests/requirements.2.7.yaml # use current salt version shipped with SLE 12 git clone --branch=openSUSE/release/3000.3 --depth=50 https://github.com/openSUSE/salt ../salt + # install shaptools + zypper addrepo https://download.opensuse.org/repositories/network:/ha-clustering:/sap-deployments:/devel/SLE_12_SP5/network:ha-clustering:sap-deployments:devel.repo + zypper --gpg-auto-import-keys ref + zypper -n in -y python-shaptools fi rm ../salt/tests/conftest.py - git clone --depth=50 https://github.com/SUSE/shaptools.git ../shaptools - pip install -e ../salt - pip install ../shaptools - name: execute test script run: make test-python diff --git a/tests/run.sh b/tests/run.sh index fc415054..061b884f 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -1,5 +1,10 @@ +#!/usr/bin/env bash + +PYTHON=python3 +test -f /usr/bin/python2 && PYTHON=python2 + cp salt/modules/*.py ../salt/salt/modules/ cp salt/states/*.py ../salt/salt/states/ cp tests/unit/modules/*.py ../salt/tests/unit/modules/ cp tests/unit/states/*.py ../salt/tests/unit/states/ -py.test -vv ../salt/tests/unit/modules/test_hanamod.py ../salt/tests/unit/states/test_hanamod.py ../salt/tests/unit/modules/test_crmshmod.py ../salt/tests/unit/modules/test_saptunemod.py ../salt/tests/unit/modules/test_sapcarmod.py ../salt/tests/unit/states/test_crmshmod.py ../salt/tests/unit/modules/test_drbdmod.py ../salt/tests/unit/states/test_drbdmod.py ../salt/tests/unit/states/test_saptunemod.py ../salt/tests/unit/modules/test_netweavermod.py ../salt/tests/unit/states/test_netweavermod.py ../salt/tests/unit/states/test_sapcarmod.py --cov=salt.modules.hanamod --cov=salt.states.hanamod --cov=salt.modules.crmshmod --cov=salt.states.crmshmod --cov=salt.modules.drbdmod --cov=salt.modules.saptunemod --cov=salt.modules.sapcarmod --cov=salt.states.saptunemod --cov=salt.states.drbdmod --cov=salt.modules.netweavermod --cov=salt.states.netweavermod --cov=salt.states.sapcarmod --cov-config .coveragerc --cov-report term --cov-report xml --cov-report html +cd ../salt && $PYTHON -m pytest -vv ../salt/tests/unit/modules/test_hanamod.py ../salt/tests/unit/states/test_hanamod.py ../salt/tests/unit/modules/test_crmshmod.py ../salt/tests/unit/modules/test_saptunemod.py ../salt/tests/unit/modules/test_sapcarmod.py ../salt/tests/unit/states/test_crmshmod.py ../salt/tests/unit/modules/test_drbdmod.py ../salt/tests/unit/states/test_drbdmod.py ../salt/tests/unit/states/test_saptunemod.py ../salt/tests/unit/modules/test_netweavermod.py ../salt/tests/unit/states/test_netweavermod.py ../salt/tests/unit/states/test_sapcarmod.py --cov=salt.modules.hanamod --cov=salt.states.hanamod --cov=salt.modules.crmshmod --cov=salt.states.crmshmod --cov=salt.modules.drbdmod --cov=salt.modules.saptunemod --cov=salt.modules.sapcarmod --cov=salt.states.saptunemod --cov=salt.states.drbdmod --cov=salt.modules.netweavermod --cov=salt.states.netweavermod --cov=salt.states.sapcarmod --cov-config .coveragerc --cov-report term --cov-report xml --cov-report html