Skip to content

Commit

Permalink
use shared GHA workflow (#64)
Browse files Browse the repository at this point in the history
* use shared GHA workflow

* use Katello::SimplePackage

Katello::Pulp::SimplePackage is gone since

    commit c6df8726cad96bc3d67de1e65c78eb0f236d8524
    Author: ianballou <ianballou67@gmail.com>
    Date:   Thu Jan 5 21:54:38 2023 +0000

        Refs #35006 - Remove Pulp service classes

This bumps the minimum required Katello version to 4.8
  • Loading branch information
evgeni authored Feb 12, 2024
1 parent b715d18 commit 30c39b7
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 93 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/rubocop.yaml

This file was deleted.

81 changes: 15 additions & 66 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion foreman_kernel_care.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion test/factories/foreman_kernel_care_factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/unit/host_managed_extensions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 30c39b7

Please sign in to comment.