Skip to content

Commit a9a1cae

Browse files
authored
chore(ci): standardize mise setup (#3553)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added a local reusable CI step to install pinned developer tools and replaced scattered installs across workflows. * Added an option to restrict which tools are installed per run and conditional use of prebuilt cargo binaries for cargo-prefixed tools. * Standardized cache scoping to improve cross-run cache reuse and speed up CI; updated workflows to use the new step (including wasm-pack). * **Documentation** * Clarified Python host selection rationale in the build workflow (abi3/host interpreter choices). <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/BoundaryML/baml/pull/3553?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent a752b02 commit a9a1cae

10 files changed

Lines changed: 126 additions & 60 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Setup mise"
2+
description: |
3+
Install mise and every tool pinned in mise.toml, sharing a single cache
4+
scope across every baml_language workflow.
5+
6+
Centralizing the action version + cache settings here means future bumps
7+
(e.g. when jdx/mise-action ships a new major, or when we want to bust
8+
the cache prefix) only need to touch this one file.
9+
10+
Cache key composition (per the jdx/mise-action README): the default
11+
cache key already includes a platform identifier such as
12+
`linux-x64-ubuntu24` or `macos-arm64-macos15`, so cross-platform
13+
isolation is automatic. Sharing `cache_key_prefix` (`mise-baml1` —
14+
our own, not the upstream default) + the hash of mise.toml is what
15+
makes the cache scope shared across workflows that run on the same
16+
platform.
17+
18+
inputs:
19+
install_args:
20+
description: |
21+
Space-separated list of tool names passed through to `mise install`,
22+
restricting installation to just those tools (e.g. "cargo:wasm-pack"
23+
for a wasm-pack-only job). If empty, every tool in mise.toml is
24+
installed.
25+
26+
Callers should pass the narrowest set their job actually uses —
27+
mise.toml has a lot of `cargo:*` entries (cargo-watch, ripgrep,
28+
just, bacon, cross, prek, wasm-pack) and even with binstall some
29+
of them fall back to source compiles or hit crates.io rate limits.
30+
Skipping them when they aren't needed is the cheapest win.
31+
required: false
32+
default: ""
33+
34+
runs:
35+
using: "composite"
36+
steps:
37+
# cargo-binstall must be on PATH *before* `mise install` resolves
38+
# the `cargo:*` entries in mise.toml — otherwise mise's cargo
39+
# backend silently falls back to `cargo install` (compile from
40+
# source). With `cargo_binstall = true` set in mise.toml's [settings]
41+
# and cargo-binstall on PATH here, every `cargo:bacon`, `cargo:cross`,
42+
# `cargo:wasm-pack`, `cargo:prek`, ... in mise.toml installs from a
43+
# prebuilt binary in seconds instead of minutes.
44+
#
45+
# Skipped when the job's install_args has no `cargo:*` entries
46+
# (and isn't the all-tools default) — there's nothing for binstall
47+
# to do then, and even the ~5s download adds up across the workflow.
48+
- name: Install cargo-binstall
49+
if: ${{ inputs.install_args == '' || contains(inputs.install_args, 'cargo:') }}
50+
uses: cargo-bins/cargo-binstall@main
51+
52+
- name: Install mise
53+
uses: jdx/mise-action@v4.0.1
54+
with:
55+
# Our own prefix (not the upstream default), shared across every
56+
# baml_language workflow. Bump the trailing number to invalidate
57+
# every consumer's cache at once.
58+
cache_key_prefix: mise-baml1
59+
install_args: ${{ inputs.install_args }}

.github/actions/setup-node2/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ inputs:
1717
pnpm-version:
1818
description: 'pnpm version to install'
1919
required: false
20-
default: '9.12.0'
20+
# Keep in sync with typescript2/package.json `packageManager` and the
21+
# root mise.toml `npm:pnpm` entry.
22+
default: '11.1.3'
2123

2224
runs:
2325
using: 'composite'
@@ -26,6 +28,10 @@ runs:
2628
uses: pnpm/action-setup@v4
2729
with:
2830
version: ${{ inputs.pnpm-version }}
31+
# Point at typescript2/package.json explicitly — otherwise the action
32+
# reads the root package.json (which pins a different pnpm version for
33+
# the legacy workspace) and aborts on the mismatch.
34+
package_json_file: ${{ inputs.working-directory }}/package.json
2935
run_install: false
3036

3137
- name: Setup Node.js

.github/workflows/build-python-sdk.reusable.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ jobs:
6969
7070
- uses: actions/checkout@v6
7171

72+
# NOTE: we deliberately do NOT use ./.github/actions/setup-mise here.
73+
# The host Python version pins the abi3 floor of the resulting wheel,
74+
# so we want a specific Python (3.10, matching the abi3-py310 target)
75+
# rather than whatever mise.toml's `python` is pinned to today.
7276
- name: Setup Python
7377
uses: actions/setup-python@v6
7478
with:

.github/workflows/cargo-tests.reusable.yaml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -296,18 +296,18 @@ jobs:
296296
save-if: false
297297
shared-key: ${{ matrix.rust-cache-key }}
298298

299-
- name: "Setup Python 3.10+"
300-
uses: actions/setup-python@v6
301-
with:
302-
python-version: "3.10"
303-
304299
- name: "Install cargo nextest"
305300
uses: taiki-e/install-action@v2
306301
with:
307302
tool: cargo-nextest
308303

309-
- name: "Install uv"
310-
uses: astral-sh/setup-uv@v8.1.0
304+
# sdk_test_* crates shell out to `uv sync` against the generated
305+
# Python project under target/uv-cache. python + uv are the only
306+
# mise tools the matrix needs.
307+
- name: "Install mise"
308+
uses: ./.github/actions/setup-mise
309+
with:
310+
install_args: "python uv"
311311

312312
- name: "Build tests with --timings"
313313
run: cargo test --no-run --all-features --timings
@@ -495,12 +495,6 @@ jobs:
495495
name: "snapshot tests"
496496
runs-on: blacksmith-4vcpu-ubuntu-2404
497497
timeout-minutes: 30
498-
env:
499-
# Disable Python + pipx tools: mise 2025.12.12 downloads a broken
500-
# freethreaded Python build that's missing a lib/ directory.
501-
# Rig test scripts use system Python via uv (the standalone uv binary
502-
# mise installs handles its own Python via `uv run`).
503-
MISE_DISABLE_TOOLS: python,pipx:uv,pipx:ruff,pipx:maturin
504498
steps:
505499
- uses: actions/checkout@v6
506500
with:
@@ -525,12 +519,13 @@ jobs:
525519
with:
526520
tool: cargo-insta,cargo-nextest
527521

522+
# rig test scripts shell out to `uv run` (and bring their own
523+
# Python via uv), so the only mise tools snapshot-tests needs are
524+
# python + uv.
528525
- name: "Install mise"
529-
uses: jdx/mise-action@v2
530-
# Pinning to old version because newer versions time out on the npm backend,
531-
# see https://github.com/jdx/mise/discussions/7630
526+
uses: ./.github/actions/setup-mise
532527
with:
533-
version: 2025.12.12
528+
install_args: "python uv"
534529

535530
- name: "Build tests with --timings"
536531
run: cargo test --no-run -p baml_tests -p baml_cli -p baml_lsp2_actions --all-features --timings

.github/workflows/ci.yaml

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,6 @@ jobs:
244244
needs: determine_changes
245245
if: needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/canary'
246246
timeout-minutes: 20
247-
env:
248-
# Disable Python + pipx tools: mise 2025.12.12 downloads a broken
249-
# freethreaded Python build that's missing a lib/ directory.
250-
# Prek hooks only need Rust + cargo tools; Python scripts use system Python + uv.
251-
MISE_DISABLE_TOOLS: python,pipx:uv,pipx:ruff,pipx:maturin
252247
steps:
253248
- name: "Checkout Branch"
254249
uses: actions/checkout@v6
@@ -267,22 +262,15 @@ jobs:
267262
save-if: false
268263
shared-key: "linux-cargo"
269264

270-
- name: "Install cargo-binstall"
271-
run: |
272-
curl -L --proto '=https' --tlsv1.2 -sSf \
273-
https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh \
274-
| bash
275-
working-directory: baml_language
276-
277-
- name: "Install uv"
278-
uses: astral-sh/setup-uv@v8.1.0
279-
265+
# prek hooks invoke cargo (from rustup), mise tasks that shell out
266+
# to cargo, and python scripts that begin with `#!/usr/bin/env -S
267+
# uv run --script` (e.g. bep:readme, validate-markdown). We don't
268+
# need go/ruby/node/etc here, just the prek binary itself + a
269+
# python/uv pair for the hook scripts.
280270
- name: "Install mise"
281-
uses: jdx/mise-action@v2
282-
# Pinning to old version because newer versions time out on the npm backend,
283-
# see https://github.com/jdx/mise/discussions/7630
271+
uses: ./.github/actions/setup-mise
284272
with:
285-
version: 2025.12.12
273+
install_args: "cargo:prek python uv"
286274

287275
- name: "Cache prek"
288276
uses: actions/cache@v5
@@ -405,10 +393,6 @@ jobs:
405393
needs: determine_changes
406394
if: needs.determine_changes.outputs.proto == 'true'
407395
timeout-minutes: 20
408-
env:
409-
# See the matching comment on `prek` — mise 2025.12.12 ships a broken
410-
# freethreaded Python build; this job doesn't need Python or pipx tools.
411-
MISE_DISABLE_TOOLS: python,pipx:uv,pipx:ruff,pipx:maturin
412396
steps:
413397
- name: "Checkout"
414398
uses: actions/checkout@v6
@@ -427,13 +411,14 @@ jobs:
427411
save-if: false
428412
shared-key: "linux-cargo"
429413

430-
# mise provides go, node, pnpm, protoc, and protoc-gen-go per mise.toml.
414+
# bridge_ctypes/build.rs needs `protoc`; bridge_go/build.sh needs
415+
# `protoc` + `protoc-gen-go`; bridge_nodejs needs node + pnpm.
416+
# The `cargo build -p bridge_ctypes` step uses cargo from rustup
417+
# (not mise), so we don't need `go` itself here either.
431418
- name: "Install mise"
432-
uses: jdx/mise-action@v2
433-
# Pinning to old version because newer versions time out on the npm backend,
434-
# see https://github.com/jdx/mise/discussions/7630
419+
uses: ./.github/actions/setup-mise
435420
with:
436-
version: 2025.12.12
421+
install_args: "node npm:pnpm protoc protoc-gen-go"
437422

438423
# Rust (prost) + Python (protoc) — both driven by bridge_ctypes/build.rs.
439424
# Writes Python pb2/pyi into baml_language/sdks/python/src/baml_core/cffi/v1/.

.github/workflows/wasm-pack-tests.reusable.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ jobs:
4343
# Share cache across similar Linux WASM jobs for better hit rates
4444
shared-key: "linux-wasm"
4545

46-
- name: "Install wasm-pack"
47-
uses: taiki-e/install-action@v2
46+
# Only wasm-pack is needed here.
47+
- name: "Install mise"
48+
uses: ./.github/actions/setup-mise
4849
with:
49-
tool: wasm-pack
50+
install_args: "cargo:wasm-pack"
5051

5152
# NOTE: if you add a crate with wasm-gated tests, add a step here.
5253
- name: "Run wasm-pack tests (baml_playground_wasm)"

.github/workflows/webview-tests.reusable.yaml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ jobs:
4040
# Share cache across similar Linux WASM jobs for better hit rates
4141
shared-key: "linux-wasm"
4242

43-
- name: "Install wasm-pack"
44-
uses: taiki-e/install-action@v2
43+
# node + pnpm come from setup-node2 above; we only need mise for
44+
# wasm-pack here.
45+
- name: "Install mise"
46+
uses: ./.github/actions/setup-mise
4547
with:
46-
tool: wasm-pack
48+
install_args: "cargo:wasm-pack"
4749

4850
# Path-mapped imports from app-vscode-webview resolve into pkg-playground/wasm
4951
# and pkg-proto/src/generated, so both must be present before tsc runs.
@@ -88,10 +90,12 @@ jobs:
8890
# Share cache across similar Linux WASM jobs for better hit rates
8991
shared-key: "linux-wasm"
9092

91-
- name: "Install wasm-pack"
92-
uses: taiki-e/install-action@v2
93+
# node + pnpm come from setup-node2 above; we only need mise for
94+
# wasm-pack here.
95+
- name: "Install mise"
96+
uses: ./.github/actions/setup-mise
9397
with:
94-
tool: wasm-pack
98+
install_args: "cargo:wasm-pack"
9599

96100
- name: "Build WASM"
97101
run: pnpm --filter pkg-playground build:wasm
@@ -126,10 +130,12 @@ jobs:
126130
# Share cache across similar Linux WASM jobs for better hit rates
127131
shared-key: "linux-wasm"
128132

129-
- name: "Install wasm-pack"
130-
uses: taiki-e/install-action@v2
133+
# node + pnpm come from setup-node2 above; we only need mise for
134+
# wasm-pack here.
135+
- name: "Install mise"
136+
uses: ./.github/actions/setup-mise
131137
with:
132-
tool: wasm-pack
138+
install_args: "cargo:wasm-pack"
133139

134140
- name: "Build WASM"
135141
run: pnpm --filter pkg-playground build:wasm

mise.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protoc = "27.1"
3232
"pipx:maturin" = "latest"
3333

3434
# Node tools
35-
"npm:pnpm" = "10.14.0"
35+
"npm:pnpm" = "11.1.3"
3636
"npm:@infisical/cli" = "latest"
3737

3838
[tasks]

typescript2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"lint": "turbo run lint",
2222
"clean": "pnpm -r clean"
2323
},
24-
"packageManager": "pnpm@9.12.0",
24+
"packageManager": "pnpm@11.1.3",
2525
"devDependencies": {
2626
"turbo": "^2.8.9",
2727
"typescript": "^5.7.0",

typescript2/pnpm-workspace.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,15 @@ packages:
22
- "pkg-*"
33
- "app-*"
44

5+
# pnpm 11 promotes un-approved postinstall builds to errors. Approve the
6+
# transitive build-script dependencies the lockfile currently pulls in.
7+
allowBuilds:
8+
'@bufbuild/buf': true
9+
'@mongodb-js/zstd': true
10+
esbuild: true
11+
msw: true
12+
node-liblzma: true
13+
unrs-resolver: true
14+
515
catalog:
616
jotai: ^2.10.0

0 commit comments

Comments
 (0)