also looking at this
fix(dev): validate the pinned Zig toolchain before builds
#299
5 files
+137
-14
| @@ -6,9 +6,17 @@ Thank you for your interest in contributing to Craft! This document provides gui | ||
| 6 | 6 | |
| 7 | 7 | ### Prerequisites |
| 8 | 8 | |
| 9 | - **Pantry-managed stable Zig**: run `eval "$(pantry env | sed -n '/^export /,$p')"`, then invoke `zig` (locally only — CI does not: the pantry action already puts `zig` on PATH, and `pantry env` runs a workspace setup that re-installs JS deps with its own `--linker`, rewriting `node_modules` mid-job) | |
| 9 | - **Pinned Zig toolchain**: use the exact snapshot in `pantry.lock`. Root `bun run build:core`, `test`, `fmt`, `run`, and `zig` scripts validate the selected compiler and print its path/version before use. Activate your Pantry environment locally, or set `CRAFT_ZIG=/absolute/path/to/zig` to a matching compiler. The scripts do not invoke `pantry env` automatically because it can reinstall workspace dependencies. CI receives the pinned toolchain from the Pantry action. | |
| 10 | 10 | - **Bun**: Install from [bun.sh](https://bun.sh) |
| 11 | 11 | |
| 12 | To intentionally test another Zig snapshot, use both an explicit compiler and the opt-in: | |
| 13 | ||
| 14 | ```bash | |
| 15 | CRAFT_ZIG=/absolute/path/to/experimental/zig CRAFT_ALLOW_UNPINNED_ZIG=1 bun run build:core | |
| 16 | ``` | |
| 17 | ||
| 18 | This override is for compatibility testing; it does not change the checked-in lockfile. | |
| 19 | ||
| 12 | 20 | #### Platform-specific Dependencies |
| 13 | 21 | |
| 14 | 22 | **macOS:** |
| @@ -41,19 +49,19 @@ cd craft | ||
| 41 | 49 | |
| 42 | 50 | ```bash |
| 43 | 51 | # Debug build |
| 44 | zig build | |
| 52 | bun run build:debug | |
| 45 | 53 | |
| 46 | 54 | # Release build |
| 47 | zig build -Doptimize=ReleaseSafe | |
| 55 | bun run build:core | |
| 48 | 56 | |
| 49 | 57 | # Run tests |
| 50 | zig build test | |
| 58 | bun run test | |
| 51 | 59 | |
| 52 | 60 | # Run example |
| 53 | zig build run | |
| 61 | bun run run:demo | |
| 54 | 62 | |
| 55 | 63 | # Run the craft CLI |
| 56 | zig build run | |
| 64 | bun run run | |
| 57 | 65 | ``` |
| 58 | 66 | |
| 59 | 67 | ## Project Structure |