-
Notifications
You must be signed in to change notification settings - Fork 0
DD-add rspec subcommand and PR CI #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| name: RSpec | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| rspec: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| bundler-cache: true | ||
| - name: Run specs | ||
| run: bundle exec rspec | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ module CLI | |
| # Thin CLI glue. Orchestrates engine + output adapters. | ||
| class Runner | ||
| VALID_OPTIONS = %w[--dry-run --verbose -v --help -h].freeze | ||
| VALID_SUBCOMMANDS = %w[folders].freeze | ||
| VALID_SUBCOMMANDS = %w[folders rspec].freeze | ||
|
|
||
| def self.run(args) | ||
| new(args).execute | ||
|
|
@@ -42,6 +42,8 @@ def execute | |
| case @subcommand | ||
| when "folders" | ||
| return list_grafana_folders | ||
| when "rspec" | ||
| return run_rspec | ||
| end | ||
|
|
||
| warn "[diffdash] v#{VERSION}" | ||
|
|
@@ -105,6 +107,13 @@ def find_invalid_arguments | |
| end | ||
| end | ||
|
|
||
| def rspec_args | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rspec passthrough arguments rejected as invalid CLI argumentsHigh Severity The |
||
| idx = @args.index("rspec") | ||
| return [] unless idx | ||
|
|
||
| @args[(idx + 1)..] || [] | ||
| end | ||
|
|
||
| def build_outputs(change_set) | ||
| title = Formatters::DashboardTitle.sanitize(change_set.branch_name) | ||
|
|
||
|
|
@@ -200,6 +209,13 @@ def list_grafana_folders | |
| 1 | ||
| end | ||
|
|
||
| def run_rspec | ||
| cmd = ["bundle", "exec", "rspec", *rspec_args] | ||
| warn "[diffdash] Running: #{cmd.join(" ")}" | ||
| system(*cmd) | ||
| $?.success? ? 0 : 1 | ||
| end | ||
|
|
||
| def print_signal_summary(bundle, url: nil) | ||
| log_count = bundle.logs.size | ||
| counter_count = bundle.metrics.count { |s| s.metadata[:metric_type] == :counter } | ||
|
|
@@ -275,6 +291,7 @@ def print_help | |
|
|
||
| Commands: | ||
| folders List available Grafana folders | ||
| rspec [args] Run the RSpec suite (passes args through) | ||
| (none) Run analysis and generate/upload dashboard | ||
|
|
||
| Options: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Ruby version causes workflow to fail
High Severity
The new
rspec.ymlworkflow usesruby/setup-ruby@v1without specifying aruby-versionparameter, and the repository has no.ruby-versionfile. The existingpr-dashboard.ymlworkflow in this repo correctly specifiesruby-version: '3.2'. Without either a version file or explicit parameter, theruby/setup-rubyaction will fail, causing all PR CI checks to fail.