Skip to content

Commit

Permalink
Use reusable GitHub Actions for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
nofaralfasi committed Mar 5, 2024
1 parent 498e631 commit 47c06d5
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 9 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI

on:
pull_request:
push:
branches:
- 'master'

concurrency:
group: ${{ github.ref_name }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
rubocop:
name: Rubocop
uses: theforeman/actions/.github/workflows/rubocop.yml@v0
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ pkg
# Locale files
locale/*/*.edit.po
locale/*/*.po.time_stamp

# RubyMine
.idea
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require:
- rubocop-performance

Style/Documentation:
Enabled: false
Lint/RaiseException:
Expand Down
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ source 'https://rubygems.org'
gemspec

gem 'gettext', '>= 3.1.3', '< 4.0.0'
gem 'rake', '~> 13.0'

group :test do
gem 'rubocop', '~> 1.57.0'
gem 'rubocop-performance', '~> 1.5.2'
end
15 changes: 12 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ require 'bundler/gem_tasks'

Bundler::GemHelper.install_tasks

require "hammer_cli_foreman_leapp/version"
require "hammer_cli_foreman_leapp/i18n"
require "hammer_cli/i18n/find_task"
require 'hammer_cli_foreman_leapp/version'
require 'hammer_cli_foreman_leapp/i18n'
require 'hammer_cli/i18n/find_task'
HammerCLI::I18n::FindTask.define(HammerCLIForemanLeapp::I18n::LocaleDomain.new, HammerCLIForemanLeapp.version.to_s)

begin
require 'rubocop/rake_task'
rescue LoadError
# RuboCop is optional
else
RuboCop::RakeTask.new
task default: [:rubocop]
end
8 changes: 3 additions & 5 deletions hammer_cli_foreman_leapp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ Gem::Specification.new do |spec|
spec.platform = Gem::Platform::RUBY
spec.summary = 'Foreman Leapp plugin for Hammer CLI'

spec.files = Dir['{lib,config}/**/*', 'LICENSE', 'README*'] + Dir["locale/**/*.{po,pot,mo}"]
spec.files = Dir['{lib,config}/**/*', 'LICENSE', 'README*'] + Dir['locale/**/*.{po,pot,mo}']
spec.require_paths = ['lib']
spec.test_files = Dir['{test}/**/*']

spec.add_dependency 'hammer_cli_foreman', '>= 2.0.0', '< 4.0.0'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rubocop', '~> 0.80'
spec.add_dependency 'hammer_cli_foreman', '~> 3.10'
spec.required_ruby_version = '>= 2.7', '< 4'
end
5 changes: 4 additions & 1 deletion lib/hammer_cli_foreman_leapp/i18n.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'hammer_cli/i18n'

module HammerCLIForemanLeapp
Expand All @@ -24,5 +26,6 @@ def locale_dir
end
end

domain = [HammerCLIForemanLeapp::I18n::LocaleDomain.new, HammerCLIForemanLeapp::I18n::SystemLocaleDomain.new].find { |d| d.available? }
domain = [HammerCLIForemanLeapp::I18n::LocaleDomain.new,
HammerCLIForemanLeapp::I18n::SystemLocaleDomain.new].find(&:available?)
HammerCLI::I18n.add_domain(domain) if domain

0 comments on commit 47c06d5

Please sign in to comment.