Skip to content

Commit

Permalink
Introduce ruby workflow and rubocop
Browse files Browse the repository at this point in the history
- add Rakefile with spec:unit and :rubocop tasks
- add 'ostruct' require to cpi.json.erb_spec.rb
  • Loading branch information
aramprice committed Oct 3, 2024
1 parent 82060be commit 52d9e7f
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Run Specs
on: [ push, pull_request ]

jobs:
unit_specs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { lfs: true }
- uses: ruby/setup-ruby@v1
with: { working-directory: src/bosh_openstack_cpi/ }
- name: lint-and-test
run: |
bundle install
bundle exec rake rubocop
bundle exec rake spec:unit
working-directory: src/bosh_openstack_cpi/
1 change: 1 addition & 0 deletions src/bosh_aws_cpi/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ group :development, :test do
gem 'pry-byebug'
gem 'rspec'
gem 'rake'
gem 'rubocop'
gem 'webmock'
end
25 changes: 25 additions & 0 deletions src/bosh_aws_cpi/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ GEM
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
aws-eventstream (1.3.0)
aws-partitions (1.981.0)
aws-sdk-autoscaling (1.121.0)
Expand Down Expand Up @@ -45,6 +46,8 @@ GEM
hashdiff (1.1.1)
httpclient (2.8.3)
jmespath (1.6.2)
json (2.7.2)
language_server-protocol (3.17.0.3)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
Expand All @@ -53,14 +56,21 @@ GEM
method_source (1.1.0)
multi_json (1.15.0)
openssl (3.2.0)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (6.0.1)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.3.8)
rspec (3.13.0)
rspec-core (~> 3.13.0)
Expand All @@ -75,7 +85,21 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
semi_semantic (1.2.0)
unicode-display_width (2.6.0)
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand All @@ -96,6 +120,7 @@ DEPENDENCIES
rake
rexml
rspec
rubocop
webmock

BUNDLED WITH
Expand Down
12 changes: 12 additions & 0 deletions src/bosh_aws_cpi/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

namespace :spec do
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = 'spec/unit/**{,/*/**}/*_spec.rb'
end
end

RuboCop::RakeTask.new do |t|
t.options = ['--fail-level=E'] # only fail on `Error`
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'spec_helper'
require 'json'
require 'yaml'
require 'ostruct'

describe 'cpi.json.erb' do
let(:cpi_specification_file) { File.absolute_path(File.join(jobs_root, 'aws_cpi/spec')) }
Expand Down

0 comments on commit 52d9e7f

Please sign in to comment.