Skip to content

Commit

Permalink
Old Checks support
Browse files Browse the repository at this point in the history
Fixing class name

Signed-off-by: Rodrigo Nardi <[email protected]>
  • Loading branch information
RodrigoMNardi committed Jul 3, 2024
1 parent 93b6f00 commit bbbf22f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 37 deletions.
2 changes: 1 addition & 1 deletion lib/github/build/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def initialize(check_suite, github, jobs, logger_level: Logger::INFO)
def create_summary(rerun: false)
logger(Logger::INFO, "SUMMARY #{@stages.inspect}")

Skip.new(@check_suite).skip_old_tests
Github::Build::SkipOldTests.new(@check_suite).skip_old_tests

@stages.each do |stage_config|
create_check_run_stage(stage_config)
Expand Down
36 changes: 0 additions & 36 deletions lib/github/build/skip.rb

This file was deleted.

41 changes: 41 additions & 0 deletions lib/github/build/skip_old_tests.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-License-Identifier: BSD-2-Clause
#
# skip_old_tests.rb
# Part of NetDEF CI System
#
# Copyright (c) 2024 by
# Network Device Education Foundation, Inc. ("NetDEF")
#
# frozen_string_literal: true

module Github
module Build
class SkipOldTests
def initialize(check_suite)
@check_suite = check_suite
@github = Github::Check.new(@check_suite)
@stages = StageConfiguration.all.map(&:github_check_run_name)
@logger = GithubLogger.instance.create('github_skip_old_tests.log', Logger::INFO)
end

def skip_old_tests
@github
.check_runs_for_ref(@check_suite.pull_request.repository, @check_suite.commit_sha_ref)[:check_runs]
&.each { |check_run| skipping_old_test(check_run) }
end

private

def skipping_old_test(check_run)
return if @stages.include?(check_run[:name]) or check_run[:app][:name] != 'NetDEF CI Hook'

@logger.info("Skipping old test suite: #{check_run[:name]}")

message = 'Old test suite, skipping...'
@github.create(check_run[:name])
@github.skipped(check_run[:id], { title: "#{check_run[:name]} summary", summary: message })
end
end
end
end

Check warning on line 41 in lib/github/build/skip_old_tests.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 1 trailing blank lines detected. (https://rubystyle.guide#newline-eof) Raw Output: lib/github/build/skip_old_tests.rb:41:1: C: Layout/TrailingEmptyLines: 1 trailing blank lines detected. (https://rubystyle.guide#newline-eof)

0 comments on commit bbbf22f

Please sign in to comment.