Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: CI

on:
pull_request:
push:
branches:
- 'develop'
- '*-stable'

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

jobs:
rubocop:
name: Rubocop
uses: theforeman/actions/.github/workflows/rubocop.yml@v0

test:
name: Ruby
needs: rubocop
uses: theforeman/actions/.github/workflows/foreman_plugin.yml@v0
with:
plugin: foreman_plugin_template
34 changes: 15 additions & 19 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@ end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
# No rdoc
else
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ForemanPluginTemplate'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
end

RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ForemanPluginTemplate'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end

APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)

Bundler::GemHelper.install_tasks

require 'rake/testtask'
Expand All @@ -33,15 +29,15 @@ Rake::TestTask.new(:test) do |t|
t.verbose = false
end

task default: :test
task :default

begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new
rescue
puts 'Rubocop not loaded.'
rescue LoadError
# No RuboCop
else
Rake::Task[:default].enhance([:rubocop])
end

task :default do
Rake::Task['rubocop'].execute
end
Rake::Task[:default].enhance([:test])
22 changes: 0 additions & 22 deletions lib/tasks/foreman_plugin_template_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,4 @@ namespace :test do
end
end

namespace :foreman_plugin_template do
task :rubocop do
begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop_foreman_plugin_template) do |task|
task.patterns = ["#{ForemanPluginTemplate::Engine.root}/app/**/*.rb",
"#{ForemanPluginTemplate::Engine.root}/lib/**/*.rb",
"#{ForemanPluginTemplate::Engine.root}/test/**/*.rb"]
end
rescue
puts 'Rubocop not loaded.'
end

Rake::Task['rubocop_foreman_plugin_template'].invoke
end
end

Rake::Task[:test].enhance ['test:foreman_plugin_template']

load 'tasks/jenkins.rake'
if Rake::Task.task_defined?(:'jenkins:unit')
Rake::Task['jenkins:unit'].enhance ['test:foreman_plugin_template', 'foreman_plugin_template:rubocop']
end