Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ jobs:
with:
auto-install: true
cache: false

- name: Smoke-test binaries
shell: bash
run: ./scripts/smoke-test.sh
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Each tool lives in its own directory containing a `plugin.toml` (the plugin) and
version per tool and registers each plugin under `[plugins]` with a `file://` locator.

CI installs every pinned tool through its local plugin across Linux, macOS (x64 and
arm64), and Windows. A plugin that resolves and downloads on every platform is a green
build; that install is the test, so there is no separate plugin test suite.
arm64), and Windows, then runs `scripts/smoke-test.sh` to confirm each resolves to a
runnable binary. Install alone is not enough: proto reports a wrong `exe-path` as a
successful install and only fails when the dangling binary is used.

## Adding a plugin

Expand Down Expand Up @@ -69,6 +70,7 @@ from `.prototools`, not a hook-managed copy.
```sh
proto run prek -- install # optional: enable git hooks
proto run prek -- run --all-files # file hygiene, typos, taplo format + lint
./scripts/smoke-test.sh # every pinned tool resolves to a runnable binary
```

## Notes
Expand Down
35 changes: 35 additions & 0 deletions scripts/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Assert every tool pinned in .prototools resolves to a real, runnable binary.
# proto install only downloads and unpacks; it does not follow exe-path, so a
# wrong exe-path produces a dangling symlink that install reports as success.
# `proto bin` resolves exe-path and exits non-zero when the target is missing;
# `proto run -- --version` then proves the binary actually executes.
#
# The tool list comes from the [plugins] table in .prototools (the repo's
# single source of truth), read with the pinned taplo so adding a plugin needs
# no edit here.
set -euo pipefail

cd "$(dirname "$0")/.."

tools="$(proto run taplo -- get -f .prototools -o json 'plugins' | jq -r 'keys[]')"

if [ -z "$tools" ]; then
echo "no tools found in [plugins] table of .prototools" >&2
exit 1
fi

failed=0
for tool in $tools; do
if ! proto bin "$tool" >/dev/null 2>&1; then
echo "FAIL $tool: proto could not resolve an executable (check exe-path)"
failed=1
elif ! proto run "$tool" -- --version >/dev/null 2>&1; then
echo "FAIL $tool: resolved but did not run (--version exited non-zero)"
failed=1
else
echo "ok $tool"
fi
done

exit "$failed"
Loading