Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rubyci-alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

- uses: ruby/setup-ruby@e81a8fa391b11a595c1b7ed84177cc0fe02faf83 # v1.328.0
with:
ruby-version: 2.7
ruby-version: "4.0"

- name: Use master branch
run: git checkout master
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/rubyci-screenshot.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: test

on:
push:
branches:
- master
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: ruby/setup-ruby@e81a8fa391b11a595c1b7ed84177cc0fe02faf83 # v1.328.0
with:
ruby-version: "4.0"
bundler-cache: true

- name: Run the tests
run: bundle exec rake test
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "https://rubygems.org"

gem "selenium-webdriver"
gem "rake"
gem "test-unit"
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
GEM
remote: https://rubygems.org/
specs:
childprocess (3.0.0)
rubyzip (3.4.0)
selenium-webdriver (3.142.6)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
power_assert (3.1.0)
rake (13.4.2)
test-unit (3.7.8)
power_assert

PLATFORMS
ruby

DEPENDENCIES
selenium-webdriver
rake
test-unit

BUNDLED WITH
2.1.2
4.0.20
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require "rake/testtask"

Rake::TestTask.new

task default: :test
32 changes: 17 additions & 15 deletions rubyci-alerts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,23 @@ def filter_failure_reports(failure_reports, timestamps)
end
end

begin
timestamps = {}
timestamps = JSON.parse(File.read(TIMESTAMPS_JSON))

servers = get_servers
failure_reports = get_failure_reports(servers)
filter_failure_reports(failure_reports, timestamps)
failure_reports.each do |_key, report|
notify_simpler_alerts(report)
end
if __FILE__ == $0
begin
timestamps = {}
timestamps = JSON.parse(File.read(TIMESTAMPS_JSON))

servers = get_servers
failure_reports = get_failure_reports(servers)
filter_failure_reports(failure_reports, timestamps)
failure_reports.each do |_key, report|
notify_simpler_alerts(report)
end

File.write(TIMESTAMPS_JSON, JSON.pretty_generate(timestamps))
rescue => e
NOTIFY_CHANNELS.each do |channel|
notify_slack("ruby/rubyci-alerts failed: #{e.class}: #{ escape(e.message) }", channel: channel)
File.write(TIMESTAMPS_JSON, JSON.pretty_generate(timestamps))
rescue => e
NOTIFY_CHANNELS.each do |channel|
notify_slack("ruby/rubyci-alerts failed: #{e.class}: #{ escape(e.message) }", channel: channel)
end
puts e.backtrace
end
puts e.backtrace
end
79 changes: 0 additions & 79 deletions rubyci-screenshot.rb

This file was deleted.

50 changes: 50 additions & 0 deletions test/fixtures/reports.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"id": 4448056,
"server_id": 122,
"datetime": "2026-10-13T20:29:06.000Z",
"branch": "master",
"revision": "7ad8db2311523bc1af6a97154a65bb56758d8f7a",
"summary": "7ad8db23115 ruby (osx1400arm) 67W failed(dist) (diff:test-all,dist,success)",
"created_at": "2026-10-13T21:21:40.268Z",
"updated_at": "2026-10-13T21:21:40.268Z",
"option": null,
"ltsv": "host:osx1400arm\tdepsuffixed_name:ruby-master\tstart_time:20261013T202906Z\tresult:failure\ttitle:7ad8db23115 ruby (osx1400arm) 67W failed(dist)\tcompressed_loghtml_relpath:log/20261013T202906Z.log.html.gz\tcompressed_failhtml_relpath:log/20261013T202906Z.fail.html.gz\tcompressed_diffhtml_relpath:log/20261013T202906Z.diff.html.gz\tdifferent_sections:test-all,dist,success\tversion:7ad8db23115 ruby\tdep_versions:[]\thostname:(osx1400arm)\twarn:67W\tmark:\tstatus:\tfailure_dist:failed(dist)\thttps://github.com/ruby/ruby:7ad8db2311523bc1af6a97154a65bb56758d8f7a\truby_rev:7ad8db23115"
},
{
"id": 4448111,
"server_id": 122,
"datetime": "2026-10-13T21:45:04.000Z",
"branch": "master",
"revision": "67abedae69744b89fb477f96568a9363addfb469",
"summary": "67abedae697 ruby (osx1400arm) 3W success (diff:src,miniversion,version,test-all,rubyspec,dist)",
"created_at": "2026-10-13T22:51:22.807Z",
"updated_at": "2026-10-13T22:51:22.807Z",
"option": null,
"ltsv": "host:osx1400arm\tdepsuffixed_name:ruby-master\tstart_time:20261013T214504Z\tresult:success\ttitle:67abedae697 ruby (osx1400arm) 3W\tcompressed_loghtml_relpath:log/20261013T214504Z.log.html.gz\tcompressed_failhtml_relpath:log/20261013T214504Z.fail.html.gz\tcompressed_diffhtml_relpath:log/20261013T214504Z.diff.html.gz\tdifferent_sections:src,miniversion,version,test-all,rubyspec,dist\tversion:67abedae697 ruby\tdep_versions:[]\thostname:(osx1400arm)\twarn:3W\tmark:\tstatus:\thttps://github.com/ruby/ruby:67abedae69744b89fb477f96568a9363addfb469\truby_rev:67abedae697"
},
{
"id": 4448055,
"server_id": 122,
"datetime": "2026-10-13T20:29:06.000Z",
"branch": "3.3",
"revision": "7ad8db2311523bc1af6a97154a65bb56758d8f7a",
"summary": "7ad8db23115 ruby (osx1400arm) 67W failed(dist) (diff:test-all,dist,success)",
"created_at": "2026-10-13T21:21:40.268Z",
"updated_at": "2026-10-13T21:21:40.268Z",
"option": null,
"ltsv": "host:osx1400arm\tdepsuffixed_name:ruby-3.3\tstart_time:20261013T202906Z\tresult:failure\ttitle:7ad8db23115 ruby (osx1400arm) 67W failed(dist)\tcompressed_loghtml_relpath:log/20261013T202906Z.log.html.gz\tcompressed_failhtml_relpath:log/20261013T202906Z.fail.html.gz\tcompressed_diffhtml_relpath:log/20261013T202906Z.diff.html.gz\tdifferent_sections:test-all,dist,success\tversion:7ad8db23115 ruby\tdep_versions:[]\thostname:(osx1400arm)\twarn:67W\tmark:\tstatus:\tfailure_dist:failed(dist)\thttps://github.com/ruby/ruby:7ad8db2311523bc1af6a97154a65bb56758d8f7a\truby_rev:7ad8db23115"
},
{
"id": 4447990,
"server_id": 40,
"datetime": "2026-10-13T18:30:12.000Z",
"branch": "master",
"revision": "15212f6c1cf04e18c43ca44601f525a3bbf32b62",
"summary": "15212f6c1cf ruby (icc-x64) 12W failed(test-all) (diff:test-all)",
"created_at": "2026-10-13T19:20:41.000Z",
"updated_at": "2026-10-13T19:20:41.000Z",
"option": null,
"ltsv": "host:icc-x64\tdepsuffixed_name:ruby-master\tstart_time:20261013T183012Z\tresult:failure\ttitle:15212f6c1cf ruby (icc-x64) 12W failed(test-all)\tcompressed_loghtml_relpath:log/20261013T183012Z.log.html.gz\tcompressed_failhtml_relpath:log/20261013T183012Z.fail.html.gz\tcompressed_diffhtml_relpath:log/20261013T183012Z.diff.html.gz\tdifferent_sections:test-all\tversion:15212f6c1cf ruby\tdep_versions:[]\thostname:(icc-x64)\twarn:12W\tmark:\tstatus:\tfailure_test-all:failed(test-all)\thttps://github.com/ruby/ruby:15212f6c1cf04e18c43ca44601f525a3bbf32b62\truby_rev:15212f6c1cf"
}
]
20 changes: 20 additions & 0 deletions test/fixtures/servers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"id": 40,
"name": "icc 2025.3 x64 (Ubuntu)",
"uri": "http://rubyci.s3.amazonaws.com/icc-x64/",
"created_at": "2015-03-26T04:15:50.556Z",
"updated_at": "2026-09-10T06:53:58.177Z",
"ordinal": 17.0,
"eol_date": "2029-04-30"
},
{
"id": 122,
"name": "macOS 14.8 Sonoma",
"uri": "http://rubyci.s3.amazonaws.com/osx1400arm/",
"created_at": "2024-10-30T03:19:22.970Z",
"updated_at": "2026-02-13T08:22:13.596Z",
"ordinal": 14.68,
"eol_date": null
}
]
41 changes: 41 additions & 0 deletions test/test_rubyci_alerts.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require "test/unit"
require_relative "../rubyci-alerts"

class TestRubyCIAlerts < Test::Unit::TestCase
FIXTURES = File.join(__dir__, "fixtures")

# URI.open falls back to Kernel#open for a local path, so the fixtures go
# through the real fetch_json.
def fetch_json(url)
super(File.join(FIXTURES, File.basename(url)))
end

def test_get_failure_reports
reports = get_failure_reports(get_servers).map {|_key, report| report.to_h }
assert_equal [
{
name: "macOS 14.8 Sonoma",
commit: "7ad8db23115",
fail_uri: "http://rubyci.s3.amazonaws.com/osx1400arm/ruby-master/log/20261013T202906Z.fail.html.gz",
shortsummary: "67W failed(dist)",
},
{
name: "icc 2025.3 x64 (Ubuntu)",
commit: "15212f6c1cf",
fail_uri: "http://rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20261013T183012Z.fail.html.gz",
shortsummary: "12W failed(test-all)",
},
], reports
end

def test_filter_failure_reports
reports = get_failure_reports(get_servers)
notified = Time.iso8601("2026-10-13T20:29:06Z").to_i
timestamps = { "122" => notified }

filter_failure_reports(reports, timestamps)

assert_equal ["icc 2025.3 x64 (Ubuntu)"], reports.map {|_key, report| report.name }
assert_equal({ "122" => notified, "40" => Time.iso8601("2026-10-13T18:30:12Z").to_i }, timestamps)
end
end
Loading