Skip to content

ci: add a dry-run workflow to test rust releases#5292

Merged
clason merged 2 commits intotree-sitter:masterfrom
WillLillis:release_check_xtask
Feb 21, 2026
Merged

ci: add a dry-run workflow to test rust releases#5292
clason merged 2 commits intotree-sitter:masterfrom
WillLillis:release_check_xtask

Conversation

@WillLillis
Copy link
Member

This is intended to be a manual safety check run locally before opening a PR to bump version numbers for a release.

Ideally this would check for changes to a crate if a version is already published so we could run this as part of the release ci job, but given that:

  • Releases can (and have been) created directly via crates.io without a corresponding tag in the repo
  • Tags don't line up with release versions for every crate (tree-sitter-language specifically, which has to stay at 0.1.x)
  • This would require getting information via the github API, which would mean a lot of slow, awkward testing in CI runners
  • This level of automation will almost surely come with edge cases and leave us back where we started

I've opted to keep the check a manual one and leave the decision to bump or not to the maintainer making the release.

Also includes a few related docs improvements.

@clason
Copy link
Contributor

clason commented Feb 2, 2026

Running this as part of the release workflow would be the real value here, so I think it would make sense to invest more time into seeing if we can extract the part of the publish action that does this check.

Actually, the release workflow is already too late -- this needs to be a regular workflow that is run on the "bump" commit (or any commit that updates the language crate).

@clason
Copy link
Contributor

clason commented Feb 2, 2026

See also katyo/publish-crates#663

@WillLillis
Copy link
Member Author

Actually, the release workflow is already too late -- this needs to be a regular workflow that is run on the "bump" commit (or any commit that updates the language crate).

Couldn't we run it as part of the release workflow before the steps creating the releases (e.g. alongside the tests)? I'm not sure how we'd set up triggers for the workflow to only run on "bump" commits, and if we run it on every PR then it may get ignored.

@clason
Copy link
Contributor

clason commented Feb 3, 2026

If it's part of the release workflow, it runs after we bumped and tagged -- so if we do need to bump the language crate, we can only do it after the bump, so we'd have to fix, bump, and tag again, same as now.

As to how: we can gate this either behind the commit message (regex) or a label we apply to release commits.

@WillLillis
Copy link
Member Author

Running this as part of the release workflow would be the real value here, so I think it would make sense to invest more time into seeing if we can extract the part of the publish action that does this check.

After spending a few too many hours on the xtask implementation, I think I agree with this approach. We may even be able to run the workflow with dry-run=true and not have to extract anything (needs to be tested).

Solely so I can document this somewhere the xtask approach consisted mainly of the following:

  • Grab crate versions from the local checkout
  • See if those versions exist on crates.io
  • If they do, get their sha256 checksum
  • Create package of corresponding crate locally
  • Compare checksums (a small amount of shenanigans are required to get the repo's current commit sha out of .cargo_vcs_info.json)

The issue is that the cargo package command has a bug in its tar dependency, which seems to sometimes append 4 \0 bytes to the end of the .crate file, sometimes not. This changes the checksum, and everything kind of falls apart. I also tried another approach where we pulled down the published .crate file, extracted it, and then manually hashed that against a locally created .crate file, but the same tar issue shows up and needs workarounds, and there's still the issue with .cargo_vcs_info.json. Too much complexity and way too many places where this could break.

@WillLillis WillLillis marked this pull request as draft February 4, 2026 09:24
@WillLillis WillLillis marked this pull request as ready for review February 5, 2026 07:34
@WillLillis
Copy link
Member Author

I've added a new workflow, which is just the normal rust publishing job katyo/publish-crates@v2 with dry-run set to true. (TBD if we need to supply our token to use github's API to check for changes to crates). This should be tested on this PR, on its own backport PR (once this is merged), and again on a separate backport PR to the release branch (#5295 should be backported, but I'm waiting to so we can test both cases). I also need to add the option to trigger this workflow manually, but that is going to be a tomorrow problem.

@WillLillis WillLillis changed the title feat(xtask): create an xtask to check for existing crate versions already published to crates.io ci: add a dry-run workflow to test rust releases Feb 6, 2026
@WillLillis WillLillis added ci:check release Conduct a dry run of the rust release workflow. and removed ci:check release Conduct a dry run of the rust release workflow. labels Feb 10, 2026
@clason
Copy link
Contributor

clason commented Feb 15, 2026

I pushed a commit with a proposed release workflow listing individual steps. (It's a bit of a pity that we don't have any changelog or similar that could be edited for the minor release PR; we might want to put a nonce somewhere, e.g. in the README, for that purpose.)

@clason clason force-pushed the release_check_xtask branch 2 times, most recently from 412410c to b85172d Compare February 21, 2026 10:33
@WillLillis
Copy link
Member Author

Going to merge this now as-is. This is an opt-in change and the docs are also a nice win to get in. If there's any followup issues we run into, further testing can be done on my fork before fixing in one PR.

@clason clason enabled auto-merge (rebase) February 21, 2026 14:56
@clason clason merged commit d0714e0 into tree-sitter:master Feb 21, 2026
14 checks passed
@tree-sitter-ci-bot
Copy link

Backport failed for release-0.26, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-0.26
git worktree add -d .worktree/backport-5292-to-release-0.26 origin/release-0.26
cd .worktree/backport-5292-to-release-0.26
git switch --create backport-5292-to-release-0.26
git cherry-pick -x cf98b9b61e25eae57fc9a50f1a320620d43d319d d0714e0828e3c8a538e474707fb4cb31f3ef0c95

@WillLillis WillLillis deleted the release_check_xtask branch February 21, 2026 15:11
Robin-Grimm

This comment was marked as spam.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants