Class: HybridPlatformsConductor::HpcPlugins::Test::GithubCi

Inherits:
Test
  • Object
show all
Includes:
Github
Defined in:
lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb

Overview

Check that all repositories have a successful Github CI

Constant Summary

Constants included from LoggerHelpers

LoggerHelpers::LEVELS_MODIFIERS, LoggerHelpers::LEVELS_TO_STDERR

Instance Attribute Summary

Attributes inherited from Test

#errors, #expected_failure, #name, #node, #platform

Instance Method Summary collapse

Methods included from Github

#for_each_github_repo

Methods included from Credentials

#with_credentials_for

Methods inherited from Test

#assert_equal, #assert_match, #error, #executed, #executed?, #initialize, only_on_nodes, only_on_platforms, #to_s

Methods inherited from Plugin

extend_config_dsl_with, #initialize, valid?

Methods included from LoggerHelpers

#err, #init_loggers, #log_component=, #log_debug?, #log_level=, #out, #section, #set_loggers_format, #stderr_device, #stderr_device=, #stderr_displayed?, #stdout_device, #stdout_device=, #stdout_displayed?, #stdouts_to_s, #with_progress_bar

Constructor Details

This class inherits a constructor from HybridPlatformsConductor::Test

Instance Method Details

#testObject

Check my_test_plugin.rb.sample documentation for signature details.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb', line 18

def test
  for_each_github_repo do |client, repo_info|
    log_debug "Checking CI for Github repository #{repo_info[:slug]}"
    last_run = client.repository_workflow_runs(repo_info[:slug])[:workflow_runs].
      select { |run| run[:head_branch] == 'master' }.
      max_by { |run| run[:created_at] }
    if last_run.nil?
      error "No workflow run found for repository #{repo_info[:slug]}"
    else
      last_status = last_run[:conclusion]
      error "Last workflow status for repository #{repo_info[:slug]} is #{last_status}" unless last_status == 'success'
    end
  end
end