diff --git a/.github/workflows/build-install.yaml b/.github/workflows/build-install.yaml deleted file mode 100644 index 22fb04f09d..0000000000 --- a/.github/workflows/build-install.yaml +++ /dev/null @@ -1,122 +0,0 @@ -name: 'build and installation tests' - -on: - push: - branches: ['master'] - paths-ignore: - - 'AUTHORS' - - 'COPYING' - - 'NEWS' - - 'README.md' - - 'doc/**' - pull_request: - branches: ['master'] - paths-ignore: - - 'AUTHORS' - - 'COPYING' - - 'NEWS' - - 'README.md' - - 'doc/**' - -jobs: - rpmbuild: - name: 'rpmbuild test' - runs-on: 'ubuntu-latest' - strategy: - fail-fast: false - matrix: - # Testing per python-version using actions/setup-python is not possible, - # because rpm doesn't exist on pypi and cannot be installed via pip on ubuntu. - # That's why we're going to test on the target distros directly. - container: - - # Fedora - - 'fedora:36' - - 'fedora:rawhide' - - # OpenSUSE - # leap < 15.2 doesn't contain git-lfs which causes actions/checkout to fail - - 'opensuse/leap:15.3' - - 'opensuse/leap:15.4' - - 'opensuse/tumbleweed' - - # CentOS Stream - - 'quay.io/centos/centos:stream9' - - container: - image: ${{ matrix.container }} - - steps: - - name: 'Install packages (OpenSUSE)' - if: ${{ startsWith(matrix.container, 'opensuse/') }} - run: | - zypper --non-interactive --gpg-auto-import-keys refresh - zypper --non-interactive dist-upgrade - zypper --non-interactive install git-lfs rpm-build - - - name: 'Install packages (Fedora/CentOS)' - if: ${{ startsWith(matrix.container, 'fedora:') || contains(matrix.container, 'centos:') }} - run: | - dnf -y makecache - dnf -y distro-sync - dnf -y install git-lfs rpm-build dnf-plugins-core - - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: 'Install build dependencies (OpenSUSE)' - if: ${{ startsWith(matrix.container, 'opensuse/') }} - run: | - zypper --non-interactive install $(rpmspec -q --buildrequires contrib/osc.spec) - - - name: 'Install build dependencies (Fedora/CentOS)' - if: ${{ startsWith(matrix.container, 'fedora:') || contains(matrix.container, 'centos:') }} - run: | - dnf -y builddep contrib/osc.spec - - - name: 'Build SRPM and RPMs' - run: | - git config --global --add safe.directory "$(pwd)" - - git remote add upstream https://github.com/openSUSE/osc.git - git fetch upstream --tags --force - - ./contrib/build_rpm.py --srpm --rpm - - - name: 'Install built RPMs (OpenSUSE)' - if: ${{ startsWith(matrix.container, 'opensuse/') }} - run: | - zypper --non-interactive install --force --allow-vendor-change --allow-unsigned-rpm ./contrib/*/*.rpm - - - name: 'Install build RPMs (Fedora/CentOS)' - if: ${{ startsWith(matrix.container, 'fedora:') || contains(matrix.container, 'centos:') }} - run: | - dnf -y install ./contrib/*/*.rpm - - - name: 'Run installed osc' - run: | - osc --help - - pip: - name: 'pip install test' - runs-on: 'ubuntu-latest' - strategy: - fail-fast: false - - steps: - - name: 'Install packages' - run: | - sudo apt-get -y update - sudo apt-get -y upgrade - sudo apt-get -y --no-install-recommends install git python3-pip python3-rpm - - - uses: actions/checkout@v3 - - - name: 'Install osc from pip' - run: | - pip3 install . - - - name: 'Run installed osc' - run: | - osc --help diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml new file mode 100644 index 0000000000..14fa0ee20d --- /dev/null +++ b/.github/workflows/linters.yaml @@ -0,0 +1,58 @@ +name: 'linters' + +on: + push: + branches: ['master'] + paths: + - '.github/**' + - '**.py' + - 'tests/**' + pull_request: + branches: ['master'] + paths: + - '.github/**' + - '**.py' + - 'tests/**' + +jobs: + pylint_plugins: + name: 'diff pylint runs on osc plugins' + runs-on: 'ubuntu-latest' + strategy: + fail-fast: false + matrix: + plugin_repository: + - openSUSE/openSUSE-release-tools + - openSUSE/osc-plugin-collab + - openSUSE/osc-plugin-install + - openSUSE/osc-plugin-overview + - openSUSE/osc-plugin-qam + + steps: + - name: 'Install packages' + run: | + sudo apt-get -y update + sudo apt-get -y --no-install-recommends install diffutils pylint + + - uses: actions/checkout@v3 + with: + path: osc-pr + + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.base.sha }} + path: osc-master + + - uses: actions/checkout@v3 + with: + repository: ${{ matrix.plugin_repository }} + path: plugin + + - name: 'Diff pylint runs' + run: | + cd plugin + find -maxdepth 2 -name __init__.py | while read i; do dirname $i; done | sort > .pylint-args + find -maxdepth 1 -name '*.py' | sort >> .pylint-args + PYTHONPATH="../osc-master" pylint --errors-only $(cat .pylint-args) | sort > pylint-osc-master.log || : + PYTHONPATH="../osc-pr" pylint --errors-only $(cat .pylint-args) | sort > pylint-osc-pr.log || : + diff -u pylint-osc-master.log pylint-osc-pr.log diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml deleted file mode 100644 index 8767ec2722..0000000000 --- a/.github/workflows/unittests.yaml +++ /dev/null @@ -1,93 +0,0 @@ -name: 'unit tests' - -on: - push: - branches: ['master'] - paths: - - '.github/**' - - '**.py' - - 'tests/**' - pull_request: - branches: ['master'] - paths: - - '.github/**' - - '**.py' - - 'tests/**' - -jobs: - test: - name: 'unit tests' - runs-on: 'ubuntu-latest' - strategy: - fail-fast: false - matrix: - # Testing per python-version using actions/setup-python is not possible, - # because rpm doesn't exist on pypi and cannot be installed via pip on ubuntu. - # That's why we're going to test on the target distros directly. - container: - - # Fedora - - 'fedora:36' - - 'fedora:rawhide' - - # openSUSE - # leap < 15.2 doesn't contain git-lfs which causes actions/checkout to fail - - 'opensuse/leap:15.3' - - 'opensuse/leap:15.4' - - 'opensuse/tumbleweed' - - # CentOS Stream - - 'quay.io/centos/centos:stream9' - - # Debian - - 'debian:stable' - - 'debian:unstable' - - # Ubuntu - - 'ubuntu:latest' - - container: - image: ${{ matrix.container }} - - steps: - - name: 'Install packages (openSUSE)' - if: ${{ startsWith(matrix.container, 'opensuse/') }} - run: | - zypper -n --gpg-auto-import-keys refresh - zypper -n lr --details - grep -qi tumbleweed /etc/os-release && zypper -n dist-upgrade || zypper -n patch || zypper -n patch - zypper -n install git-lfs - zypper -n install diffstat diffutils python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3 - - - name: 'Install packages (Fedora/CentOS)' - if: ${{ startsWith(matrix.container, 'fedora:') || contains(matrix.container, 'centos:') }} - run: | - dnf -y makecache - dnf -y distro-sync - dnf -y install git-lfs - dnf -y install diffstat diffutils python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3 - - - name: 'Install packages (Debian/Ubuntu)' - if: ${{ startsWith(matrix.container, 'debian:') || startsWith(matrix.container, 'ubuntu:') }} - run: | - apt-get -y update - apt-get -y upgrade - apt-get -y --no-install-recommends install git-lfs - apt-get -y --no-install-recommends install diffstat diffutils python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3 - - - uses: actions/checkout@v3 - - - name: 'Run unit tests' - run: | - pip3 install -e . - python3 setup.py test - - - name: 'Generate coverage reports (openSUSE Tumbleweed)' - if: ${{ matrix.container == 'opensuse/tumbleweed' }} - run: | - zypper -n install python3-pytest python3-pytest-cov - pytest --cov=osc - - - name: 'Upload coverage reports to Codecov (openSUSE Tumbleweed)' - if: ${{ matrix.container == 'opensuse/tumbleweed' }} - uses: codecov/codecov-action@v3 diff --git a/osc/core.py b/osc/core.py index dc3eafe60b..4887466c3a 100644 --- a/osc/core.py +++ b/osc/core.py @@ -45,7 +45,7 @@ from . import conf from . import meter from . import oscerr -from .connection import http_request, http_GET, http_POST, http_PUT, http_DELETE +from .connection import http_request, http_GET, http_POST, http_DELETE from .store import Store from .util.helper import decode_list, decode_it, raw_input, _html_escape