Files
opencode-compat/scripts/matrix_json.rb
Ajay Krishnan 3dfecb72c6
Some checks failed
Candidate compatibility / prepare (push) Failing after 32s
Candidate compatibility / fixture-contract (push) Has been skipped
Candidate compatibility / lockstep clients Ruby 3.2 (push) Has been skipped
Candidate compatibility / lockstep clients Ruby 3.3 (push) Has been skipped
Candidate compatibility / lockstep clients Ruby 3.4 (push) Has been skipped
Candidate compatibility / lockstep clients Ruby 4.0 (push) Has been skipped
Candidate compatibility / image ${{ matrix.id }} (push) Has been skipped
Candidate compatibility / repository (push) Successful in 37s
Watch upstream OpenCode / open-compatibility-pr (push) Failing after 11s
Test alpha8 commit candidates before publication
2026-07-19 22:43:44 -07:00

49 lines
2.0 KiB
Ruby
Executable File

# frozen_string_literal: true
require "json"
require_relative "../lib/opencode_compat/client_candidate"
root = File.expand_path("..", __dir__)
manifest = JSON.parse(File.read(File.join(root, "manifests/image-matrix.json")))
candidate = OpenCodeCompat::ClientCandidate.load(File.join(root, "manifests/client-candidate.json"))
candidate.verify!
clients = candidate.document.fetch("clients")
expected_candidate = {
"release_train" => candidate.document.fetch("release_train"),
"publication_state" => candidate.document.fetch("publication_state"),
"opencode_ruby_commit" => clients.dig("opencode-ruby", "ref"),
"opencode_rails_commit" => clients.dig("opencode-rails", "ref")
}
matrix_candidate = manifest.fetch("client_candidate")
unless expected_candidate.all? { |key, value| matrix_candidate[key] == value }
abort "image matrix client_candidate must equal the exact client candidate"
end
unless %w[pending certified].include?(matrix_candidate.fetch("certification_status"))
abort "image matrix client_candidate certification_status must be pending or certified"
end
matrix = manifest.fetch("public_ci").map do |target|
id = target.fetch("id")
profiles = target.fetch("profiles")
certification_scope = target.fetch("certification_scope", "shared-client-contract-only")
unless profiles == ["ruby-rest-sse"]
abort "#{id}: public CI executes exactly ruby-rest-sse; got profiles=#{profiles.inspect}"
end
unless certification_scope == "shared-client-contract-only"
abort "#{id}: certification_scope must be shared-client-contract-only; got #{certification_scope.inspect}"
end
{
"id" => id,
"version" => target.fetch("version"),
"image" => target.fetch("image"),
"consumers" => target.fetch("consumers"),
"profiles" => profiles,
"required_consumer_profiles" => target.fetch("required_consumer_profiles"),
"certification_scope" => certification_scope,
"certification_status" => target.fetch("certification_status")
}
end
puts JSON.generate("include" => matrix)