forked from FRRouting/netdef-ci-github-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request FRRouting#86 from FRRouting/master
Release 2.3.5
- Loading branch information
Showing
9 changed files
with
148 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# 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 | ||
attr_reader :stages | ||
|
||
def initialize(check_suite) | ||
@check_suite = check_suite | ||
@github = Github::Check.new(@check_suite) | ||
@stages = StageConfiguration.all.map { |config| "[CI] #{config.github_check_run_name}" } | ||
@logger = GithubLogger.instance.create('github_skip_old_tests.log', Logger::INFO) | ||
end | ||
|
||
def skip_old_tests | ||
%w[queued in_progress success failure queued].each do |status| | ||
@github | ||
.check_runs_for_ref(@check_suite.pull_request.repository, | ||
@check_suite.commit_sha_ref, status: status)[:check_runs] | ||
&.each { |check_run| skipping_old_test(check_run) } | ||
end | ||
end | ||
|
||
private | ||
|
||
def skipping_old_test(check_run) | ||
return if check_run[:app][:name] != 'NetDEF CI Hook' or @stages.include?(check_run[:name]) | ||
|
||
@logger.info("Skipping old test suite: #{check_run[:name]}") | ||
puts("Skipping old test suite: #{check_run[:name]}") | ||
|
||
message = 'Old test suite, skipping...' | ||
@github.skipped(check_run[:id], { title: "#{check_run[:name]} summary", summary: message }) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters