Skip to content

Commit 2e89707

Browse files
committed
Files for Travis CI
1 parent d19b3bd commit 2e89707

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: ruby
2+
bundler_args: --without integration
3+
rvm:
4+
- 2.1.4
5+
script:
6+
- bundle exec rake travis

Gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'rake'
4+
gem 'berkshelf', '~> 3.2.1'
5+
6+
group :test do
7+
gem 'foodcritic', '~> 4.0.0'
8+
gem 'rubocop', '~> 0.27.1'
9+
gem 'chefspec', '~> 4.1.1'
10+
end
11+
12+
group :integration do
13+
gem 'test-kitchen', '~> 1.2.1'
14+
gem 'kitchen-vagrant', '~> 0.15'
15+
end

Rakefile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env rake
2+
3+
# Style tests. Rubocop and Foodcritic
4+
namespace :style do
5+
begin
6+
require 'rubocop/rake_task'
7+
desc 'Run Ruby style checks'
8+
RuboCop::RakeTask.new(:ruby)
9+
rescue LoadError
10+
puts '>>>>> Rubocop gem not loaded, omitting tasks' unless ENV['CI']
11+
end
12+
13+
begin
14+
require 'foodcritic'
15+
16+
desc 'Run Chef style checks'
17+
FoodCritic::Rake::LintTask.new(:chef) do |t|
18+
t.options = {
19+
fail_tags: ['any']
20+
}
21+
end
22+
rescue LoadError
23+
puts '>>>>> foodcritic gem not loaded, omitting tasks' unless ENV['CI']
24+
end
25+
end
26+
27+
desc 'Run all style checks'
28+
task style: ['style:chef', 'style:ruby']
29+
30+
namespace :unit do
31+
begin
32+
require 'rspec/core/rake_task'
33+
desc 'Runs specs with chefspec.'
34+
RSpec::Core::RakeTask.new(:rspec)
35+
rescue LoadError
36+
puts '>>>>> chefspec gem not loaded, omitting tasks' unless ENV['CI']
37+
end
38+
end
39+
40+
desc 'Run all unit tests'
41+
task unit: ['unit:rspec']
42+
43+
# Integration tests. Kitchen.ci
44+
namespace :integration do
45+
begin
46+
require 'kitchen/rake_tasks'
47+
48+
desc 'Run kitchen integration tests'
49+
Kitchen::RakeTasks.new
50+
rescue LoadError
51+
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
52+
end
53+
end
54+
55+
desc 'Run all tests on Travis'
56+
task travis: ['style', 'unit']
57+
58+
# Default
59+
# task default: ['unit', 'style', 'integration:kitchen:all']
60+
task default: ['unit', 'style', 'integration:kitchen:all']

0 commit comments

Comments
 (0)