diff --git a/.github/workflows/rubocop.yaml b/.github/workflows/rubocop.yaml deleted file mode 100644 index 90091b1..0000000 --- a/.github/workflows/rubocop.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Rubocop -on: - pull_request: - push: - branches: - - master -jobs: - rubocop: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Remove non-development dependencies - run: | - sed -i.bak "s/s.add_dependency/# s.add_dependency/g" foreman_kernel_care.gemspec - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.5 - bundler-cache: true - cache-version: 1 - - name: Execute rubocop - run: | - bundle exec rubocop diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index f14e31f..183597a 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -1,76 +1,25 @@ name: Unit tests + on: push: branches: [ "master" ] pull_request: branches: [ "master" ] -defaults: - run: - working-directory: /projects/foreman +concurrency: + group: ${{ github.ref_name }}-${{ github.workflow }} + cancel-in-progress: true jobs: - test_ruby: - defaults: - run: - working-directory: /projects/foreman - env: - PGHOST: postgres - PGUSER: foreman - PGPASS: foreman - RAILS_ENV: test - host: postgres - WORKDIR: /projects/foreman - BUNDLE_PATH: vendor/bundle - GIT_COMMITTER_NAME: "gh_actions" - GIT_COMMITTER_EMAIL: "gh_actions@rh_cloud.foreman" - strategy: - fail-fast: false - matrix: - image_version: [6.0.43] - - runs-on: ubuntu-latest - container: - image: ghcr.io/theforeman/tfm_plugin_test:${{ matrix.image_version }} - - services: - postgres: - image: quay.io/jomitsch/postgres-with-evr - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_USER: foreman - POSTGRES_PASSWORD: foreman + rubocop: + name: Rubocop + uses: theforeman/actions/.github/workflows/rubocop.yml@v0 - steps: - - name: Checkout foreman_kernel_care repo - uses: actions/checkout@v3 - with: - path: ${{ github.workspace }}/projects/foreman_kernel_care - - name: Fix git config - run: | - cp -Rf $GITHUB_WORKSPACE/projects/foreman_kernel_care /projects/ - cd /projects/foreman - echo "gemspec :path => '../foreman_kernel_care'" > bundler.d/foreman_kernel_care.local.rb - /usr/bin/entrypoint.sh git config --global user.name $GIT_COMMITTER_NAME - /usr/bin/entrypoint.sh git config --global user.email $GIT_COMMITTER_EMAIL - - name: remove foreman_rh_cloud and dependencies - working-directory: /projects/foreman - run: | - rm bundler.d/foreman_rh_cloud.local.rb - - name: Run tests suite - run: | - cd /projects/foreman - ls -al /usr/bin - /usr/bin/entrypoint.sh chmod +rx /usr/bin/run_tests.sh - /usr/bin/entrypoint.sh touch /usr/bin/setup_env.sh - /usr/bin/entrypoint.sh chmod +rx /usr/bin/setup_env.sh - /usr/bin/entrypoint.sh head -n -10 /usr/bin/run_tests.sh > /usr/bin/setup_env.sh - /usr/bin/entrypoint.sh /usr/bin/setup_env.sh - - name: Run foreman_kernel_care tests - working-directory: /projects/foreman - run: | - /usr/bin/entrypoint.sh bundle exec rake test:foreman_kernel_care + test: + name: Ruby + needs: rubocop + uses: theforeman/actions/.github/workflows/foreman_plugin.yml@v0 + with: + plugin: foreman_kernel_care + postgresql_container: ghcr.io/theforeman/postgresql-evr + test_existing_database: false diff --git a/app/models/concerns/foreman_kernel_care/host_managed_extensions.rb b/app/models/concerns/foreman_kernel_care/host_managed_extensions.rb index 13ead93..eab2282 100644 --- a/app/models/concerns/foreman_kernel_care/host_managed_extensions.rb +++ b/app/models/concerns/foreman_kernel_care/host_managed_extensions.rb @@ -86,7 +86,7 @@ def delete_yum_pkgs(packages) def create_new_yum_kernel_packages(packages, version, release) new_kernels = packages.map do |p| - ::Katello::Pulp::SimplePackage.new({ + ::Katello::SimplePackage.new({ arch: p.arch, epoch: p.epoch, version: version, diff --git a/foreman_kernel_care.gemspec b/foreman_kernel_care.gemspec index 659dba0..8dadded 100644 --- a/foreman_kernel_care.gemspec +++ b/foreman_kernel_care.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.5.0' s.add_dependency 'foreman_remote_execution', '>= 1.5.6' - s.add_dependency 'katello', '>= 3.8.0' + s.add_dependency 'katello', '>= 4.8.0' s.add_development_dependency 'rdoc', '~> 6', '>= 6.3.1' s.add_development_dependency 'rubocop', '>= 0.87.0' diff --git a/test/factories/foreman_kernel_care_factories.rb b/test/factories/foreman_kernel_care_factories.rb index 2e4b4ce..95155a9 100644 --- a/test/factories/foreman_kernel_care_factories.rb +++ b/test/factories/foreman_kernel_care_factories.rb @@ -19,7 +19,7 @@ :epoch => '1', :nvra => 'kernelcare-2.54-1.el7.x86_64' } - host.import_package_profile([::Katello::Pulp::SimplePackage.new(package_json)]) + host.import_package_profile([::Katello::SimplePackage.new(package_json)]) end end end diff --git a/test/unit/host_managed_extensions_test.rb b/test/unit/host_managed_extensions_test.rb index 82f6b6e..53f300c 100644 --- a/test/unit/host_managed_extensions_test.rb +++ b/test/unit/host_managed_extensions_test.rb @@ -18,7 +18,7 @@ def test_update_kernel_version package_json = { :name => 'kernel', :version => '1', :release => '1.el7', :arch => 'x86_64', :epoch => '1', :nvra => 'kernel-1-1.el7.x86_64' } - host.import_package_profile([::Katello::Pulp::SimplePackage.new(package_json)]) + host.import_package_profile([::Katello::SimplePackage.new(package_json)]) nvra = 'kernel-1-1.el7.x86_64' host.reload version = '2'