Skip to content

Replace bump-version.sh with pure-Go go:generate tool#3272

Draft
masih wants to merge 3 commits intomainfrom
masih/bump-version-with-less-thorns-and-more-gravy
Draft

Replace bump-version.sh with pure-Go go:generate tool#3272
masih wants to merge 3 commits intomainfrom
masih/bump-version-with-less-thorns-and-more-gravy

Conversation

@masih
Copy link
Copy Markdown
Collaborator

@masih masih commented Apr 20, 2026

Introduce scripts/bump_version, a combined archival + code-generation tool that replaces the three shell scripts (bump-version.sh, generate-precompile-setup.sh, generate-all-precompiles-setup.sh).

New developer workflow:

  1. Commit precompile code changes
  2. Append a new upgrade name (vMajor.Minor) to app/tags
  3. Run go generate ./...

What the tool does on each run:

  • Validates the latest entry in app/tags (must be vMajor.Minor; patch is dropped with a warning; duplicate or regressed versions are errors)
  • Validates each module's versions file (valid semver, no duplicates)
  • Uses go-git (pure Go, no os/exec) to find the commit that introduced the previous upgrade version, then diffs per-module tree hashes against HEAD to determine which precompile modules actually changed
  • Archives changed modules into precompiles//legacy// with package/import rewrites; archives common/ when it changed (triggers all)
  • Fails hard on git errors (matching old bump-version.sh set -e behavior) rather than silently falling back to archiving everything
  • Regenerates precompiles//setup.go from a text/template (.go.tmpl) for every module with a versions file, formatted via go/format
  • Is idempotent: skips archival if precompiles/common/legacy// exists

Naming conventions enforced:
app/tags / versions keys: vMajor.Minor (e.g. v7.0) legacy folder / package: vMajorMinor0 (e.g. v700)

All generated .go files carry a "Code generated by scripts/bump_version; DO NOT EDIT." header. Added go-git/v5 as the sole new dependency.

Introduce scripts/bump_version, a combined archival + code-generation tool
that replaces the three shell scripts (bump-version.sh,
generate-precompile-setup.sh, generate-all-precompiles-setup.sh).

New developer workflow:
  1. Commit precompile code changes
  2. Append a new upgrade name (vMajor.Minor) to app/tags
  3. Run go generate ./...

What the tool does on each run:
- Validates the latest entry in app/tags (must be vMajor.Minor; patch is
  dropped with a warning; duplicate or regressed versions are errors)
- Validates each module's versions file (valid semver, no duplicates)
- Uses go-git (pure Go, no os/exec) to find the commit that introduced the
  previous upgrade version, then diffs per-module tree hashes against HEAD to
  determine which precompile modules actually changed
- Archives changed modules into precompiles/<module>/legacy/<folder>/ with
  package/import rewrites; archives common/ when it changed (triggers all)
- Fails hard on git errors (matching old bump-version.sh set -e behavior)
  rather than silently falling back to archiving everything
- Regenerates precompiles/<module>/setup.go from a text/template (.go.tmpl)
  for every module with a versions file, formatted via go/format
- Is idempotent: skips archival if precompiles/common/legacy/<folder>/ exists

Naming conventions enforced:
  app/tags / versions keys: vMajor.Minor  (e.g. v7.0)
  legacy folder / package:  vMajorMinor0  (e.g. v700)

All generated .go files carry a "Code generated by scripts/bump_version;
DO NOT EDIT." header. Added go-git/v5 as the sole new dependency.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 20, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedApr 20, 2026, 9:48 PM

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 0% with 327 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.19%. Comparing base (9225538) to head (ad42d44).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
scripts/bump_version/main.go 0.00% 327 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3272      +/-   ##
==========================================
- Coverage   59.30%   59.19%   -0.12%     
==========================================
  Files        2071     2072       +1     
  Lines      169814   170141     +327     
==========================================
  Hits       100707   100707              
- Misses      60333    60660     +327     
  Partials     8774     8774              
Flag Coverage Δ
sei-chain-pr 62.73% <0.00%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
precompiles/addr/setup.go 90.00% <ø> (ø)
precompiles/bank/setup.go 90.00% <ø> (ø)
precompiles/distribution/setup.go 88.23% <ø> (ø)
precompiles/gov/setup.go 88.23% <ø> (ø)
precompiles/ibc/setup.go 89.47% <ø> (ø)
precompiles/json/setup.go 88.23% <ø> (ø)
precompiles/oracle/setup.go 89.47% <ø> (ø)
precompiles/p256/setup.go 81.81% <ø> (ø)
precompiles/pointer/setup.go 89.47% <ø> (ø)
precompiles/pointerview/setup.go 87.50% <ø> (ø)
... and 4 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant