Skip to content

Commit bcdee7f

Browse files
authored
Merge pull request #532 from test-kitchen/github_actions
Signed-off-by: Tim Smith <[email protected]>
2 parents 2c93417 + c564e21 commit bcdee7f

File tree

8 files changed

+55
-46
lines changed

8 files changed

+55
-46
lines changed

.github/workflows/linters.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: linters
3+
4+
'on':
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
yamllint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@master
16+
- name: Run yaml Lint
17+
uses: actionshub/yamllint@main
18+
chefstyle:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
ruby: ['2.5', '2.6', '2.7', '3.0']
23+
name: Chefstyle on Ruby ${{ matrix.ruby }}
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: ruby/setup-ruby@v1
27+
with:
28+
ruby-version: ${{ matrix.ruby }}
29+
bundler-cache: true
30+
- run: bundle exec rake style
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
name: CI
1+
---
2+
name: Unit
23

3-
on:
4+
'on':
45
pull_request:
56
push:
67
branches:
@@ -11,12 +12,12 @@ jobs:
1112
runs-on: ubuntu-latest
1213
strategy:
1314
matrix:
14-
ruby: [ '2.5', '2.6', '2.7', '3.0']
15-
name: Lint & Test with Ruby ${{ matrix.ruby }}
15+
ruby: ['2.5', '2.6', '2.7', '3.0']
16+
name: Unit test on Ruby ${{ matrix.ruby }}
1617
steps:
1718
- uses: actions/checkout@v2
1819
- uses: ruby/setup-ruby@v1
1920
with:
2021
ruby-version: ${{ matrix.ruby }}
2122
bundler-cache: true
22-
- run: bundle exec rake
23+
- run: bundle exec rake test

.rubocop.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
---
12
AllCops:
23
TargetRubyVersion: 2.4
34

45
Lint/IneffectiveAccessModifier:
56
Exclude:
6-
- lib/kitchen/driver/aws/standard_platform.rb
7+
- lib/kitchen/driver/aws/standard_platform.rb

Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ group :test do
77
gem "rake"
88
gem "pry"
99
end
10+
11+
group :chefstyle do
12+
gem "chefstyle", "=1.5.9"
13+
end

Rakefile

+9-17
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,16 @@ require "bundler/gem_tasks"
22
require "rspec/core/rake_task"
33
RSpec::Core::RakeTask.new(:test)
44

5-
desc "Display LOC stats"
6-
task :stats do
7-
puts "\n## Production Code Stats"
8-
sh "countloc -r lib/kitchen lib/kitchen.rb"
9-
puts "\n## Test Code Stats"
10-
sh "countloc -r spec features"
11-
end
12-
13-
require "chefstyle"
14-
require "rubocop/rake_task"
15-
RuboCop::RakeTask.new(:style) do |task|
16-
task.options << "--display-cop-names"
5+
begin
6+
require "chefstyle"
7+
require "rubocop/rake_task"
8+
RuboCop::RakeTask.new(:style) do |task|
9+
task.options += ["--display-cop-names", "--no-color"]
10+
end
11+
rescue LoadError
12+
puts "chefstyle is not available. (sudo) gem install chefstyle to do style checking."
1713
end
1814

1915
desc "Run all quality tasks"
20-
task quality: %i{style stats}
21-
22-
require "yard" unless defined?(YARD)
23-
YARD::Rake::YardocTask.new
2416

25-
task default: %i{test quality style}
17+
task default: %i{test style}

kitchen-ec2.gemspec

-7
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ Gem::Specification.new do |gem|
2222
gem.add_dependency "retryable", ">= 2.0", "< 4.0" # 4.0 will need to be validated
2323

2424
gem.add_development_dependency "rspec", "~> 3.2"
25-
gem.add_development_dependency "countloc", "~> 0.4"
2625
gem.add_development_dependency "maruku", "~> 0.6"
27-
gem.add_development_dependency "yard", ">= 0.9.11"
28-
29-
# style and complexity libraries are tightly version pinned as newer releases
30-
# may introduce new and undesireable style choices which would be immediately
31-
# enforced in CI
32-
gem.add_development_dependency "chefstyle", "= 1.5.9"
3326
gem.add_development_dependency "climate_control"
3427
end

lib/kitchen/driver/aws/standard_platform/debian.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class StandardPlatform
2323
class Debian < StandardPlatform
2424
StandardPlatform.platforms["debian"] = self
2525

26-
# 10/11 are listed last since we default to the first item in the hash
27-
# and 10/11 are not released yet. When they're released move them up
26+
# 11/12 are listed last since we default to the first item in the hash
27+
# and 11/12 are not released yet. When they're released move them up
2828
DEBIAN_CODENAMES = {
2929
10 => "buster",
3030
9 => "stretch",

spec/kitchen/driver/aws/image_selection_spec.rb

+2-14
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Kitchen::Driver::Ec2.new(region: "us-west-2", aws_ssh_key_id: "foo", **config)
2525
end
2626
let(:config) { {} }
27+
let(:state_file) { {} }
2728
def new_instance(platform_name: "blarghle")
2829
Kitchen::Instance.new(
2930
driver: driver,
@@ -33,7 +34,7 @@ def new_instance(platform_name: "blarghle")
3334
transport: Kitchen::Transport::Dummy.new,
3435
verifier: Kitchen::Verifier::Dummy.new,
3536
state_file: Kitchen::StateFile.new("/nonexistent", "suite-name-#{platform_name}"),
36-
lifecycle_hooks: Kitchen::LifecycleHooks.new({})
37+
lifecycle_hooks: Kitchen::LifecycleHooks.new(config, state_file)
3738
)
3839
end
3940

@@ -139,24 +140,11 @@ def new_instance(platform_name: "blarghle")
139140
{ name: "owner-id", values: %w{379101102735} },
140141
{ name: "name", values: %w{debian-jessie-*} },
141142
],
142-
"debian-7" => [
143-
{ name: "owner-id", values: %w{379101102735} },
144-
{ name: "name", values: %w{debian-wheezy-*} },
145-
],
146-
"debian-6" => [
147-
{ name: "owner-id", values: %w{379101102735} },
148-
{ name: "name", values: %w{debian-squeeze-*} },
149-
],
150143
"debian-x86_64" => [
151144
{ name: "owner-id", values: %w{379101102735} },
152145
{ name: "name", values: %w{debian-buster-*} },
153146
{ name: "architecture", values: %w{x86_64} },
154147
],
155-
"debian-6-x86_64" => [
156-
{ name: "owner-id", values: %w{379101102735} },
157-
{ name: "name", values: %w{debian-squeeze-*} },
158-
{ name: "architecture", values: %w{x86_64} },
159-
],
160148

161149
"rhel" => [
162150
{ name: "owner-id", values: %w{309956199498} },

0 commit comments

Comments
 (0)