|
1 | 1 | .PHONY: help build build-release build-macos run test test-all install clean \ |
2 | | - release release-patch release-minor bump-formula \ |
| 2 | + release release-patch release-minor bump-formula wait-for-release-assets smoke-test \ |
3 | 3 | bench-all bench-startup bench-playback bench-pause bench-memory bench-cpu \ |
4 | 4 | bench-profile bench-watch bench-results bench-analyze bench-clean |
5 | 5 |
|
@@ -143,30 +143,80 @@ release-minor: ## Bump minor version and release |
143 | 143 | cargo set-version --bump minor |
144 | 144 | $(MAKE) release |
145 | 145 |
|
146 | | -release: ## Tag, push, create GitHub release, and update Homebrew formula |
| 146 | +release: ## Tag, push, wait for CI binaries, then update Homebrew tap |
147 | 147 | @echo "Releasing v$(VERSION)..." |
148 | 148 | git add Cargo.toml Cargo.lock |
149 | 149 | git diff --cached --quiet || git commit -m "Bump version to v$(VERSION)" |
150 | 150 | git tag v$(VERSION) |
151 | 151 | git push origin main |
152 | 152 | git push origin v$(VERSION) |
153 | | - gh release create v$(VERSION) \ |
154 | | - --repo program247365/looper \ |
155 | | - --title "v$(VERSION)" \ |
156 | | - --generate-notes |
| 153 | + @echo "Tag pushed. CI will build binaries and create the GitHub release." |
157 | 154 | $(MAKE) bump-formula |
158 | 155 |
|
159 | | -bump-formula: ## Update Homebrew tap formula to current version |
160 | | - $(eval SHA256 := $(shell curl -sL "https://github.com/program247365/looper/archive/refs/tags/v$(VERSION).tar.gz" | shasum -a 256 | awk '{print $$1}')) |
161 | | - @echo "SHA256: $(SHA256)" |
162 | | - rm -rf $(TAP_DIR) |
163 | | - git clone $(TAP_REPO) $(TAP_DIR) |
164 | | - sed -i '' \ |
165 | | - -e 's|url ".*"|url "https://github.com/program247365/looper/archive/refs/tags/v$(VERSION).tar.gz"|' \ |
166 | | - -e 's|sha256 ".*"|sha256 "$(SHA256)"|' \ |
167 | | - $(TAP_DIR)/Formula/looper.rb |
168 | | - cd $(TAP_DIR) && git add Formula/looper.rb && \ |
169 | | - git commit -m "Update looper to v$(VERSION)" && \ |
170 | | - git push origin main |
171 | | - rm -rf $(TAP_DIR) |
172 | | - @echo "Done. Install with: brew tap program247365/tap && brew install looper" |
| 156 | +wait-for-release-assets: ## Wait until both arch tarballs are attached to the GH release |
| 157 | + @echo "Waiting for v$(VERSION) release assets (arm64 + x86_64)..." |
| 158 | + @for i in $$(seq 1 90); do \ |
| 159 | + ASSETS=$$(gh release view v$(VERSION) --repo program247365/looper --json assets --jq '.assets[].name' 2>/dev/null || true); \ |
| 160 | + ARM=$$(echo "$$ASSETS" | grep -c "looper-aarch64-apple-darwin.tar.gz" || true); \ |
| 161 | + X86=$$(echo "$$ASSETS" | grep -c "looper-x86_64-apple-darwin.tar.gz" || true); \ |
| 162 | + if [ "$$ARM" = "1" ] && [ "$$X86" = "1" ]; then \ |
| 163 | + echo "Both assets present."; \ |
| 164 | + exit 0; \ |
| 165 | + fi; \ |
| 166 | + printf " (%02d/90) waiting... arm64=%s x86_64=%s\n" "$$i" "$$ARM" "$$X86"; \ |
| 167 | + sleep 10; \ |
| 168 | + done; \ |
| 169 | + echo "Timed out waiting for release assets. Check: gh run list --repo program247365/looper"; \ |
| 170 | + exit 1 |
| 171 | + |
| 172 | +bump-formula: wait-for-release-assets ## Update tap formula with prebuilt binary URLs + SHA256s |
| 173 | + @set -e; \ |
| 174 | + ARM_URL="https://github.com/program247365/looper/releases/download/v$(VERSION)/looper-aarch64-apple-darwin.tar.gz"; \ |
| 175 | + X86_URL="https://github.com/program247365/looper/releases/download/v$(VERSION)/looper-x86_64-apple-darwin.tar.gz"; \ |
| 176 | + echo "Computing SHA256s..."; \ |
| 177 | + ARM_SHA=$$(curl -fsSL "$$ARM_URL" | shasum -a 256 | awk '{print $$1}'); \ |
| 178 | + X86_SHA=$$(curl -fsSL "$$X86_URL" | shasum -a 256 | awk '{print $$1}'); \ |
| 179 | + echo " arm64: $$ARM_SHA"; \ |
| 180 | + echo " x86_64: $$X86_SHA"; \ |
| 181 | + rm -rf $(TAP_DIR); \ |
| 182 | + git clone $(TAP_REPO) $(TAP_DIR); \ |
| 183 | + bash scripts/render-formula.sh "$(VERSION)" "$$ARM_SHA" "$$X86_SHA" > $(TAP_DIR)/Formula/looper.rb; \ |
| 184 | + cd $(TAP_DIR) && git add Formula/looper.rb && \ |
| 185 | + git commit -m "Update looper to v$(VERSION)" && \ |
| 186 | + git push origin main; \ |
| 187 | + rm -rf $(TAP_DIR); \ |
| 188 | + echo "Done. Users now get a prebuilt binary on 'brew upgrade looper'." |
| 189 | + |
| 190 | +smoke-test: ## Verify the published formula installs the prebuilt binary cleanly |
| 191 | + @echo "Smoke-testing prebuilt install for v$(VERSION)..." |
| 192 | + @brew tap program247365/tap >/dev/null 2>&1 || true |
| 193 | + @echo "==> Refreshing tap..." |
| 194 | + @brew update --quiet |
| 195 | + @echo "==> Asserting formula uses prebuilt-binary install path..." |
| 196 | + @brew cat program247365/tap/looper | grep -q 'bin.install "looper"' || \ |
| 197 | + (echo "FAIL: formula is not on the prebuilt path"; exit 1) |
| 198 | + @echo "==> Asserting tap formula version matches Cargo.toml..." |
| 199 | + @TAP_VERSION=$$(brew cat program247365/tap/looper | awk -F'"' '/^ version /{print $$2; exit}'); \ |
| 200 | + if [ "$$TAP_VERSION" != "$(VERSION)" ]; then \ |
| 201 | + echo "FAIL: tap has v$$TAP_VERSION but Cargo.toml is v$(VERSION) — run 'make bump-formula' first"; \ |
| 202 | + exit 1; \ |
| 203 | + fi; \ |
| 204 | + echo " tap version: $$TAP_VERSION" |
| 205 | + @echo "==> Reinstalling..." |
| 206 | + @if brew list --versions program247365/tap/looper >/dev/null 2>&1; then \ |
| 207 | + brew reinstall program247365/tap/looper; \ |
| 208 | + else \ |
| 209 | + brew install program247365/tap/looper; \ |
| 210 | + fi |
| 211 | + @echo "==> Verifying binary..." |
| 212 | + @INSTALLED=$$(brew list --versions program247365/tap/looper | awk '{print $$2}'); \ |
| 213 | + if [ "$$INSTALLED" != "$(VERSION)" ]; then \ |
| 214 | + echo "FAIL: brew installed v$$INSTALLED but expected v$(VERSION)"; \ |
| 215 | + exit 1; \ |
| 216 | + fi; \ |
| 217 | + echo " installed: v$$INSTALLED" |
| 218 | + @LOOPER_BIN="$$(brew --prefix)/bin/looper"; \ |
| 219 | + "$$LOOPER_BIN" --help >/dev/null 2>&1 && echo " --help: OK" || \ |
| 220 | + (echo "FAIL: $$LOOPER_BIN --help failed"; exit 1) |
| 221 | + @echo "" |
| 222 | + @echo "Smoke test passed for v$(VERSION)." |
0 commit comments