kettle-jem 7.1.44 → 7.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +90 -7
- data/README.md +129 -109
- data/lib/kettle/jem/member_workflow_wrappers.rb +204 -0
- data/lib/kettle/jem/tasks/install_task.rb +59 -6
- data/lib/kettle/jem/templates/.github/workflows/dep-heads.yml.example +5 -1
- data/lib/kettle/jem/templates/.github/workflows/framework-ci.yml.example +9 -0
- data/lib/kettle/jem/templates/.github/workflows/heads.yml.example +9 -2
- data/lib/kettle/jem/templates/.github/workflows/jruby-10.0.yml.example +5 -1
- data/lib/kettle/jem/templates/.github/workflows/jruby.yml.example +5 -1
- data/lib/kettle/jem/templates/.github/workflows/perf-comment.yml.example +1 -1
- data/lib/kettle/jem/templates/.github/workflows/perf.yml.example +2 -2
- data/lib/kettle/jem/templates/.github/workflows/truffleruby-22.3.yml.example +5 -1
- data/lib/kettle/jem/templates/.github/workflows/truffleruby-23.1.yml.example +5 -1
- data/lib/kettle/jem/templates/.idea/.gitignore.example +44 -0
- data/lib/kettle/jem/templates/.structuredmerge/kettle-jem.yml.example +24 -29
- data/lib/kettle/jem/templates/README.md.example +83 -87
- data/lib/kettle/jem/templates/gem.gemspec.example +2 -2
- data/lib/kettle/jem/templates/gemfiles/modular/coverage.gemfile.example +1 -1
- data/lib/kettle/jem/templates/gemfiles/modular/documentation.gemfile.example +1 -1
- data/lib/kettle/jem/templates/gemfiles/modular/templating.gemfile.example +2 -1
- data/lib/kettle/jem/templates/shim/Gemfile.example +1 -1
- data/lib/kettle/jem/templates/shim/gem.gemspec.example +2 -2
- data/lib/kettle/jem/version.rb +1 -1
- data/lib/kettle/jem.rb +581 -62
- data.tar.gz.sig +0 -0
- metadata +12 -10
- metadata.gz.sig +0 -0
data/lib/kettle/jem.rb
CHANGED
|
@@ -32,6 +32,7 @@ require_relative "jem/version"
|
|
|
32
32
|
require_relative "jem/license_txt_migrator"
|
|
33
33
|
require_relative "jem/maintenance_changelog"
|
|
34
34
|
require_relative "jem/relative_paths"
|
|
35
|
+
require_relative "jem/member_workflow_wrappers"
|
|
35
36
|
|
|
36
37
|
begin
|
|
37
38
|
require "kettle/drift"
|
|
@@ -54,6 +55,12 @@ module Kettle
|
|
|
54
55
|
LEGACY_KETTLE_CONFIG_PATH = ".kettle-jem.yml"
|
|
55
56
|
KETTLE_LOCK_PATH = ".structuredmerge/kettle-jem.lock"
|
|
56
57
|
LEGACY_KETTLE_LOCK_PATH = ".kettle-jem.lock"
|
|
58
|
+
KETTLE_FAMILY_CONFIG_PATH = ".kettle/family.yml"
|
|
59
|
+
LEGACY_KETTLE_FAMILY_CONFIG_PATHS = [".kettle-family.yml", ".structuredmerge/kettle-family.yml"].freeze
|
|
60
|
+
KETTLE_DRIFT_LOCK_PATH = ".kettle/drift.lock"
|
|
61
|
+
LEGACY_KETTLE_DRIFT_LOCK_PATH = ".kettle-drift.lock"
|
|
62
|
+
# Declares the repository-root files a monorepo member run writes; read by kettle-family.
|
|
63
|
+
MEMBER_ROOT_OUTPUTS_PATH = ".kettle/root_outputs.yml"
|
|
57
64
|
MANAGED_BLOCK_OPEN = "# <<kettle-jem:generated>> do not edit below this line"
|
|
58
65
|
MANAGED_BLOCK_CLOSE = "# <</kettle-jem:generated>>"
|
|
59
66
|
GEMSPEC_DEPENDENCY_MINIMUM_REQUIREMENTS = {
|
|
@@ -64,11 +71,11 @@ module Kettle
|
|
|
64
71
|
# set in place before Bundler is allowed to evaluate that destination.
|
|
65
72
|
TEMPLATE_MANAGED_DEPENDENCIES = [
|
|
66
73
|
{name: PACKAGE_NAME, requirements: ["~> 7.1", ">= 7.1.28"], bootstrap: false},
|
|
67
|
-
{name: "nomono", requirements: ["~> 1.1", ">= 1.1.
|
|
68
|
-
{name: "kettle-dev", requirements: ["~> 3.1", ">= 3.1.
|
|
74
|
+
{name: "nomono", requirements: ["~> 1.1", ">= 1.1.19"], bootstrap: true},
|
|
75
|
+
{name: "kettle-dev", requirements: ["~> 3.1", ">= 3.1.36"], bootstrap: true},
|
|
69
76
|
{
|
|
70
77
|
name: "kettle-changelog",
|
|
71
|
-
requirements: ["~> 1.0", ">= 1.0.
|
|
78
|
+
requirements: ["~> 1.0", ">= 1.0.23"],
|
|
72
79
|
bootstrap: true,
|
|
73
80
|
ruby_requirement: ">= 4.0.0"
|
|
74
81
|
}
|
|
@@ -108,6 +115,14 @@ module Kettle
|
|
|
108
115
|
truffleruby-24.2
|
|
109
116
|
truffleruby-25.0
|
|
110
117
|
].freeze
|
|
118
|
+
# Dependency-drift workflows whose hard test gate can be converted to a
|
|
119
|
+
# soft-fail neutral check run by opting in with `workflows.soft_fail`.
|
|
120
|
+
SOFT_FAIL_WORKFLOWS = %w[dep-heads unlocked_deps].freeze
|
|
121
|
+
# .kettle/forges.yml (written by kettle-dvcs) drives README forge badges
|
|
122
|
+
# and the Federated DVCS table; absent file => legacy promotion rendering.
|
|
123
|
+
KETTLE_FORGES_STATE_PATH = ".kettle/forges.yml"
|
|
124
|
+
FORGE_DVCS_FORGES = %w[github gitlab codeberg].freeze
|
|
125
|
+
FORGE_DVCS_STATES = %w[live pending off].freeze
|
|
111
126
|
OPENCOLLECTIVE_DISABLED_FILES = %w[.opencollective.yml .github/workflows/opencollective.yml].freeze
|
|
112
127
|
OPT_IN_GITHUB_WORKFLOWS = %w[.github/workflows/discord-notifier.yml].freeze
|
|
113
128
|
# Templates that exist only for projects that set `workflows.duel: true`.
|
|
@@ -151,6 +166,8 @@ module Kettle
|
|
|
151
166
|
DEFAULT_OPENCOLLECTIVE_ORG = "galtzo-floss"
|
|
152
167
|
# These tools remain active, but their dependency ownership belongs to the
|
|
153
168
|
# generated modular Gemfiles rather than a destination gemspec.
|
|
169
|
+
# Plugins every kettle-jem destination runs; ensured in the destination config before templating.
|
|
170
|
+
DEFAULT_PLUGINS = %w[kettle-sponsors].freeze
|
|
154
171
|
EXTERNALIZED_GEMSPEC_DEVELOPMENT_DEPENDENCIES = %w[kettle-drift kettle-soup-cover rubocop-rspec yard-junk].freeze
|
|
155
172
|
# Gems superseded by a template-provided replacement, wrong everywhere
|
|
156
173
|
# regardless of whether the template places a replacement anywhere for
|
|
@@ -207,6 +224,12 @@ module Kettle
|
|
|
207
224
|
reason: "debug is template-managed via gemfiles/modular/debug.gemfile (platform :mri); it ships a native C extension with no jruby/truffleruby release.",
|
|
208
225
|
force_review: false
|
|
209
226
|
}.freeze,
|
|
227
|
+
"kettle-drift" => {
|
|
228
|
+
category: :template_managed,
|
|
229
|
+
action: "remove_direct_gem",
|
|
230
|
+
reason: "kettle-drift is externalized: dependency ownership belongs to gemfiles/modular/templating.gemfile, so a direct gemspec declaration is always a stale duplicate.",
|
|
231
|
+
force_review: false
|
|
232
|
+
}.freeze,
|
|
210
233
|
"sqlite3" => {
|
|
211
234
|
category: :engine_incompatible,
|
|
212
235
|
action: "review",
|
|
@@ -283,6 +306,8 @@ module Kettle
|
|
|
283
306
|
"Rakefile",
|
|
284
307
|
"SECURITY.md",
|
|
285
308
|
".github/FUNDING.yml",
|
|
309
|
+
".github/workflows/auto-assign.yml",
|
|
310
|
+
".github/workflows/dependency-review.yml",
|
|
286
311
|
".gitignore",
|
|
287
312
|
".structuredmerge/git-drivers.toml"
|
|
288
313
|
].freeze
|
|
@@ -491,7 +516,9 @@ module Kettle
|
|
|
491
516
|
"security",
|
|
492
517
|
"contributing",
|
|
493
518
|
"versioning",
|
|
494
|
-
"license"
|
|
519
|
+
"license",
|
|
520
|
+
# Ends every README, members included; carries the sponsor-ask buttons.
|
|
521
|
+
"please give the project a star ⭐ ♥."
|
|
495
522
|
].freeze
|
|
496
523
|
LEGACY_DESTINATION_PATHS = {
|
|
497
524
|
".github/copilot_instructions.md" => ".github/COPILOT_INSTRUCTIONS.md"
|
|
@@ -606,10 +633,12 @@ module Kettle
|
|
|
606
633
|
KJ|OPENCOLLECTIVE_ORG
|
|
607
634
|
KJ|RAKE:DUEL_TASK
|
|
608
635
|
KJ|RAKE:TOP_LEVEL_DOCS_TASK
|
|
636
|
+
KJ|README:CONCORDANT_ENGINES
|
|
609
637
|
KJ|README:COPYRIGHT_NOTICE
|
|
610
638
|
KJ|README:CORPORATE_SPONSORS
|
|
611
639
|
KJ|README:CORPORATE_SPONSORS_DETAIL
|
|
612
640
|
KJ|README:FAMILY_INTRO_BACKEND_MATRIX
|
|
641
|
+
KJ|README:FORGE_COMING_SOON
|
|
613
642
|
KJ|README:LICENSE_BADGE
|
|
614
643
|
KJ|README:LICENSE_COMPAT_BADGE
|
|
615
644
|
KJ|README:LICENSE_EYE_WORKFLOW_BADGE
|
|
@@ -2923,6 +2952,8 @@ module Kettle
|
|
|
2923
2952
|
facts[:copyright] = copyright unless copyright.empty?
|
|
2924
2953
|
forge = forge_facts(kettle_config, env, derived_github_user: nil)
|
|
2925
2954
|
social = social_facts(kettle_config, env)
|
|
2955
|
+
dvcs_states = kettle_forge_states(project_root)
|
|
2956
|
+
forge[:dvcs] = dvcs_states if dvcs_states
|
|
2926
2957
|
facts[:forge] = forge unless forge.empty?
|
|
2927
2958
|
facts[:social] = social unless social.empty?
|
|
2928
2959
|
facts[:license] = license unless license.empty?
|
|
@@ -3200,6 +3231,8 @@ module Kettle
|
|
|
3200
3231
|
facts[:author] = author unless author.empty?
|
|
3201
3232
|
facts[:copyright] = copyright unless copyright.empty?
|
|
3202
3233
|
forge = forge_facts(kettle_config, env, derived_github_user: derived_github_user)
|
|
3234
|
+
dvcs_states = kettle_forge_states(project_root)
|
|
3235
|
+
forge[:dvcs] = dvcs_states if dvcs_states
|
|
3203
3236
|
facts[:forge] = forge unless forge.empty?
|
|
3204
3237
|
social = social_facts(kettle_config, env)
|
|
3205
3238
|
facts[:social] = social unless social.empty?
|
|
@@ -3261,6 +3294,8 @@ module Kettle
|
|
|
3261
3294
|
# Only present when used, so projects without legacy engines keep identical facts.
|
|
3262
3295
|
experimental_legacy_engines = legacy_engine_experimental_names(kettle_config)
|
|
3263
3296
|
facts[:ci][:legacy_experimental_engines] = experimental_legacy_engines unless experimental_legacy_engines.empty?
|
|
3297
|
+
soft_fail_workflows = soft_fail_workflow_names(kettle_config)
|
|
3298
|
+
facts[:ci][:soft_fail_workflows] = soft_fail_workflows unless soft_fail_workflows.empty?
|
|
3264
3299
|
standard_appraisal_gemfiles = github_actions_standard_appraisal_gemfiles(kettle_config)
|
|
3265
3300
|
facts[:ci][:duel] = true if template_config["resolved_duel"]
|
|
3266
3301
|
facts[:ci][:standard_appraisal_gemfiles] = standard_appraisal_gemfiles unless standard_appraisal_gemfiles.empty?
|
|
@@ -3363,6 +3398,19 @@ module Kettle
|
|
|
3363
3398
|
if facts[:kettle_config_bootstrap]
|
|
3364
3399
|
recipes.unshift(kettle_config_bootstrap_recipe(facts.fetch(:kettle_config_bootstrap)))
|
|
3365
3400
|
end
|
|
3401
|
+
# Scaffold and retired workflows (main.yml, ...) are never wanted, including in monorepo members whose
|
|
3402
|
+
# own .github/workflows would otherwise linger because the rest of workflow management is skipped there.
|
|
3403
|
+
unless shim_template_profile?(facts)
|
|
3404
|
+
facts.dig(:ci, :obsolete_workflows).to_a.each do |workflow_path|
|
|
3405
|
+
recipes << recipe_entry(
|
|
3406
|
+
"github_actions_obsolete_workflow_cleanup_#{workflow_recipe_slug(workflow_path)}",
|
|
3407
|
+
workflow_path,
|
|
3408
|
+
"file",
|
|
3409
|
+
"supplied_obsolete_file_deletion",
|
|
3410
|
+
facts: %w[ci]
|
|
3411
|
+
)
|
|
3412
|
+
end
|
|
3413
|
+
end
|
|
3366
3414
|
unless monorepo_template_profile?(facts) || shim_template_profile?(facts)
|
|
3367
3415
|
facts.dig(:ci, :framework_matrix, :gemfiles).to_a.each do |gemfile|
|
|
3368
3416
|
recipes << recipe_entry(
|
|
@@ -3373,15 +3421,6 @@ module Kettle
|
|
|
3373
3421
|
facts: %w[ci]
|
|
3374
3422
|
)
|
|
3375
3423
|
end
|
|
3376
|
-
facts.dig(:ci, :obsolete_workflows).to_a.each do |workflow_path|
|
|
3377
|
-
recipes << recipe_entry(
|
|
3378
|
-
"github_actions_obsolete_workflow_cleanup_#{workflow_recipe_slug(workflow_path)}",
|
|
3379
|
-
workflow_path,
|
|
3380
|
-
"file",
|
|
3381
|
-
"supplied_obsolete_file_deletion",
|
|
3382
|
-
facts: %w[ci]
|
|
3383
|
-
)
|
|
3384
|
-
end
|
|
3385
3424
|
facts.dig(:ci, :opt_in_workflow_cleanups).to_a.each do |workflow_path|
|
|
3386
3425
|
recipes << recipe_entry(
|
|
3387
3426
|
"github_actions_opt_in_workflow_cleanup_#{workflow_recipe_slug(workflow_path)}",
|
|
@@ -3953,6 +3992,12 @@ module Kettle
|
|
|
3953
3992
|
report.dig(:request_envelope, :request, :runtime_context, "ci", "legacy_experimental_engines")
|
|
3954
3993
|
).map(&:to_s).sort
|
|
3955
3994
|
payload[:github_workflow_legacy_experimental_engines] = experimental unless experimental.empty?
|
|
3995
|
+
# Changes the generated output, so it must change the fingerprint.
|
|
3996
|
+
soft_fail = Array(
|
|
3997
|
+
report.dig(:request_envelope, :request, :runtime_context, :ci, :soft_fail_workflows) ||
|
|
3998
|
+
report.dig(:request_envelope, :request, :runtime_context, "ci", "soft_fail_workflows")
|
|
3999
|
+
).map(&:to_s).sort
|
|
4000
|
+
payload[:github_workflow_soft_fail_workflows] = soft_fail unless soft_fail.empty?
|
|
3956
4001
|
end
|
|
3957
4002
|
payload
|
|
3958
4003
|
end
|
|
@@ -4398,9 +4443,13 @@ module Kettle
|
|
|
4398
4443
|
|
|
4399
4444
|
def apply_project(project_root, env: ENV, run_options: {})
|
|
4400
4445
|
legacy_config_migration = apply_legacy_kettle_config_migration!(project_root)
|
|
4446
|
+
kettle_dir_migrations = apply_legacy_kettle_dir_migrations!(project_root)
|
|
4447
|
+
default_plugins_added = ensure_default_plugin_config!(project_root)
|
|
4401
4448
|
events = event_stream_from_options(run_options)
|
|
4402
4449
|
report = plan_project(project_root, env: env, run_options: run_options).merge(mode: "apply")
|
|
4403
4450
|
report[:legacy_config_migration] = legacy_config_migration if legacy_config_migration
|
|
4451
|
+
report[:kettle_dir_migrations] = kettle_dir_migrations unless kettle_dir_migrations.empty?
|
|
4452
|
+
report[:default_plugins_added] = default_plugins_added unless default_plugins_added.empty?
|
|
4404
4453
|
file_work_workers = with_event_phase(events, "file_work_workers") { file_work_workers_for(env, run_options) }
|
|
4405
4454
|
file_work_thread_workers = with_event_phase(events, "file_work_thread_workers") { file_work_thread_workers_for(env, run_options) }
|
|
4406
4455
|
report[:file_work_workers] = file_work_workers
|
|
@@ -4429,12 +4478,18 @@ module Kettle
|
|
|
4429
4478
|
report[:post_apply_steps] = with_event_phase(events, "post_apply_steps") { post_apply_steps(project_root, report) }
|
|
4430
4479
|
emit_step_events(events, "post_apply_step", report.fetch(:post_apply_steps), phase: "post_apply")
|
|
4431
4480
|
end
|
|
4481
|
+
member_wrappers = apply_member_workflow_wrappers!(project_root)
|
|
4482
|
+
report[:member_workflow_wrappers] = member_wrappers unless member_wrappers.empty?
|
|
4432
4483
|
report[:changed_files] = (report.fetch(:changed_files, []) + report.fetch(:post_apply_steps).flat_map do |step|
|
|
4433
4484
|
reported_post_apply_changed_files(step)
|
|
4434
4485
|
end).uniq.sort
|
|
4435
4486
|
if legacy_config_migration
|
|
4436
4487
|
report[:changed_files] = (report.fetch(:changed_files, []) + [LEGACY_KETTLE_CONFIG_PATH, KETTLE_CONFIG_PATH]).uniq.sort
|
|
4437
4488
|
end
|
|
4489
|
+
unless kettle_dir_migrations.empty?
|
|
4490
|
+
migrated_paths = kettle_dir_migrations.flat_map { |entry| [entry[:from], entry[:to]] }.compact
|
|
4491
|
+
report[:changed_files] = (report.fetch(:changed_files, []) + migrated_paths).uniq.sort
|
|
4492
|
+
end
|
|
4438
4493
|
report[:duplicate_drift] = if DecisionPolicy.value_to_boolean((run_options || {})[:defer_drift_check])
|
|
4439
4494
|
{available: false, skipped: true, reason: "deferred_until_postprocessing"}
|
|
4440
4495
|
else
|
|
@@ -5224,11 +5279,12 @@ module Kettle
|
|
|
5224
5279
|
[
|
|
5225
5280
|
{name: "appraisal2", source: %(gem "appraisal2", "~> 3.2", ">= 3.2.6"\n)},
|
|
5226
5281
|
{name: "bundler-audit", source: %(gem "bundler-audit", "~> 0.9.3"\n)},
|
|
5227
|
-
{name: "kettle-dev", source: %(gem "kettle-dev", "~> 3.1", ">= 3.1.
|
|
5228
|
-
{name: "kettle-drift", source: %(gem "kettle-drift", "~> 1.0", ">= 1.0.
|
|
5229
|
-
{name: "kettle-family", source: %(gem "kettle-family", "~> 1.3", ">= 1.3.
|
|
5282
|
+
{name: "kettle-dev", source: %(gem "kettle-dev", "~> 3.1", ">= 3.1.36"\n)},
|
|
5283
|
+
{name: "kettle-drift", source: %(gem "kettle-drift", "~> 1.0", ">= 1.0.21"\n)},
|
|
5284
|
+
{name: "kettle-family", source: %(gem "kettle-family", "~> 1.3", ">= 1.3.57"\n)},
|
|
5285
|
+
{name: "kettle-sponsors", source: %(gem "kettle-sponsors", "~> 1.0", ">= 1.0.0"\n)},
|
|
5230
5286
|
{name: PACKAGE_NAME, source: kettle_jem_dependency_source},
|
|
5231
|
-
{name: "kettle-test", source: %(gem "kettle-test", "~> 2.0", ">= 2.0.
|
|
5287
|
+
{name: "kettle-test", source: %(gem "kettle-test", "~> 2.0", ">= 2.0.31"\n)},
|
|
5232
5288
|
{name: "rake", source: %(gem "rake", "~> 13.0"\n)},
|
|
5233
5289
|
{name: "rspec", source: %(gem "rspec", "~> 3.0"\n)},
|
|
5234
5290
|
{name: "stone_checksums", source: %(gem "stone_checksums", "~> 1.0", ">= 1.0.11"\n)},
|
|
@@ -5576,7 +5632,7 @@ module Kettle
|
|
|
5576
5632
|
runner.run(
|
|
5577
5633
|
project_root: project_root,
|
|
5578
5634
|
template_dir: template_root,
|
|
5579
|
-
lock_path: File.join(project_root.to_s,
|
|
5635
|
+
lock_path: File.join(project_root.to_s, KETTLE_DRIFT_LOCK_PATH),
|
|
5580
5636
|
mode: :force_update,
|
|
5581
5637
|
printer_class: nil
|
|
5582
5638
|
)
|
|
@@ -5740,6 +5796,7 @@ module Kettle
|
|
|
5740
5796
|
"KJ|GH_ORG" => github_org_from_url(facts.dig(:package, :source_url)).to_s,
|
|
5741
5797
|
"KJ|GL:USER" => "",
|
|
5742
5798
|
"KJ|PROJECT_EMOJI" => "💎",
|
|
5799
|
+
"KJ|README:CONCORDANT_ENGINES" => "",
|
|
5743
5800
|
"KJ|README:COPYRIGHT_NOTICE" => "",
|
|
5744
5801
|
"KJ|README:CORPORATE_SPONSORS" => "",
|
|
5745
5802
|
"KJ|README:CORPORATE_SPONSORS_DETAIL" => "",
|
|
@@ -7056,7 +7113,7 @@ module Kettle
|
|
|
7056
7113
|
return original if Ast::Template::Strategies.keep_destination?(strategy)
|
|
7057
7114
|
|
|
7058
7115
|
content = recipe_template_content(project_root, recipe, template_contents: template_contents)
|
|
7059
|
-
return finalize_github_workflow_template(content, facts) if strategy == "raw_copy" && github_workflow_template_recipe?(recipe)
|
|
7116
|
+
return finalize_github_workflow_template(content, facts, workflow: github_workflow_recipe_name(recipe)) if strategy == "raw_copy" && github_workflow_template_recipe?(recipe)
|
|
7060
7117
|
return finalize_template_source_content(recipe, content, facts: facts) if strategy == "raw_copy"
|
|
7061
7118
|
|
|
7062
7119
|
resolved = recipe.fetch(:resolved_template_content) do
|
|
@@ -7108,7 +7165,7 @@ module Kettle
|
|
|
7108
7165
|
|
|
7109
7166
|
if github_workflow_template_recipe?(recipe)
|
|
7110
7167
|
merged = preserve_github_workflow_project_settings(recipe, merged, original, project_root: project_root)
|
|
7111
|
-
merged = finalize_github_workflow_template(merged, facts)
|
|
7168
|
+
merged = finalize_github_workflow_template(merged, facts, workflow: github_workflow_recipe_name(recipe))
|
|
7112
7169
|
return preserve_newer_github_workflow_action_pins(merged, original)
|
|
7113
7170
|
end
|
|
7114
7171
|
|
|
@@ -7120,7 +7177,7 @@ module Kettle
|
|
|
7120
7177
|
accepted = sync_kettle_config_env_overrides(accepted, env, project_root: project_root) if recipe.fetch(:target_path) == KETTLE_CONFIG_PATH
|
|
7121
7178
|
accepted = postprocess_funding_markdown_content(accepted, facts) if recipe.fetch(:target_path) == "FUNDING.md"
|
|
7122
7179
|
if github_workflow_template_recipe?(recipe)
|
|
7123
|
-
accepted = finalize_github_workflow_template(accepted, facts)
|
|
7180
|
+
accepted = finalize_github_workflow_template(accepted, facts, workflow: github_workflow_recipe_name(recipe))
|
|
7124
7181
|
accepted = preserve_newer_github_workflow_action_pins(accepted, original)
|
|
7125
7182
|
end
|
|
7126
7183
|
if recipe.fetch(:target_path) == "README.md"
|
|
@@ -7135,7 +7192,7 @@ module Kettle
|
|
|
7135
7192
|
return finalize_template_source_content(recipe, accepted, facts: facts)
|
|
7136
7193
|
end
|
|
7137
7194
|
|
|
7138
|
-
resolved = finalize_github_workflow_template(resolved, facts) if github_workflow_template_recipe?(recipe)
|
|
7195
|
+
resolved = finalize_github_workflow_template(resolved, facts, workflow: github_workflow_recipe_name(recipe)) if github_workflow_template_recipe?(recipe)
|
|
7139
7196
|
resolved = postprocess_funding_markdown_content(resolved, facts) if recipe.fetch(:target_path) == "FUNDING.md"
|
|
7140
7197
|
if recipe.fetch(:target_path) == "README.md"
|
|
7141
7198
|
return postprocess_readme_content(
|
|
@@ -7419,13 +7476,6 @@ module Kettle
|
|
|
7419
7476
|
engines: facts.dig(:rubygems, :engines)
|
|
7420
7477
|
)
|
|
7421
7478
|
end
|
|
7422
|
-
processed = with_readme_timing("postprocess.compatibility_summary") do
|
|
7423
|
-
normalize_readme_compatibility_summary(
|
|
7424
|
-
processed,
|
|
7425
|
-
facts.dig(:rubygems, :engines),
|
|
7426
|
-
minimum_ruby_token(facts.dig(:rubygems, :min_ruby))
|
|
7427
|
-
)
|
|
7428
|
-
end
|
|
7429
7479
|
processed = with_readme_timing("postprocess.project_heading") { normalize_readme_project_heading(processed, facts) }
|
|
7430
7480
|
processed = with_readme_timing("postprocess.synopsis_heading") { normalize_readme_synopsis_heading(processed, facts) }
|
|
7431
7481
|
processed = with_readme_timing("postprocess.conditional_blocks") { apply_readme_conditional_blocks(processed, facts) }
|
|
@@ -7468,7 +7518,8 @@ module Kettle
|
|
|
7468
7518
|
end
|
|
7469
7519
|
|
|
7470
7520
|
def apply_readme_kloc_badge(content, facts, project_root, destination_content: nil)
|
|
7471
|
-
kloc = readme_kloc_from_changelog(project_root, facts.dig(:project_runtime, :version))
|
|
7521
|
+
kloc = readme_kloc_from_changelog(project_root, facts.dig(:project_runtime, :version)) ||
|
|
7522
|
+
readme_kloc_from_coverage_json(project_root)
|
|
7472
7523
|
return preserve_destination_readme_kloc_badge(content, destination_content) if kloc.to_s.empty?
|
|
7473
7524
|
|
|
7474
7525
|
content.to_s.gsub(
|
|
@@ -7495,6 +7546,85 @@ module Kettle
|
|
|
7495
7546
|
changelog_coverage_kloc(current_changelog_version_section(File.read(changelog_path), version))
|
|
7496
7547
|
end
|
|
7497
7548
|
|
|
7549
|
+
def readme_kloc_from_coverage_json(project_root)
|
|
7550
|
+
return if project_root.to_s.empty?
|
|
7551
|
+
|
|
7552
|
+
scoped_root = canonical_kloc_path(project_root)
|
|
7553
|
+
kloc_coverage_json_candidates(scoped_root).each do |coverage_path|
|
|
7554
|
+
kloc = coverage_json_kloc(coverage_path, scope_root: scoped_root)
|
|
7555
|
+
return kloc if kloc
|
|
7556
|
+
end
|
|
7557
|
+
nil
|
|
7558
|
+
end
|
|
7559
|
+
|
|
7560
|
+
def kloc_coverage_json_candidates(scoped_root)
|
|
7561
|
+
candidates = [File.join(scoped_root, "coverage", "coverage.json")]
|
|
7562
|
+
current = File.dirname(scoped_root)
|
|
7563
|
+
loop do
|
|
7564
|
+
break if current.empty? || current == scoped_root
|
|
7565
|
+
|
|
7566
|
+
if File.file?(File.join(current, KETTLE_FAMILY_CONFIG_PATH)) ||
|
|
7567
|
+
LEGACY_KETTLE_FAMILY_CONFIG_PATHS.any? { |rel| File.file?(File.join(current, rel)) }
|
|
7568
|
+
candidates << File.join(current, "coverage", "coverage.json")
|
|
7569
|
+
break
|
|
7570
|
+
end
|
|
7571
|
+
parent = File.dirname(current)
|
|
7572
|
+
break if parent == current
|
|
7573
|
+
|
|
7574
|
+
current = parent
|
|
7575
|
+
end
|
|
7576
|
+
candidates.uniq
|
|
7577
|
+
end
|
|
7578
|
+
|
|
7579
|
+
def coverage_json_kloc(coverage_path, scope_root:)
|
|
7580
|
+
return unless File.file?(coverage_path)
|
|
7581
|
+
|
|
7582
|
+
data = JSON.parse(File.read(coverage_path))
|
|
7583
|
+
files = data.is_a?(Hash) ? data["coverage"] : nil
|
|
7584
|
+
return unless files.is_a?(Hash)
|
|
7585
|
+
|
|
7586
|
+
coverage_root = File.dirname(File.expand_path(coverage_path), 2)
|
|
7587
|
+
scope_parts = kloc_path_parts(scope_root)
|
|
7588
|
+
total_lines = 0
|
|
7589
|
+
files.each do |file_path, entry|
|
|
7590
|
+
next unless entry.is_a?(Hash)
|
|
7591
|
+
|
|
7592
|
+
candidate_parts = kloc_path_parts(canonical_kloc_path(file_path.to_s, base: coverage_root))
|
|
7593
|
+
next unless candidate_parts[0, scope_parts.length] == scope_parts
|
|
7594
|
+
|
|
7595
|
+
lines = entry["lines"]
|
|
7596
|
+
next unless lines.is_a?(Array)
|
|
7597
|
+
|
|
7598
|
+
total_lines += lines.count { |value| value.is_a?(Integer) }
|
|
7599
|
+
end
|
|
7600
|
+
return unless total_lines.positive?
|
|
7601
|
+
|
|
7602
|
+
format("%.3f", total_lines.to_f / 1000.0)
|
|
7603
|
+
rescue JSON::ParserError, SystemCallError
|
|
7604
|
+
nil
|
|
7605
|
+
end
|
|
7606
|
+
|
|
7607
|
+
def canonical_kloc_path(path, base: nil)
|
|
7608
|
+
expanded = File.expand_path(path, base)
|
|
7609
|
+
existing = expanded
|
|
7610
|
+
suffix = []
|
|
7611
|
+
until File.exist?(existing) || File.symlink?(existing)
|
|
7612
|
+
parent = File.dirname(existing)
|
|
7613
|
+
return expanded if parent == existing
|
|
7614
|
+
|
|
7615
|
+
suffix.unshift(File.basename(existing))
|
|
7616
|
+
existing = parent
|
|
7617
|
+
end
|
|
7618
|
+
suffix.reduce(File.realpath(existing)) { |resolved, part| File.join(resolved, part) }
|
|
7619
|
+
rescue SystemCallError
|
|
7620
|
+
expanded
|
|
7621
|
+
end
|
|
7622
|
+
|
|
7623
|
+
def kloc_path_parts(path)
|
|
7624
|
+
parts = path.tr("\\", "/").split("/").reject(&:empty?)
|
|
7625
|
+
Gem.win_platform? ? parts.map(&:downcase) : parts
|
|
7626
|
+
end
|
|
7627
|
+
|
|
7498
7628
|
def current_changelog_version_section(content, version)
|
|
7499
7629
|
version_text = version.to_s.strip
|
|
7500
7630
|
return if version_text.empty?
|
|
@@ -7522,7 +7652,10 @@ module Kettle
|
|
|
7522
7652
|
match = section.to_s.match(CHANGELOG_COVERAGE_KLOC_PATTERN)
|
|
7523
7653
|
return unless match
|
|
7524
7654
|
|
|
7525
|
-
|
|
7655
|
+
denom = match[1].to_i
|
|
7656
|
+
return unless denom.positive?
|
|
7657
|
+
|
|
7658
|
+
format("%.3f", denom.to_f / 1000.0)
|
|
7526
7659
|
end
|
|
7527
7660
|
|
|
7528
7661
|
def apply_readme_conditional_blocks(content, facts)
|
|
@@ -7621,20 +7754,15 @@ module Kettle
|
|
|
7621
7754
|
processed
|
|
7622
7755
|
end
|
|
7623
7756
|
|
|
7624
|
-
|
|
7757
|
+
# The non-MRI engines named in the README's runtime-compatibility sentence, as a token value that continues
|
|
7758
|
+
# "MRI Ruby X+". Unconfigured engines mean all engines, matching the default.
|
|
7759
|
+
def readme_concordant_engines_token(engines)
|
|
7625
7760
|
enabled = Array(engines).map { |engine| engine.to_s.strip.downcase }.reject(&:empty?).uniq
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
runtime_engines << "JRuby" if enabled.include?("jruby")
|
|
7632
|
-
runtime_engines << "TruffleRuby" if enabled.include?("truffleruby") || enabled.include?("truby")
|
|
7633
|
-
description = runtime_engines.one? ? runtime_engines.first : runtime_engines[0...-1].join(", ") + ", and #{runtime_engines.last}"
|
|
7634
|
-
content.to_s.sub(
|
|
7635
|
-
/Compatible with MRI Ruby [^\n]+\./,
|
|
7636
|
-
"Compatible with #{description}."
|
|
7637
|
-
)
|
|
7761
|
+
enabled = %w[jruby truffleruby] if enabled.empty?
|
|
7762
|
+
concordant = []
|
|
7763
|
+
concordant << "JRuby" if enabled.include?("jruby")
|
|
7764
|
+
concordant << "TruffleRuby" if enabled.include?("truffleruby") || enabled.include?("truby")
|
|
7765
|
+
concordant.empty? ? "" : ", with concordant releases of #{concordant.join(" and ")}"
|
|
7638
7766
|
end
|
|
7639
7767
|
|
|
7640
7768
|
def remove_readme_badge_and_refs(content, badge_source, link_labels)
|
|
@@ -7863,9 +7991,13 @@ module Kettle
|
|
|
7863
7991
|
ReadmePostProcessor.prune_orphaned_workflow_inline_references(prepared)
|
|
7864
7992
|
end
|
|
7865
7993
|
end
|
|
7994
|
+
prepared = rewrite_own_ci_workflow_urls(prepared, style[:own_ci_member]) if style[:own_ci_member]
|
|
7866
7995
|
omitted_sections = Array(style[:omitted_sections]).map(&:to_s)
|
|
7867
7996
|
omitted_sections << "security" if style.key?(:security_enabled) && !style[:security_enabled]
|
|
7868
7997
|
omitted_sections << "floss_funding" if style.key?(:floss_funding_enabled) && !style[:floss_funding_enabled]
|
|
7998
|
+
# With every coverage service pruned, the "Code Coverage" section would be an empty <details> shell.
|
|
7999
|
+
pruned_integrations = (Array(style[:missing_integrations]) + Array(style[:disabled_integrations])).map(&:to_s)
|
|
8000
|
+
omitted_sections << "code coverage" if (COVERAGE_INTEGRATIONS - pruned_integrations).empty?
|
|
7869
8001
|
with_readme_timing("prepare.remove_sections") do
|
|
7870
8002
|
remove_readme_sections(prepared, omitted_sections.map { |section| section.tr("_", " ") })
|
|
7871
8003
|
end
|
|
@@ -7884,6 +8016,36 @@ module Kettle
|
|
|
7884
8016
|
ReadmePostProcessor.delete_markdown_link_definitions(pruned, labels).gsub(/[ \t]{2,}/, " ")
|
|
7885
8017
|
end
|
|
7886
8018
|
|
|
8019
|
+
# Badge links for a member that owns its CI target the root wrappers (`<member>--<workflow>.yml`). Link
|
|
8020
|
+
# definitions are read and replaced through the markdown AST and `URI`; a workflow that is not wrapped, or whose
|
|
8021
|
+
# file already carries the prefix, is left alone.
|
|
8022
|
+
def rewrite_own_ci_workflow_urls(content, member)
|
|
8023
|
+
prefix = "#{member}#{MemberWorkflowWrappers::SEPARATOR}"
|
|
8024
|
+
links = ReadmePostProcessor.markdown_link_definition_owners(content).each_with_object({}) do |owner, rewrites|
|
|
8025
|
+
url = owner.url.to_s
|
|
8026
|
+
rewritten = prefix_workflow_url(url, prefix)
|
|
8027
|
+
rewrites[url] = rewritten if rewritten && rewritten != url
|
|
8028
|
+
end
|
|
8029
|
+
links.empty? ? content : rewrite_markdown_reference_links(content, links)
|
|
8030
|
+
end
|
|
8031
|
+
|
|
8032
|
+
def prefix_workflow_url(url, prefix)
|
|
8033
|
+
uri = URI.parse(url)
|
|
8034
|
+
segments = uri.path.to_s.split("/")
|
|
8035
|
+
index = segments.each_cons(2).find_index { |first, second| first == "actions" && second == "workflows" }
|
|
8036
|
+
return unless index
|
|
8037
|
+
|
|
8038
|
+
file_index = index + 2
|
|
8039
|
+
file = segments[file_index]
|
|
8040
|
+
return unless file && MemberWorkflowWrappers.wrapped_workflow?(file) && !file.start_with?(prefix)
|
|
8041
|
+
|
|
8042
|
+
segments[file_index] = "#{prefix}#{file}"
|
|
8043
|
+
uri.path = segments.join("/")
|
|
8044
|
+
uri.to_s
|
|
8045
|
+
rescue URI::InvalidURIError
|
|
8046
|
+
nil
|
|
8047
|
+
end
|
|
8048
|
+
|
|
7887
8049
|
def prune_missing_workflow_link_definitions(content, workflow_paths)
|
|
7888
8050
|
ensure_runtime_dependencies!
|
|
7889
8051
|
existing = Array(workflow_paths).map { |path| path.to_s.delete_prefix("./") }.to_set
|
|
@@ -7930,7 +8092,7 @@ module Kettle
|
|
|
7930
8092
|
return finalize_gemfile_template_source(recipe, template_content, destination_content, facts: facts, template_content: template_content)
|
|
7931
8093
|
end
|
|
7932
8094
|
return merge_appraisals_template_policy(template_content, facts: facts, target_path: recipe.fetch(:target_path)) if file_type == :appraisals
|
|
7933
|
-
return finalize_github_workflow_template(prune_github_workflow_matrix_by_min_ruby(template_content, facts), facts) if github_workflow_template_recipe?(recipe)
|
|
8095
|
+
return finalize_github_workflow_template(prune_github_workflow_matrix_by_min_ruby(template_content, facts), facts, workflow: github_workflow_recipe_name(recipe)) if github_workflow_template_recipe?(recipe)
|
|
7934
8096
|
|
|
7935
8097
|
return template_content
|
|
7936
8098
|
end
|
|
@@ -7993,7 +8155,7 @@ module Kettle
|
|
|
7993
8155
|
end
|
|
7994
8156
|
return merge_appraisals_template_policy(output, facts: facts, target_path: recipe.fetch(:target_path)) if file_type == :appraisals
|
|
7995
8157
|
|
|
7996
|
-
output = finalize_github_workflow_template(prune_github_workflow_matrix_by_min_ruby(output, facts), facts) if github_workflow_template_recipe?(recipe)
|
|
8158
|
+
output = finalize_github_workflow_template(prune_github_workflow_matrix_by_min_ruby(output, facts), facts, workflow: github_workflow_recipe_name(recipe)) if github_workflow_template_recipe?(recipe)
|
|
7997
8159
|
output = normalize_simplecov_template_source(output) if recipe.fetch(:target_path).to_s == ".simplecov"
|
|
7998
8160
|
output = normalize_spec_helper_simplecov_template_source(output) if recipe.fetch(:target_path).to_s == "spec/spec_helper.rb"
|
|
7999
8161
|
output = normalize_spec_helper_block_bindings(output, template_content) if recipe.fetch(:target_path).to_s == "spec/spec_helper.rb"
|
|
@@ -9416,9 +9578,13 @@ module Kettle
|
|
|
9416
9578
|
content
|
|
9417
9579
|
end
|
|
9418
9580
|
|
|
9419
|
-
def finalize_github_workflow_template(content, facts = nil)
|
|
9420
|
-
|
|
9581
|
+
def finalize_github_workflow_template(content, facts = nil, workflow: nil)
|
|
9582
|
+
# Pruned here as well as in prepare_github_workflow_template: a merge keeps destination-only jobs, so a job for
|
|
9583
|
+
# an engine that has since been disabled would otherwise survive in the destination forever.
|
|
9584
|
+
output = prune_disabled_github_workflow_engine_jobs(content, facts)
|
|
9585
|
+
output = apply_github_actions_engine_exec_cmd_overrides(output, facts)
|
|
9421
9586
|
output = apply_legacy_engine_experimental(output, facts)
|
|
9587
|
+
output = apply_soft_fail_workflows(output, facts, workflow: workflow)
|
|
9422
9588
|
inject_framework_matrix_workflow_env(update_github_actions_pins(output), facts)
|
|
9423
9589
|
end
|
|
9424
9590
|
|
|
@@ -9445,14 +9611,19 @@ module Kettle
|
|
|
9445
9611
|
end
|
|
9446
9612
|
|
|
9447
9613
|
# Adds `experimental: true` to the matrix entry of legacy engines configured
|
|
9448
|
-
# with mode: experimental (the job's continue-on-error already honours it)
|
|
9614
|
+
# with mode: experimental (the job's continue-on-error already honours it),
|
|
9615
|
+
# and converts the workflow's test step to a soft-fail check run so failures
|
|
9616
|
+
# surface as a neutral check run instead of a silent green.
|
|
9449
9617
|
def apply_legacy_engine_experimental(content, facts)
|
|
9450
9618
|
names = Array(facts.to_h.dig(:ci, :legacy_experimental_engines))
|
|
9451
9619
|
return content if names.empty?
|
|
9452
9620
|
|
|
9453
9621
|
lines = content.to_s.lines
|
|
9622
|
+
matched = false
|
|
9454
9623
|
yaml_mapping_nodes(content).sort_by { |mapping| -mapping.start_line }.each do |mapping|
|
|
9455
9624
|
next unless names.include?(yaml_mapping_scalar_value(mapping, "ruby"))
|
|
9625
|
+
|
|
9626
|
+
matched = true
|
|
9456
9627
|
next if yaml_mapping_scalar_node(mapping, "experimental")
|
|
9457
9628
|
|
|
9458
9629
|
anchor = yaml_mapping_scalar_node(mapping, "exec_cmd")
|
|
@@ -9461,6 +9632,80 @@ module Kettle
|
|
|
9461
9632
|
indent = lines.fetch(anchor.start_line).to_s.match(/\A(\s*)/)[1]
|
|
9462
9633
|
lines.insert(anchor.start_line + 1, "#{indent}experimental: true\n")
|
|
9463
9634
|
end
|
|
9635
|
+
output = lines.join
|
|
9636
|
+
return output unless matched
|
|
9637
|
+
|
|
9638
|
+
ensure_github_workflow_checks_write(convert_test_run_steps_to_soft_fail(output))
|
|
9639
|
+
rescue Psych::Exception
|
|
9640
|
+
content
|
|
9641
|
+
end
|
|
9642
|
+
|
|
9643
|
+
# Opt-in via `workflows.soft_fail`: converts the test step of dependency-
|
|
9644
|
+
# drift workflows (dep-heads, unlocked_deps) to a soft-fail check run so
|
|
9645
|
+
# upstream gem breakage reports neutral instead of failing the workflow.
|
|
9646
|
+
def apply_soft_fail_workflows(content, facts, workflow: nil)
|
|
9647
|
+
names = Array(facts.to_h.dig(:ci, :soft_fail_workflows))
|
|
9648
|
+
return content unless names.include?(workflow.to_s)
|
|
9649
|
+
|
|
9650
|
+
ensure_github_workflow_checks_write(convert_test_run_steps_to_soft_fail(content))
|
|
9651
|
+
end
|
|
9652
|
+
|
|
9653
|
+
# Converts shell `run:` test steps into Jitujoshi71/soft-fail action steps
|
|
9654
|
+
# so a failing test run reports a neutral check run (with the tail of the
|
|
9655
|
+
# test output) instead of failing the job. Appraisal `[Attempt N]` retry
|
|
9656
|
+
# steps use continue-on-error as control flow and are never converted.
|
|
9657
|
+
def convert_test_run_steps_to_soft_fail(content)
|
|
9658
|
+
lines = content.to_s.lines
|
|
9659
|
+
converted = false
|
|
9660
|
+
yaml_mapping_nodes(content).sort_by { |mapping| -mapping.start_line }.each do |mapping|
|
|
9661
|
+
run_node = yaml_mapping_scalar_node(mapping, "run")
|
|
9662
|
+
name_node = yaml_mapping_scalar_node(mapping, "name")
|
|
9663
|
+
next unless run_node && name_node
|
|
9664
|
+
next if yaml_mapping_scalar_node(mapping, "uses")
|
|
9665
|
+
next if name_node.value.to_s.start_with?("[Attempt")
|
|
9666
|
+
next unless run_node.value.to_s.start_with?("bundle exec")
|
|
9667
|
+
|
|
9668
|
+
indent = lines.fetch(run_node.start_line).to_s.match(/\A(\s*)/)[1]
|
|
9669
|
+
lines[run_node.start_line] = "#{indent}uses: #{github_actions_step_pins.fetch("Jitujoshi71/soft-fail")}\n" \
|
|
9670
|
+
"#{indent}with:\n" \
|
|
9671
|
+
"#{indent} run: #{run_node.value}\n" \
|
|
9672
|
+
"#{indent} check-name: #{name_node.value} (soft-fail)\n"
|
|
9673
|
+
converted = true
|
|
9674
|
+
end
|
|
9675
|
+
converted ? lines.join : content
|
|
9676
|
+
rescue Psych::Exception
|
|
9677
|
+
content
|
|
9678
|
+
end
|
|
9679
|
+
|
|
9680
|
+
# Adds `checks: write` to the workflow's top-level permissions block, which
|
|
9681
|
+
# soft-fail test steps need to publish neutral check runs. No-op when the
|
|
9682
|
+
# permission is already present or the block is missing or not a mapping.
|
|
9683
|
+
def ensure_github_workflow_checks_write(content)
|
|
9684
|
+
document = Psych.parse_stream(content.to_s).children.first
|
|
9685
|
+
root = document&.root
|
|
9686
|
+
return content unless root.is_a?(Psych::Nodes::Mapping)
|
|
9687
|
+
|
|
9688
|
+
permissions = nil
|
|
9689
|
+
root.children.each_slice(2) do |key_node, value_node|
|
|
9690
|
+
next unless key_node.is_a?(Psych::Nodes::Scalar) && key_node.value.to_s == "permissions"
|
|
9691
|
+
|
|
9692
|
+
permissions = value_node
|
|
9693
|
+
break
|
|
9694
|
+
end
|
|
9695
|
+
return content unless permissions.is_a?(Psych::Nodes::Mapping)
|
|
9696
|
+
|
|
9697
|
+
has_checks = permissions.children.each_slice(2).any? do |key_node, _value_node|
|
|
9698
|
+
key_node.is_a?(Psych::Nodes::Scalar) && key_node.value.to_s == "checks"
|
|
9699
|
+
end
|
|
9700
|
+
return content if has_checks
|
|
9701
|
+
|
|
9702
|
+
# A block mapping's end_line can trail past its last child onto blank
|
|
9703
|
+
# lines, so anchor the insertion on the last child node instead.
|
|
9704
|
+
anchor = permissions.children.last || permissions
|
|
9705
|
+
lines = content.to_s.lines
|
|
9706
|
+
indent = lines.fetch(anchor.end_line).to_s.match(/\A(\s*)/)[1]
|
|
9707
|
+
indent = " " if indent.empty?
|
|
9708
|
+
lines.insert(anchor.end_line + 1, "#{indent}checks: write\n")
|
|
9464
9709
|
lines.join
|
|
9465
9710
|
rescue Psych::Exception
|
|
9466
9711
|
content
|
|
@@ -9614,6 +9859,10 @@ module Kettle
|
|
|
9614
9859
|
recipe.fetch(:target_path).to_s.start_with?(".github/workflows/")
|
|
9615
9860
|
end
|
|
9616
9861
|
|
|
9862
|
+
def github_workflow_recipe_name(recipe)
|
|
9863
|
+
File.basename(recipe.fetch(:target_path).to_s, ".yml")
|
|
9864
|
+
end
|
|
9865
|
+
|
|
9617
9866
|
def yaml_process_result_adapter_failure?(merge_result)
|
|
9618
9867
|
process_result_adapter_failure?(merge_result)
|
|
9619
9868
|
end
|
|
@@ -14810,6 +15059,109 @@ module Kettle
|
|
|
14810
15059
|
migration.merge(applied: true)
|
|
14811
15060
|
end
|
|
14812
15061
|
|
|
15062
|
+
# One-time MOVE/prune migrations for .kettle/ tool configs:
|
|
15063
|
+
# - .kettle-family.yml / .structuredmerge/kettle-family.yml -> .kettle/family.yml
|
|
15064
|
+
# - .kettle-drift.lock -> .kettle/drift.lock
|
|
15065
|
+
# Legacy files are always removed so stale configs never linger alongside canonical paths.
|
|
15066
|
+
def apply_legacy_kettle_dir_migrations!(project_root)
|
|
15067
|
+
applied = []
|
|
15068
|
+
migrations = [
|
|
15069
|
+
[LEGACY_KETTLE_FAMILY_CONFIG_PATHS, KETTLE_FAMILY_CONFIG_PATH],
|
|
15070
|
+
[[LEGACY_KETTLE_DRIFT_LOCK_PATH], KETTLE_DRIFT_LOCK_PATH]
|
|
15071
|
+
]
|
|
15072
|
+
migrations.each do |legacy_paths, canonical_rel|
|
|
15073
|
+
canonical = File.join(project_root, canonical_rel)
|
|
15074
|
+
legacy_paths.each do |legacy_rel|
|
|
15075
|
+
legacy = File.join(project_root, legacy_rel)
|
|
15076
|
+
next unless File.file?(legacy)
|
|
15077
|
+
|
|
15078
|
+
if File.file?(canonical)
|
|
15079
|
+
File.delete(legacy)
|
|
15080
|
+
applied << {from: legacy_rel, to: canonical_rel, action: :deleted_stale_legacy, applied: true}
|
|
15081
|
+
else
|
|
15082
|
+
FileUtils.mkdir_p(File.dirname(canonical))
|
|
15083
|
+
FileUtils.mv(legacy, canonical)
|
|
15084
|
+
applied << {from: legacy_rel, to: canonical_rel, action: :moved, applied: true}
|
|
15085
|
+
end
|
|
15086
|
+
end
|
|
15087
|
+
end
|
|
15088
|
+
applied
|
|
15089
|
+
end
|
|
15090
|
+
|
|
15091
|
+
# Pre-flight: plugins are loaded from the destination config at the start of a run, so a plugin the
|
|
15092
|
+
# template newly ships (kettle-sponsors) would otherwise only take effect one run after the template
|
|
15093
|
+
# merge adds it to the config. Ensure the defaults are listed before planning so they run the first time.
|
|
15094
|
+
def ensure_default_plugin_config!(project_root)
|
|
15095
|
+
path = kettle_jem_config_path(project_root)
|
|
15096
|
+
return [] unless File.file?(path)
|
|
15097
|
+
|
|
15098
|
+
original = File.read(path)
|
|
15099
|
+
config = YAML.safe_load(original, aliases: false)
|
|
15100
|
+
return [] unless config.is_a?(Hash)
|
|
15101
|
+
|
|
15102
|
+
configured = PluginLoader.normalize_plugin_names(plugin_names_from_config(config))
|
|
15103
|
+
missing = DEFAULT_PLUGINS - configured
|
|
15104
|
+
return [] if missing.empty?
|
|
15105
|
+
# A mapping-style `plugins:` toggles by name; leave an explicit opt-out (false) alone.
|
|
15106
|
+
return [] if config["plugins"].is_a?(Hash)
|
|
15107
|
+
|
|
15108
|
+
updated = ensure_yaml_top_level_sequence_items(original, "plugins", missing)
|
|
15109
|
+
return [] if updated == original
|
|
15110
|
+
|
|
15111
|
+
File.write(path, updated)
|
|
15112
|
+
missing
|
|
15113
|
+
rescue Psych::SyntaxError
|
|
15114
|
+
[]
|
|
15115
|
+
end
|
|
15116
|
+
|
|
15117
|
+
# GitHub only runs root workflows. A monorepo member that declares `repository.ci: own` therefore gets
|
|
15118
|
+
# root wrappers of its CI workflows (see MemberWorkflowWrappers); stale wrappers are removed.
|
|
15119
|
+
def apply_member_workflow_wrappers!(project_root)
|
|
15120
|
+
manifest = File.join(project_root, MEMBER_ROOT_OUTPUTS_PATH)
|
|
15121
|
+
unless readme_owns_ci?(kettle_jem_config(project_root))
|
|
15122
|
+
FileUtils.rm_f(manifest)
|
|
15123
|
+
return []
|
|
15124
|
+
end
|
|
15125
|
+
|
|
15126
|
+
repo_root = git_worktree_root(project_root)
|
|
15127
|
+
member_dir = Pathname.new(File.realpath(project_root)).relative_path_from(Pathname.new(File.realpath(repo_root))).to_s
|
|
15128
|
+
return [] if member_dir == "."
|
|
15129
|
+
|
|
15130
|
+
member = File.basename(project_root)
|
|
15131
|
+
prelude = kettle_jem_config(project_root).dig("repository", "ci_prelude")
|
|
15132
|
+
wrappers = MemberWorkflowWrappers.generate(member: member, member_dir: member_dir, member_root: project_root, prelude: prelude)
|
|
15133
|
+
changed = []
|
|
15134
|
+
removed = []
|
|
15135
|
+
wrappers.each do |relative_path, content|
|
|
15136
|
+
path = File.join(repo_root, relative_path)
|
|
15137
|
+
next if File.file?(path) && File.read(path) == content
|
|
15138
|
+
|
|
15139
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
15140
|
+
File.write(path, content)
|
|
15141
|
+
changed << relative_path
|
|
15142
|
+
end
|
|
15143
|
+
Dir.glob(File.join(repo_root, ".github", "workflows", "#{member}#{MemberWorkflowWrappers::SEPARATOR}*.{yml,yaml}")).each do |path|
|
|
15144
|
+
relative_path = path.delete_prefix("#{repo_root}/")
|
|
15145
|
+
next if wrappers.key?(relative_path)
|
|
15146
|
+
|
|
15147
|
+
File.delete(path)
|
|
15148
|
+
removed << relative_path
|
|
15149
|
+
end
|
|
15150
|
+
write_member_root_outputs_manifest(manifest, wrappers.keys.sort, removed.sort)
|
|
15151
|
+
(changed + removed).sort
|
|
15152
|
+
end
|
|
15153
|
+
|
|
15154
|
+
# Tells kettle-family which repository-root files this member run writes, so it can commit them
|
|
15155
|
+
# without a hand-kept `template.root_outputs` list. Paths are relative to the repository root.
|
|
15156
|
+
def write_member_root_outputs_manifest(manifest, paths, removed)
|
|
15157
|
+
content = +"# GENERATED by kettle-jem. Repository-root files this member's template run writes.\n"
|
|
15158
|
+
content << Psych.dump({"paths" => paths, "removed" => removed}).delete_prefix("---\n")
|
|
15159
|
+
return if File.file?(manifest) && File.read(manifest) == content
|
|
15160
|
+
|
|
15161
|
+
FileUtils.mkdir_p(File.dirname(manifest))
|
|
15162
|
+
File.write(manifest, content)
|
|
15163
|
+
end
|
|
15164
|
+
|
|
14813
15165
|
def kettle_jem_config_relative_path(project_root)
|
|
14814
15166
|
path = kettle_jem_config_path(project_root)
|
|
14815
15167
|
File.expand_path(path).delete_prefix("#{File.expand_path(project_root.to_s)}/")
|
|
@@ -15361,6 +15713,7 @@ module Kettle
|
|
|
15361
15713
|
"KJ|NAMESPACE_SHIELD" => shield_token(rubygems.fetch(:namespace, package.fetch(:name).to_s).to_s),
|
|
15362
15714
|
"KJ|README:TITLE" => readme_title_token(package, rubygems),
|
|
15363
15715
|
"KJ|MIN_RUBY" => minimum_ruby_token(rubygems[:min_ruby]),
|
|
15716
|
+
"KJ|README:CONCORDANT_ENGINES" => readme_concordant_engines_token(rubygems[:engines]),
|
|
15364
15717
|
"KJ|MIN_DEV_RUBY" => facts.dig(:project_runtime, :test_min_ruby).to_s,
|
|
15365
15718
|
"KJ|MIN_TEST_RUBY" => facts.dig(:project_runtime, :test_min_ruby).to_s,
|
|
15366
15719
|
"KJ|KETTLE_CHANGELOG_GEMFILE_DEPENDENCY" => kettle_changelog_gemfile_dependency_token(
|
|
@@ -15396,6 +15749,7 @@ module Kettle
|
|
|
15396
15749
|
).merge(
|
|
15397
15750
|
readme_corporate_sponsor_template_tokens(facts.fetch(:readme_sponsors, {}))
|
|
15398
15751
|
)
|
|
15752
|
+
tokens.merge!(forge_state_template_tokens(facts.fetch(:forge, {}), tokens["KJ|README:REPO_SLUG"].to_s))
|
|
15399
15753
|
org = funding[:open_collective_org].to_s
|
|
15400
15754
|
tokens["KJ|OPENCOLLECTIVE_ORG"] = org
|
|
15401
15755
|
tokens["KJ|README:FAMILY_INTRO_BACKEND_MATRIX"] =
|
|
@@ -16087,6 +16441,37 @@ module Kettle
|
|
|
16087
16441
|
)
|
|
16088
16442
|
end
|
|
16089
16443
|
|
|
16444
|
+
# Per-forge federation state written by kettle-dvcs to .kettle/forges.yml.
|
|
16445
|
+
# Returns {origin: "github", states: {"github" => "live", ...}} or nil when
|
|
16446
|
+
# the file is absent or holds no usable states (legacy README rendering).
|
|
16447
|
+
def kettle_forge_states(project_root)
|
|
16448
|
+
path = File.join(project_root.to_s, KETTLE_FORGES_STATE_PATH)
|
|
16449
|
+
return unless File.file?(path)
|
|
16450
|
+
|
|
16451
|
+
data = YAML.safe_load_file(path, permitted_classes: [], aliases: false)
|
|
16452
|
+
return unless data.is_a?(Hash)
|
|
16453
|
+
|
|
16454
|
+
raw = data["forges"]
|
|
16455
|
+
return unless raw.is_a?(Hash)
|
|
16456
|
+
|
|
16457
|
+
states = raw.each_with_object({}) do |(name, value), acc|
|
|
16458
|
+
key = name.to_s
|
|
16459
|
+
next unless FORGE_DVCS_FORGES.include?(key)
|
|
16460
|
+
|
|
16461
|
+
state = value.is_a?(Hash) ? value["state"] : value
|
|
16462
|
+
state = "off" if state == false # YAML 1.1 parses bare `off` as false
|
|
16463
|
+
state = state.to_s.strip
|
|
16464
|
+
acc[key] = state if FORGE_DVCS_STATES.include?(state)
|
|
16465
|
+
end
|
|
16466
|
+
return if states.empty?
|
|
16467
|
+
|
|
16468
|
+
origin = data["origin"].to_s.strip
|
|
16469
|
+
origin = "github" unless FORGE_DVCS_FORGES.include?(origin)
|
|
16470
|
+
{origin: origin, states: states}
|
|
16471
|
+
rescue Psych::Exception
|
|
16472
|
+
nil
|
|
16473
|
+
end
|
|
16474
|
+
|
|
16090
16475
|
def forge_user_value(forge_config, env, key, derived_value: nil)
|
|
16091
16476
|
preferred_template_token_value(derived_value, forge_config[key.to_s], env, FORGE_USER_ENV_KEYS.fetch(key))
|
|
16092
16477
|
end
|
|
@@ -16100,6 +16485,86 @@ module Kettle
|
|
|
16100
16485
|
}
|
|
16101
16486
|
end
|
|
16102
16487
|
|
|
16488
|
+
# Renders the README federation tokens from kettle-dvcs forge state
|
|
16489
|
+
# (.kettle/forges.yml via facts[:forge][:dvcs]). Without state the legacy
|
|
16490
|
+
# promotion renders unchanged: all forges get badges and table rows, and
|
|
16491
|
+
# the summary keeps "(Coming soon!)".
|
|
16492
|
+
def forge_state_template_tokens(forge, repo_slug)
|
|
16493
|
+
dvcs = forge[:dvcs]
|
|
16494
|
+
return legacy_forge_dvcs_tokens(repo_slug) unless dvcs
|
|
16495
|
+
|
|
16496
|
+
states = dvcs[:states]
|
|
16497
|
+
origin = dvcs[:origin]
|
|
16498
|
+
{
|
|
16499
|
+
"KJ|README:FORGE_SOURCE_BADGES" => forge_source_badges(states),
|
|
16500
|
+
"KJ|README:FORGE_COMING_SOON" => (FORGE_DVCS_FORGES.any? { |name| states[name] != "live" && states[name] != "off" }) ? " (Coming soon!)" : "",
|
|
16501
|
+
"KJ|README:FORGE_DVCS_ROWS" => forge_dvcs_rows(states, origin, repo_slug)
|
|
16502
|
+
}
|
|
16503
|
+
end
|
|
16504
|
+
|
|
16505
|
+
def legacy_forge_dvcs_tokens(repo_slug)
|
|
16506
|
+
{
|
|
16507
|
+
"KJ|README:FORGE_SOURCE_BADGES" =>
|
|
16508
|
+
"[![Source on GitLab.com][📜src-gl-img]][📜src-gl] " \
|
|
16509
|
+
"[![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] " \
|
|
16510
|
+
"[![Source on GitHub.com][📜src-gh-img]][📜src-gh]",
|
|
16511
|
+
"KJ|README:FORGE_COMING_SOON" => " (Coming soon!)",
|
|
16512
|
+
"KJ|README:FORGE_DVCS_ROWS" => [
|
|
16513
|
+
"| 🧪 [#{repo_slug} on GitLab][📜src-gl] | The Truth | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜gl-wiki] | 🐭 Tiny Matrix |",
|
|
16514
|
+
"| 🧊 [#{repo_slug} on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate]) | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix |",
|
|
16515
|
+
"| 🐙 [#{repo_slug} on GitHub][📜src-gh] | Another Mirror | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | [💚][📜gh-wiki] | 💯 Full Matrix |"
|
|
16516
|
+
].join("\n")
|
|
16517
|
+
}
|
|
16518
|
+
end
|
|
16519
|
+
|
|
16520
|
+
def forge_source_badges(states)
|
|
16521
|
+
{
|
|
16522
|
+
"gitlab" => ["[![Source on GitLab.com][📜src-gl-img]][📜src-gl]",
|
|
16523
|
+
"[](#federated-dvcs)"],
|
|
16524
|
+
"codeberg" => ["[![Source on CodeBerg.org][📜src-cb-img]][📜src-cb]",
|
|
16525
|
+
"[](#federated-dvcs)"],
|
|
16526
|
+
"github" => ["[![Source on GitHub.com][📜src-gh-img]][📜src-gh]",
|
|
16527
|
+
"[](#federated-dvcs)"]
|
|
16528
|
+
}.filter_map do |forge, (live_badge, pending_badge)|
|
|
16529
|
+
case states[forge]
|
|
16530
|
+
when "off" then nil
|
|
16531
|
+
when "live" then live_badge
|
|
16532
|
+
else pending_badge # nil (unlisted) => unverified => pending
|
|
16533
|
+
end
|
|
16534
|
+
end.join(" ")
|
|
16535
|
+
end
|
|
16536
|
+
|
|
16537
|
+
def forge_dvcs_rows(states, origin, repo_slug)
|
|
16538
|
+
{
|
|
16539
|
+
"gitlab" => forge_dvcs_row(
|
|
16540
|
+
states["gitlab"], origin == "gitlab",
|
|
16541
|
+
live: "| 🧪 [#{repo_slug} on GitLab][📜src-gl] | %<status>s | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜gl-wiki] | 🐭 Tiny Matrix |",
|
|
16542
|
+
pending: "| 🧪 #{repo_slug} on GitLab | ⏳ Mirror setup pending | — | — | — | — |",
|
|
16543
|
+
mirror_status: "A Mirror"
|
|
16544
|
+
),
|
|
16545
|
+
"codeberg" => forge_dvcs_row(
|
|
16546
|
+
states["codeberg"], origin == "codeberg",
|
|
16547
|
+
live: "| 🧊 [#{repo_slug} on CodeBerg][📜src-cb] | %<status>s | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix |",
|
|
16548
|
+
pending: "| 🧊 #{repo_slug} on CodeBerg | ⏳ Mirror setup pending | — | — | — | — |",
|
|
16549
|
+
mirror_status: "An Ethical Mirror ([Donate][🤝cb-donate])"
|
|
16550
|
+
),
|
|
16551
|
+
"github" => forge_dvcs_row(
|
|
16552
|
+
states["github"], origin == "github",
|
|
16553
|
+
live: "| 🐙 [#{repo_slug} on GitHub][📜src-gh] | %<status>s | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | [💚][📜gh-wiki] | 💯 Full Matrix |",
|
|
16554
|
+
pending: "| 🐙 #{repo_slug} on GitHub | ⏳ Mirror setup pending | — | — | — | — |",
|
|
16555
|
+
mirror_status: "Another Mirror"
|
|
16556
|
+
)
|
|
16557
|
+
}.values_at("gitlab", "codeberg", "github").compact.join("\n")
|
|
16558
|
+
end
|
|
16559
|
+
|
|
16560
|
+
def forge_dvcs_row(state, is_origin, live:, pending:, mirror_status:)
|
|
16561
|
+
case state
|
|
16562
|
+
when "off" then nil
|
|
16563
|
+
when "live" then format(live, status: is_origin ? "The Truth" : mirror_status)
|
|
16564
|
+
else pending # nil (unlisted) => unverified => pending
|
|
16565
|
+
end
|
|
16566
|
+
end
|
|
16567
|
+
|
|
16103
16568
|
def funding_platform_token_facts(config, env)
|
|
16104
16569
|
token_config = token_config_values(config)
|
|
16105
16570
|
funding_config = token_config["funding"].is_a?(Hash) ? token_config["funding"] : {}
|
|
@@ -16574,7 +17039,7 @@ module Kettle
|
|
|
16574
17039
|
def main_gemfile_kettle_family_gem(package_name)
|
|
16575
17040
|
return "" if package_name.to_s == "kettle-family"
|
|
16576
17041
|
|
|
16577
|
-
%(gem "kettle-family", "~> 1.3", ">= 1.3.
|
|
17042
|
+
%(gem "kettle-family", "~> 1.3", ">= 1.3.57"\n)
|
|
16578
17043
|
end
|
|
16579
17044
|
|
|
16580
17045
|
def main_gemfile_nomono_bootstrap(package_name)
|
|
@@ -16587,7 +17052,7 @@ module Kettle
|
|
|
16587
17052
|
end
|
|
16588
17053
|
|
|
16589
17054
|
def nomono_gemfile_declaration
|
|
16590
|
-
%(gem "nomono", "~> 1.1", ">= 1.1.
|
|
17055
|
+
%(gem "nomono", "~> 1.1", ">= 1.1.19", require: false # ruby >= 3.2.0)
|
|
16591
17056
|
end
|
|
16592
17057
|
|
|
16593
17058
|
def local_gemfile_nomono_bootstrap(_package_name)
|
|
@@ -16607,7 +17072,12 @@ module Kettle
|
|
|
16607
17072
|
nomono_activation_requirements = #{nomono_floor_requirements}
|
|
16608
17073
|
nomono_requirement = Gem::Requirement.new(nomono_activation_requirements)
|
|
16609
17074
|
nomono_already_activated = Gem.loaded_specs["nomono"]
|
|
16610
|
-
|
|
17075
|
+
nomono_eval_gemfile = Array(instance_variable_get(:@gemfiles)).first
|
|
17076
|
+
nomono_lockfile = if nomono_eval_gemfile
|
|
17077
|
+
"\#{File.expand_path(nomono_eval_gemfile.to_s)}.lock"
|
|
17078
|
+
else
|
|
17079
|
+
File.expand_path(#{lockfile_path.inspect}, __dir__)
|
|
17080
|
+
end
|
|
16611
17081
|
nomono_locked_spec = nil
|
|
16612
17082
|
if File.file?(nomono_lockfile)
|
|
16613
17083
|
require "bundler"
|
|
@@ -16625,6 +17095,11 @@ module Kettle
|
|
|
16625
17095
|
if nomono_local_loader && File.file?("\#{nomono_local_loader}.rb")
|
|
16626
17096
|
require nomono_local_loader
|
|
16627
17097
|
else
|
|
17098
|
+
nomono_specs = Gem::Specification.find_all_by_name("nomono")
|
|
17099
|
+
if nomono_specs.none? { |spec| nomono_requirement.satisfied_by?(spec.version) }
|
|
17100
|
+
nomono_fallback_paths = [ENV.fetch("GEM_HOME", nil), Gem.default_dir].compact.reject(&:empty?) - Gem.path
|
|
17101
|
+
Gem.use_paths(Gem.dir, Gem.path + nomono_fallback_paths) unless nomono_fallback_paths.empty?
|
|
17102
|
+
end
|
|
16628
17103
|
if !nomono_already_activated || !nomono_requirement.satisfied_by?(nomono_already_activated.version)
|
|
16629
17104
|
nomono_locked_installed = nomono_locked_spec &&
|
|
16630
17105
|
Gem::Specification.find_all_by_name("nomono").any? { |spec| spec.version == nomono_locked_spec.version }
|
|
@@ -19183,9 +19658,13 @@ module Kettle
|
|
|
19183
19658
|
readme = config["readme"].is_a?(Hash) ? config["readme"] : {}
|
|
19184
19659
|
conditional = readme["conditional_sections"].is_a?(Hash) ? readme["conditional_sections"] : {}
|
|
19185
19660
|
disabled_integrations = readme_disabled_integrations(readme, integration_disabled: disabled_integrations(config, license: license))
|
|
19186
|
-
integration_root = readme_integration_project_root(project_root, template_profile, repository)
|
|
19661
|
+
integration_root = readme_integration_project_root(project_root, template_profile, repository, own_ci: readme_owns_ci?(config))
|
|
19187
19662
|
missing_integrations = README_DISCOVERED_INTEGRATIONS.reject do |integration|
|
|
19188
|
-
disabled_integrations.include?(integration)
|
|
19663
|
+
next true if disabled_integrations.include?(integration)
|
|
19664
|
+
|
|
19665
|
+
# In a monorepo only the root's .github runs on the forge, so member-local config never counts.
|
|
19666
|
+
# A family that runs its services some other way declares them with `readme.integrations.<name>: true`.
|
|
19667
|
+
readme_integration_explicitly_enabled?(readme, integration) || readme_integration_configured?(integration_root, integration)
|
|
19189
19668
|
end
|
|
19190
19669
|
workflow_paths = readme_workflow_paths(integration_root)
|
|
19191
19670
|
omitted_sections = []
|
|
@@ -19201,6 +19680,7 @@ module Kettle
|
|
|
19201
19680
|
profile: "slice-740-kettle-readme-style-profile",
|
|
19202
19681
|
security_enabled: security_enabled,
|
|
19203
19682
|
floss_funding_enabled: floss_funding_enabled,
|
|
19683
|
+
own_ci_member: (readme_owns_ci?(config) && repository_monorepo_subproject?(repository)) ? File.basename(project_root.to_s) : nil,
|
|
19204
19684
|
package_family: package_family,
|
|
19205
19685
|
fossa_project: fossa_project,
|
|
19206
19686
|
omitted_sections: omitted_sections,
|
|
@@ -19233,8 +19713,17 @@ module Kettle
|
|
|
19233
19713
|
slug.empty? ? "" : "git+github.com/#{slug}"
|
|
19234
19714
|
end
|
|
19235
19715
|
|
|
19236
|
-
|
|
19716
|
+
# A monorepo member normally shows the monorepo root's CI and coverage badges. A member that runs its own
|
|
19717
|
+
# workflows (for example an independently released one) declares `repository.ci: own` and is judged by its
|
|
19718
|
+
# own `.github` instead.
|
|
19719
|
+
def readme_owns_ci?(config)
|
|
19720
|
+
repository = config.is_a?(Hash) ? config["repository"] : nil
|
|
19721
|
+
repository.is_a?(Hash) && repository["ci"].to_s.strip.downcase == "own"
|
|
19722
|
+
end
|
|
19723
|
+
|
|
19724
|
+
def readme_integration_project_root(project_root, template_profile, repository, own_ci: false)
|
|
19237
19725
|
return project_root unless repository_monorepo_subproject?(repository)
|
|
19726
|
+
return project_root if own_ci
|
|
19238
19727
|
|
|
19239
19728
|
Array(repository && repository[:local_root]).find { |path| !path.to_s.empty? } || project_root
|
|
19240
19729
|
end
|
|
@@ -19366,18 +19855,23 @@ module Kettle
|
|
|
19366
19855
|
normalized
|
|
19367
19856
|
end
|
|
19368
19857
|
|
|
19858
|
+
def readme_integration_explicitly_enabled?(readme, integration)
|
|
19859
|
+
integrations = readme["integrations"]
|
|
19860
|
+
return false unless integrations.is_a?(Hash)
|
|
19861
|
+
|
|
19862
|
+
integrations.any? { |name, value| normalize_integration_name(name) == integration && truthy_config?(value) }
|
|
19863
|
+
end
|
|
19864
|
+
|
|
19369
19865
|
def readme_integration_configured?(project_root, integration)
|
|
19370
19866
|
case integration
|
|
19371
19867
|
when "codecov"
|
|
19372
|
-
|
|
19373
|
-
File.exist?(File.join(project_root, "codecov.yml")) ||
|
|
19868
|
+
readme_integration_config_file?(project_root, integration) ||
|
|
19374
19869
|
github_workflows_include?(project_root, "codecov/codecov-action")
|
|
19375
19870
|
when "coveralls"
|
|
19376
|
-
|
|
19871
|
+
readme_integration_config_file?(project_root, integration) ||
|
|
19377
19872
|
github_workflows_include?(project_root, "coverallsapp/github-action")
|
|
19378
19873
|
when "qlty"
|
|
19379
|
-
|
|
19380
|
-
File.exist?(File.join(project_root, ".qlty.yml")) ||
|
|
19874
|
+
readme_integration_config_file?(project_root, integration) ||
|
|
19381
19875
|
github_workflows_include?(project_root, "qltysh/qlty-action")
|
|
19382
19876
|
when "codeql"
|
|
19383
19877
|
File.exist?(File.join(project_root, ".github/workflows/codeql.yml")) ||
|
|
@@ -19392,6 +19886,10 @@ module Kettle
|
|
|
19392
19886
|
end
|
|
19393
19887
|
end
|
|
19394
19888
|
|
|
19889
|
+
def readme_integration_config_file?(project_root, integration)
|
|
19890
|
+
COVERAGE_INTEGRATION_CONFIG_PATHS.fetch(integration, []).any? { |path| File.exist?(File.join(project_root, path)) }
|
|
19891
|
+
end
|
|
19892
|
+
|
|
19395
19893
|
def github_workflows_include?(project_root, needle)
|
|
19396
19894
|
Dir.glob(File.join(project_root, ".github/workflows/*.{yml,yaml}")).any? do |path|
|
|
19397
19895
|
File.read(path).include?(needle)
|
|
@@ -20824,6 +21322,26 @@ module Kettle
|
|
|
20824
21322
|
legacy_engine_settings(config).select { |_name, setting| setting.fetch(:mode) == "experimental" }.keys
|
|
20825
21323
|
end
|
|
20826
21324
|
|
|
21325
|
+
# `workflows.soft_fail` opts dependency-drift workflows into soft-fail
|
|
21326
|
+
# mode: their test step reports a neutral check run (via
|
|
21327
|
+
# Jitujoshi71/soft-fail) instead of failing the workflow, so upstream gem
|
|
21328
|
+
# breakage warns visibly without turning unrelated PRs red. Accepts a list
|
|
21329
|
+
# (or map) of workflow names; unsupported names are ignored.
|
|
21330
|
+
#
|
|
21331
|
+
# soft_fail:
|
|
21332
|
+
# - dep-heads
|
|
21333
|
+
# - unlocked_deps
|
|
21334
|
+
def soft_fail_workflow_names(config)
|
|
21335
|
+
workflows = config["workflows"]
|
|
21336
|
+
return [] unless workflows.is_a?(Hash)
|
|
21337
|
+
|
|
21338
|
+
raw = workflows["soft_fail"]
|
|
21339
|
+
names = raw.is_a?(Hash) ? raw.keys : Array(raw)
|
|
21340
|
+
names.map { |name| name.to_s.strip.delete_suffix(".yml") }
|
|
21341
|
+
.select { |name| SOFT_FAIL_WORKFLOWS.include?(name) }
|
|
21342
|
+
.uniq
|
|
21343
|
+
end
|
|
21344
|
+
|
|
20827
21345
|
# Template-run notes: workflows about to be deleted as EOL (so the change is
|
|
20828
21346
|
# never silent), and opted-in engines whose revisit_by date has passed.
|
|
20829
21347
|
def legacy_engine_warnings(config, removed_workflow_paths, today: Date.today)
|
|
@@ -21981,7 +22499,7 @@ module Kettle
|
|
|
21981
22499
|
"actions/checkout" => "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1",
|
|
21982
22500
|
"actions/cache" => "actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0",
|
|
21983
22501
|
"appraisal-rb/setup-ruby-flash" => "appraisal-rb/setup-ruby-flash@b04c0c9f2e443c909968abc828a0b53e77567cf9 # v2.15",
|
|
21984
|
-
"ruby/setup-ruby" => "ruby/setup-ruby@
|
|
22502
|
+
"ruby/setup-ruby" => "ruby/setup-ruby@13841a643d859a0b8166ebb0211afbf488121be4 # v1.346.0",
|
|
21985
22503
|
"coverallsapp/github-action" => "coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8",
|
|
21986
22504
|
"qltysh/qlty-action/coverage" => "qltysh/qlty-action/coverage@56bee2d751c94b7bd8de22f64c9b5f398048e13f # v2.8.1",
|
|
21987
22505
|
"codecov/codecov-action" => "codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1",
|
|
@@ -21996,7 +22514,8 @@ module Kettle
|
|
|
21996
22514
|
"github/codeql-action/analyze" => "github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5",
|
|
21997
22515
|
"pozil/auto-assign-issue" => "pozil/auto-assign-issue@d6e511896e5f1d2408e74db74416647d8ff80c8c # v4.1.0",
|
|
21998
22516
|
"apache/skywalking-eyes/dependency" => "apache/skywalking-eyes/dependency@a196742f472feaffafea537ce5a2a4c3c53a8de4 # v0.9.0",
|
|
21999
|
-
"sarisia/actions-status-discord" => "sarisia/actions-status-discord@74e2ad0c4e57ca8b9ba6aee75d5a7841497bbb87 # v1.16.1"
|
|
22517
|
+
"sarisia/actions-status-discord" => "sarisia/actions-status-discord@74e2ad0c4e57ca8b9ba6aee75d5a7841497bbb87 # v1.16.1",
|
|
22518
|
+
"Jitujoshi71/soft-fail" => "Jitujoshi71/soft-fail@f7da29a0a0e5919c14e47b11370849a797a327e6 # v1.1.0"
|
|
22000
22519
|
}
|
|
22001
22520
|
end
|
|
22002
22521
|
|