status.rb 478 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
module Ci
  class Status
    def self.get_status(statuses)
      statuses.reject! { |status| status.try(&:allow_failure?) }

      if statuses.none?
        'skipped'
      elsif statuses.all?(&:success?)
        'success'
      elsif statuses.all?(&:pending?)
        'pending'
      elsif statuses.any?(&:running?) || statuses.any?(&:pending?)
        'running'
      elsif statuses.all?(&:canceled?)
        'canceled'
      else
        'failed'
      end
    end
  end
Robert Speicher's avatar
Robert Speicher committed
21
end