Skip to content

Commit 38ce837

Browse files
authored
Merge pull request #35 from andreagrandi/install-smoke-tests
Add install smoke tests for go install, release artifacts, and Homebrew formula
2 parents fd86bed + 4c65f27 commit 38ce837

6 files changed

Lines changed: 200 additions & 1 deletion

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Install Smoke Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
go-install:
12+
name: Go install smoke test
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v6
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v6
21+
with:
22+
go-version: '1.26.1'
23+
24+
- name: Install via go install
25+
run: go install ./cmd/mb-cli
26+
27+
- name: Verify mb-cli --help
28+
run: |
29+
MBCLI_BIN="$(go env GOPATH)/bin/mb-cli"
30+
"$MBCLI_BIN" --help
31+
32+
- name: Verify mb-cli version
33+
run: |
34+
MBCLI_BIN="$(go env GOPATH)/bin/mb-cli"
35+
"$MBCLI_BIN" version
36+
37+
release-artifacts:
38+
name: Release artifacts smoke test
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v6
44+
with:
45+
fetch-depth: 0
46+
47+
- name: Set up Go
48+
uses: actions/setup-go@v6
49+
with:
50+
go-version: '1.26.1'
51+
52+
- name: Install GoReleaser
53+
uses: goreleaser/goreleaser-action@v7
54+
with:
55+
distribution: goreleaser
56+
version: '~> v2'
57+
install-only: true
58+
59+
- name: Build release artifacts
60+
run: goreleaser release --snapshot --clean
61+
62+
- name: Verify Linux amd64 release binary
63+
run: |
64+
./dist/mb-cli_linux_amd64_v1/mb-cli --help
65+
./dist/mb-cli_linux_amd64_v1/mb-cli version
66+
67+
- name: Verify release archives exist
68+
run: |
69+
test -f dist/mb-cli_Linux_x86_64.tar.gz
70+
test -f dist/mb-cli_Linux_arm64.tar.gz
71+
test -f dist/mb-cli_Darwin_x86_64.tar.gz
72+
test -f dist/mb-cli_Darwin_arm64.tar.gz
73+
test -f dist/mb-cli_Windows_x86_64.zip
74+
test -f dist/checksums.txt
75+
76+
homebrew-formula:
77+
name: Homebrew formula smoke test
78+
runs-on: macos-latest
79+
80+
steps:
81+
- name: Checkout code
82+
uses: actions/checkout@v6
83+
with:
84+
fetch-depth: 0
85+
86+
- name: Set up Go
87+
uses: actions/setup-go@v6
88+
with:
89+
go-version: '1.26.1'
90+
91+
- name: Install GoReleaser
92+
uses: goreleaser/goreleaser-action@v7
93+
with:
94+
distribution: goreleaser
95+
version: '~> v2'
96+
install-only: true
97+
98+
- name: Generate Homebrew formula
99+
run: goreleaser release --snapshot --clean
100+
101+
- name: Verify formula syntax
102+
run: ruby -c dist/homebrew/Formula/mb-cli.rb

AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ git tag v<version>
225225
git push origin v<version>
226226
```
227227

228+
8. After the release workflow finishes, verify the public install paths:
229+
230+
- Follow the manual release checks in `docs/RELEASE.md`.
231+
- Confirm `go install`, Homebrew, and binary downloads all produce a working `mb-cli --help` and `mb-cli version`.
232+
228233
Notes:
229234

230235
- The tag push triggers `.github/workflows/release.yml`.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [Unreleased]
44

5+
- Add install smoke tests for `go install`, release artifacts, and the generated Homebrew formula, plus release verification docs in `docs/RELEASE.md` (#19)
6+
57
## [0.3.0] - 2026-05-22
68

79
- Add `docs/RECIPES.md` with worked end-to-end recipes for schema discovery, saved-question inspection, dashboard analysis, parameterized card/dashboard runs, and PII-safe querying, linked from the README (#16)

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build test test-verbose fmt vet lint clean deps build-all help
1+
.PHONY: build test test-verbose fmt vet lint clean deps build-all install-smoke-tests help
22

33
BINARY_NAME := mb-cli
44
BUILD_DIR := bin
@@ -44,6 +44,9 @@ build-all:
4444
@GOOS=darwin GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 $(MAIN_PKG)
4545
@GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe $(MAIN_PKG)
4646

47+
install-smoke-tests:
48+
@scripts/install-smoke-tests.sh
49+
4750
help:
4851
@echo "Available targets:"
4952
@echo " build - Build the binary to bin/"
@@ -55,4 +58,5 @@ help:
5558
@echo " clean - Remove build artifacts"
5659
@echo " deps - Download and tidy dependencies"
5760
@echo " build-all - Cross-platform builds"
61+
@echo " install-smoke-tests - Run install path smoke tests"
5862
@echo " help - Show this help"

docs/RELEASE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Release Verification
2+
3+
This document describes how to verify that the public install paths for `mb-cli` produce a working binary.
4+
5+
## Automated smoke tests
6+
7+
The [Install Smoke Tests](../.github/workflows/install-smoke-tests.yml) workflow runs on every push and pull request:
8+
9+
- `go install` from the local source tree builds an `mb-cli` binary and runs `mb-cli --help` and `mb-cli version`.
10+
- GoReleaser builds release artifacts in snapshot mode, the Linux amd64 binary is executed, and the expected archives and checksum file are checked.
11+
- The generated Homebrew formula is syntax-checked with `ruby -c`.
12+
13+
These tests do not require Metabase credentials.
14+
15+
## Manual release checks
16+
17+
After a release is published, verify the public install paths:
18+
19+
### Go install
20+
21+
```bash
22+
go install github.com/andreagrandi/mb-cli/cmd/mb-cli@latest
23+
$(go env GOPATH)/bin/mb-cli --help
24+
$(go env GOPATH)/bin/mb-cli version
25+
```
26+
27+
### Homebrew
28+
29+
```bash
30+
brew update
31+
brew install andreagrandi/tap/mb-cli
32+
mb-cli --help
33+
mb-cli version
34+
```
35+
36+
### Binary download
37+
38+
1. Download the archive for your platform from the [releases page](https://github.com/andreagrandi/mb-cli/releases).
39+
2. Extract the `mb-cli` binary.
40+
3. Run `./mb-cli --help` and `./mb-cli version`.
41+
42+
### Expected output
43+
44+
Both `mb-cli --help` and `mb-cli version` must exit with status `0` and print the help text and version respectively.

scripts/install-smoke-tests.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "$REPO_ROOT"
6+
7+
GO_BIN="${GO_BIN:-go}"
8+
GORELEASER_BIN="${GORELEASER_BIN:-goreleaser}"
9+
10+
fail() {
11+
echo "FAIL: $*" >&2
12+
exit 1
13+
}
14+
15+
echo "==> Smoke testing go install from local source..."
16+
"$GO_BIN" install ./cmd/mb-cli
17+
MBCLI_BIN=$("$GO_BIN" env GOPATH)/bin/mb-cli
18+
test -x "$MBCLI_BIN" || fail "mb-cli binary not found at $MBCLI_BIN"
19+
"$MBCLI_BIN" --help >/dev/null || fail "mb-cli --help failed"
20+
"$MBCLI_BIN" version >/dev/null || fail "mb-cli version failed"
21+
echo " go install smoke test passed"
22+
23+
if command -v "$GORELEASER_BIN" >/dev/null 2>&1; then
24+
echo "==> Smoke testing release artifacts with GoReleaser snapshot..."
25+
"$GORELEASER_BIN" release --snapshot --clean
26+
27+
GOOS=$("$GO_BIN" env GOOS)
28+
GOARCH=$("$GO_BIN" env GOARCH)
29+
mapfile -d '' -t candidates < <(find dist -type f \( -name 'mb-cli' -o -name 'mb-cli.exe' \) -path "*mb-cli_${GOOS}_${GOARCH}_*" -print0)
30+
test ${#candidates[@]} -gt 0 || fail "no release binary found for $GOOS/$GOARCH"
31+
BINARY=${candidates[0]}
32+
test -x "$BINARY" || fail "release binary is not executable: $BINARY"
33+
"$BINARY" --help >/dev/null || fail "release binary --help failed"
34+
"$BINARY" version >/dev/null || fail "release binary version failed"
35+
36+
test -f dist/checksums.txt || fail "checksums.txt not found"
37+
echo " release artifacts smoke test passed"
38+
else
39+
echo " skipping GoReleaser smoke test (goreleaser not installed)"
40+
fi
41+
42+
echo "==> All install smoke tests passed"

0 commit comments

Comments
 (0)