Sha256: 012491946bcbc84944c8983eca59ce565dc5641e741767c1bbb40216c4de2e37

Contents?: true

Size: 1.73 KB

Versions: 34

Compression:

Stored size: 1.73 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "optparse"

require_relative "../lib/gitlab_quality/test_tooling"

params = {}

options = OptionParser.new do |opts|
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"

  opts.on('-w', '--slack-webhook-url SLACK_WEBHOOK_URL', String, 'Slack webhook URL') do |slack_webhook_url|
    params[:slack_webhook_url] = slack_webhook_url
  end

  opts.on('-c', '--channel CHANNEL', String, 'Slack channel to post the message to') do |channel|
    params[:channel] = channel
  end

  opts.on('-m', '--message MESSAGE', String, 'Post message to Slack') do |message|
    params[:message] = message
  end

  opts.on('-t', '--include-summary-table FILES', String, 'Add a test summary table based on RSpec report files (JUnit XML)') do |files|
    params[:message] += "\n\n#{GitlabQuality::TestTooling::SummaryTable.create(input_files: files)}"
  end

  opts.on('-u', '--username USERNAME', String, 'Username to use for the Slack message') do |username|
    params[:username] = username
  end

  opts.on('-i', '--icon-emoji ICON_EMOJI', String, 'Icon emoji to use for the Slack message') do |icon_emoji|
    params[:icon_emoji] = icon_emoji
  end

  opts.on_tail('-v', '--version', 'Show the version') do
    require_relative "../lib/gitlab_quality/test_tooling/version"
    puts "#{$PROGRAM_NAME} : #{GitlabQuality::TestTooling::VERSION}"
    exit
  end

  opts.on_tail('-h', '--help', 'Show the usage') do
    puts "Purpose: Post a message to Slack, and optionally add a test summary table based on RSpec report files (JUnit XML)"
    puts opts
    exit
  end

  opts.parse(ARGV)
end

if params.any?
  GitlabQuality::TestTooling::Slack::PostToSlack.new(**params).invoke!
else
  puts options
  exit 1
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
gitlab_quality-test_tooling-1.8.1 exe/post-to-slack
gitlab_quality-test_tooling-1.8.0 exe/post-to-slack
gitlab_quality-test_tooling-1.7.0 exe/post-to-slack
gitlab_quality-test_tooling-1.5.4 exe/post-to-slack
gitlab_quality-test_tooling-1.5.3 exe/post-to-slack
gitlab_quality-test_tooling-1.5.2 exe/post-to-slack
gitlab_quality-test_tooling-1.5.1 exe/post-to-slack
gitlab_quality-test_tooling-1.5.0 exe/post-to-slack
gitlab_quality-test_tooling-1.4.0 exe/post-to-slack
gitlab_quality-test_tooling-1.3.0 exe/post-to-slack
gitlab_quality-test_tooling-1.2.0 exe/post-to-slack
gitlab_quality-test_tooling-1.1.0 exe/post-to-slack
gitlab_quality-test_tooling-1.0.0 exe/post-to-slack
gitlab_quality-test_tooling-0.9.3 exe/post-to-slack
gitlab_quality-test_tooling-0.9.2 exe/post-to-slack
gitlab_quality-test_tooling-0.9.1 exe/post-to-slack
gitlab_quality-test_tooling-0.9.0 exe/post-to-slack
gitlab_quality-test_tooling-0.8.3 exe/post-to-slack
gitlab_quality-test_tooling-0.8.2 exe/post-to-slack
gitlab_quality-test_tooling-0.8.1 exe/post-to-slack