ci: drop redundant main-push build; add concurrency cancel - #22
Merged
Conversation
The build workflow used to run on push-to-main, but every artifact upload and release step is gated on a tag ref. So the main-push build just re-ran vet/build/test on the same code the PR had already verified, producing nothing. For a single-developer project where everything lands via PR, the second run is pure waste — usually 10+ minutes of CI per merge. Triggers now: pull_request → branches: [main] (pre-merge gate, same as before) push → tags: ['v*'] (release build + artifact upload) workflow_dispatch (manual) Also adds a concurrency group keyed on github.ref. When a PR is updated multiple times in quick succession, in-flight runs for the older HEAD are cancelled. Tag pushes get their own group key (refs/tags/vX.Y.Z), so a release in flight is never aborted by a concurrent PR update. No change to artifact behavior: releases still come from `git tag vX.Y` + `git push --tags`. Direct pushes to main (rare; we go via PR) will no longer run CI — acceptable trade-off for the time saved.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build.ymlwas triggering onpush: branches: [main], but every artifact upload and thereleasejob are gated onif: startsWith(github.ref, 'refs/tags/v'). So each squash-merge intomainkicked off a full matrix build (linux × 2 arch + darwin × 2 arch + windows) that ran vet/test/build and then skipped every output step — pure waste, typically 10+ minutes of CI per merge for an OSS project where every change lands via PR (which had already verified the same code).Changes
push: branches:[main]— PR already gates merges to main. Direct pushes to main are rare and (per project convention) avoided.push: tags:['v*']— release flow is unchanged:git tag vX.Y.Z && git push --tagsstill triggers the full matrix build + artifact upload + GitHub Release.pull_requestandworkflow_dispatch— pre-merge gate and manual re-run.concurrencykeyed ongithub.ref. When a PR is updated multiple times in quick succession, the older run is cancelled. Tag pushes use a distinct ref (refs/tags/vX.Y.Z) so a release build is never aborted by an unrelated PR update.What still works
What changes
main(bypassing PR) will no longer run CI. We don't do this, so accepting the trade-off.Test Plan
maincommitgit tag vX.Y.Z && git push --tags, the release flow still produces full artifacts