jenkins-bot has submitted this change and it was merged.
Change subject: Run various commands via rake in the bundler env
......................................................................
Run various commands via rake in the bundler env
For CI purposes we would like to use a single entry point 'rake test' as
discussed on T104024. While developing, it is also rather convenient to
run all lint/test/build commands with a single line: rake
That will also let us migrate CI to use a single job (T114860) and
delegate to developers what is being run by CI (simply add more tasks to
rake task 'test').
Add puppet-lint 1.1.0 to dependencies (Gemfile, Gemfile.lock).
Teach rake to load and setup the bundler environement.
Add to rake all the steps we want to achieve in addition of the
preexisting puppet-lint task:
* cucumber
* RSpec
* RuboCop
* YARD
Introduce a couple meta tasks:
test:
Runs all lint/test/build tasks
doc:
Simply executes yard. Later we will want to add puppetlabs/Strings to
render the puppet manifests documentation.
Add a 'testing' section to the README.md.
Usage:
$ bundler install
$ rake -T
rake cucumber # Run Cucumber features
rake doc # Generate all documentations
rake lint # Run puppet-lint
rake rubocop # Run RuboCop
rake rubocop:auto_correct # Auto-correct RuboCop offenses
rake spec # Run RSpec code examples
rake test # Run all build/tests commands
# (CI entry point)
rake yard # Generate YARD Documentation
Example:
$ bundler install
$ rake
Bug: T104024
Bug: T114860
Change-Id: I5d7bf8a1db760928bc36dfac8683f440815d9f09
---
M Gemfile
M Gemfile.lock
M README.md
M Rakefile
4 files changed, 34 insertions(+), 2 deletions(-)
Approvals:
Hashar: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Gemfile b/Gemfile
index fb190d4..b243f0c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,6 +6,7 @@
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v1.7.2'
gem 'rubocop', '~> 0.33.0', require: false
+ gem 'puppet-lint', '1.1.0'
end
group :development, :test do
diff --git a/Gemfile.lock b/Gemfile.lock
index ca8c145..7cca856 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -104,6 +104,7 @@
pry-byebug (2.0.0)
byebug (~> 3.4)
pry (~> 0.10)
+ puppet-lint (1.1.0)
rack (1.6.0)
rainbow (2.0.0)
rb-fsevent (0.9.4)
@@ -168,6 +169,7 @@
fakefs (~> 0.6.5)
mediawiki-vagrant!
pry-byebug
+ puppet-lint (= 1.1.0)
rspec (~> 3.1, >= 3.1.0)
rubocop (~> 0.33.0)
vagrant!
diff --git a/README.md b/README.md
index 8d7b82c..ab11485 100644
--- a/README.md
+++ b/README.md
@@ -111,6 +111,14 @@
For information about settings, see settings.d/README.
+## Testing
+
+You will need bundler < 1.8 (`gem install bundler -v '<1.8'`). Then:
+
+ bundler install
+ rake
+
+Will run all the linter, test and doc generation commands.
## Troubleshoot
diff --git a/Rakefile b/Rakefile
index 6c6fb23..1d876f8 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,8 +1,19 @@
# Rakefile
# --------
-# Run 'rake lint' to lint Puppet files. Requires 'puppet-lint'.
#
+# You must use 'bundler install' first
+#
+
+# pre-flight
+require 'bundler/setup'
+
+# tasks dependencies
+require 'cucumber'
+require 'cucumber/rake/task'
require 'puppet-lint/tasks/puppet-lint'
+require 'rspec/core/rake_task'
+require 'rubocop/rake_task'
+require 'yard'
# Work around bug in puppet-lint configuration
# https://github.com/rodjek/puppet-lint/issues/331
@@ -14,5 +25,15 @@
}
config.log_format = '%{path}:%{linenumber} %{KIND}: %{message}'
end
+Cucumber::Rake::Task.new(:cucumber)
+RSpec::Core::RakeTask.new(:spec)
+RuboCop::RakeTask.new(:rubocop)
+YARD::Rake::YardocTask.new(:yard)
-task default: [:lint]
+task default: [:test]
+
+desc 'Run all build/tests commands (CI entry point)'
+task test: [:spec, :rubocop, :cucumber, :lint, :doc]
+
+desc 'Generate all documentations'
+task doc: [:yard]
--
To view, visit https://gerrit.wikimedia.org/r/246194
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5d7bf8a1db760928bc36dfac8683f440815d9f09
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Dduvall <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits