Skip to content

Commit 03fb66c

Browse files
authored
Smoke-test that pinned tools resolve to runnable binaries (#7)
proto reports a wrong exe-path as a successful install and only fails when the dangling binary is actually used, so the install matrix went green even though the shellcheck plugin produced a broken symlink. I added scripts/smoke-test.sh, which asserts that every tool in .prototools resolves via proto bin and runs; the existing per-platform install job now executes it. The tool list is read from the [plugins] table with the pinned taplo, so new plugins are covered without editing the script. --------- Signed-off-by: Jean-Baptiste Louazel <jb.louazel@genesis-ai.company>
1 parent 861dd1c commit 03fb66c

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ jobs:
5050
with:
5151
auto-install: true
5252
cache: false
53+
54+
- name: Smoke-test binaries
55+
shell: bash
56+
run: ./scripts/smoke-test.sh

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ Each tool lives in its own directory containing a `plugin.toml` (the plugin) and
99
version per tool and registers each plugin under `[plugins]` with a `file://` locator.
1010

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

1516
## Adding a plugin
1617

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

7476
## Notes

scripts/smoke-test.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
# Assert every tool pinned in .prototools resolves to a real, runnable binary.
3+
# proto install only downloads and unpacks; it does not follow exe-path, so a
4+
# wrong exe-path produces a dangling symlink that install reports as success.
5+
# `proto bin` resolves exe-path and exits non-zero when the target is missing;
6+
# `proto run -- --version` then proves the binary actually executes.
7+
#
8+
# The tool list comes from the [plugins] table in .prototools (the repo's
9+
# single source of truth), read with the pinned taplo so adding a plugin needs
10+
# no edit here.
11+
set -euo pipefail
12+
13+
cd "$(dirname "$0")/.."
14+
15+
# jq output is CRLF-terminated when taplo runs under Git Bash on Windows; tr
16+
# strips the carriage returns so tool names don't carry a trailing \r.
17+
tools="$(proto run taplo -- get -f .prototools -o json 'plugins' | jq -r 'keys[]' | tr -d '\r')"
18+
19+
if [ -z "$tools" ]; then
20+
echo "no tools found in [plugins] table of .prototools" >&2
21+
exit 1
22+
fi
23+
24+
failed=0
25+
for tool in $tools; do
26+
if ! proto bin "$tool" >/dev/null 2>&1; then
27+
echo "FAIL $tool: proto could not resolve an executable (check exe-path)"
28+
failed=1
29+
elif ! proto run "$tool" -- --version >/dev/null 2>&1; then
30+
echo "FAIL $tool: resolved but did not run (--version exited non-zero)"
31+
failed=1
32+
else
33+
echo "ok $tool"
34+
fi
35+
done
36+
37+
exit "$failed"

0 commit comments

Comments
 (0)