@@ -20,7 +20,7 @@ concurrency:
2020env :
2121 R2_BUCKET : rivet-releases
2222 R2_ENDPOINT : https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com
23- SIDECAR_PLATFORMS : " linux-x64-gnu"
23+ SIDECAR_PLATFORMS : " linux-x64-gnu linux-arm64-gnu darwin-x64 darwin-arm64 "
2424
2525jobs :
2626 context :
@@ -36,10 +36,10 @@ jobs:
3636 - uses : actions/checkout@v4
3737 with :
3838 fetch-depth : 1
39- - uses : pnpm/action-setup@v4
39+ - run : corepack enable
4040 - uses : actions/setup-node@v4
4141 with :
42- node-version : 22
42+ node-version : " 22 "
4343 cache : pnpm
4444 cache-dependency-path : pnpm-lock.yaml
4545 - name : Install publish scripts
@@ -53,23 +53,51 @@ jobs:
5353 name : " Build sidecar (${{ matrix.platform }})"
5454 strategy :
5555 fail-fast : false
56+ # The target set is dictated by the embedded V8 (rusty_v8): the build links
57+ # a prebuilt `librusty_v8` static lib, and rusty_v8 publishes prebuilts for
58+ # EXACTLY these four triples (linux-gnu + darwin, x64/arm64). musl has no
59+ # prebuilt (would force a 30+ min V8 source build). Keep this list in
60+ # lockstep with the rusty_v8 release assets when bumping the v8 crate.
5661 matrix :
5762 include :
5863 - platform : linux-x64-gnu
5964 runner : ubuntu-22.04
6065 target : x86_64-unknown-linux-gnu
66+ binary : secure-exec-sidecar
67+ - platform : linux-arm64-gnu
68+ runner : ubuntu-22.04-arm
69+ target : aarch64-unknown-linux-gnu
70+ binary : secure-exec-sidecar
71+ - platform : darwin-x64
72+ runner : macos-13
73+ target : x86_64-apple-darwin
74+ binary : secure-exec-sidecar
75+ - platform : darwin-arm64
76+ runner : macos-14
77+ target : aarch64-apple-darwin
78+ binary : secure-exec-sidecar
6179 runs-on : ${{ matrix.runner }}
6280 steps :
6381 - uses : actions/checkout@v4
64- - uses : pnpm/action-setup@v4
82+ - run : corepack enable
83+ shell : bash
6584 - uses : actions/setup-node@v4
6685 with :
67- node-version : 22
86+ node-version : " 22 "
6887 cache : pnpm
6988 cache-dependency-path : pnpm-lock.yaml
7089 - uses : dtolnay/rust-toolchain@stable
71- with :
72- targets : ${{ matrix.target }}
90+ - name : Add Rust target to the pinned toolchain
91+ shell : bash
92+ run : |
93+ set -euo pipefail
94+ # The repo pins a toolchain via rust-toolchain.toml; cross targets
95+ # must be added to *that* toolchain (not just `stable`), or cargo
96+ # fails with "can't find crate for `core`" for the cross target.
97+ channel=$(awk -F'"' '/channel/ {print $2; exit}' rust-toolchain.toml)
98+ echo "Pinned toolchain channel: ${channel}"
99+ rustup toolchain install "${channel}" --profile minimal
100+ rustup target add --toolchain "${channel}" "${{ matrix.target }}"
73101 - uses : Swatinem/rust-cache@v2
74102 with :
75103 workspaces : . -> target
@@ -80,21 +108,35 @@ jobs:
80108 key : ${{ runner.os }}-${{ matrix.target }}-rusty-v8-${{ hashFiles('Cargo.lock') }}
81109 restore-keys : |
82110 ${{ runner.os }}-${{ matrix.target }}-rusty-v8-
83- - run : pnpm install --frozen-lockfile
111+ # The v8-runtime build script generates the V8 bridge assets from
112+ # packages/build-tools/node_modules, so the workspace must be installed
113+ # before cargo build. Exclude the `website` package: it is a leaf nothing
114+ # depends on, and pnpm 10.x intermittently loses a symlink-ordering race
115+ # creating website/node_modules (ENOENT before linking pixelmatch).
116+ - name : Install workspace dependencies
117+ shell : bash
118+ run : pnpm install --frozen-lockfile --filter='!@secure-exec/website'
84119 - name : Build sidecar binary
85120 id : build
121+ shell : bash
122+ env :
123+ MATRIX_TARGET : ${{ matrix.target }}
124+ MATRIX_PLATFORM : ${{ matrix.platform }}
125+ MATRIX_BINARY : ${{ matrix.binary }}
126+ TRIGGER : ${{ needs.context.outputs.trigger }}
86127 run : |
87128 set -euo pipefail
88- out="target/sidecar-artifacts/${{ matrix.platform }}"
129+
130+ out="target/sidecar-artifacts/${MATRIX_PLATFORM}"
89131 mkdir -p "$out"
90- if [ "${{ needs.context.outputs.trigger }} " = "release" ]; then
91- cargo build --release -p secure-exec-sidecar --target ${{ matrix.target }}
132+ if [ "$TRIGGER " = "release" ]; then
133+ cargo build --release -p secure-exec-sidecar --target "$MATRIX_TARGET"
92134 profile="release"
93135 else
94- cargo build -p secure-exec-sidecar --target ${{ matrix.target }}
136+ cargo build -p secure-exec-sidecar --target "$MATRIX_TARGET"
95137 profile="debug"
96138 fi
97- cp "target/${{ matrix.target }} /${profile}/secure-exec-sidecar " "$out/secure-exec-sidecar "
139+ cp "target/${MATRIX_TARGET} /${profile}/${MATRIX_BINARY} " "$out/${MATRIX_BINARY} "
98140 echo "dir=$out" >> "$GITHUB_OUTPUT"
99141 - uses : actions/upload-artifact@v4
100142 with :
@@ -114,14 +156,21 @@ jobs:
114156 runs-on : ubuntu-latest
115157 steps :
116158 - uses : actions/checkout@v4
117- - uses : pnpm/action-setup@v4
159+ - run : corepack enable
118160 - uses : actions/setup-node@v4
119161 with :
120- node-version : 22
162+ node-version : " 22 "
121163 cache : pnpm
122164 cache-dependency-path : pnpm-lock.yaml
123165 registry-url : https://registry.npmjs.org
124- - run : pnpm install --frozen-lockfile
166+ # Install the full workspace except the `website` package. website is a
167+ # leaf (nothing depends on it, and it is not published here), and pnpm 10.x
168+ # intermittently loses a symlink-ordering race creating website/node_modules
169+ # (ENOENT before linking pixelmatch). Excluding it deterministically avoids
170+ # the flake. `--frozen-lockfile` still validates the full lockfile.
171+ - name : Install workspace dependencies
172+ shell : bash
173+ run : pnpm install --frozen-lockfile --filter='!@secure-exec/website'
125174 - uses : actions/download-artifact@v4
126175 with :
127176 pattern : sidecar-*
@@ -130,7 +179,8 @@ jobs:
130179 run : |
131180 set -euo pipefail
132181 for p in $SIDECAR_PLATFORMS; do
133- bin="artifacts/sidecar-${p}/secure-exec-sidecar"
182+ binname="secure-exec-sidecar"
183+ bin="artifacts/sidecar-${p}/${binname}"
134184 dest="packages/sidecar/npm/${p}"
135185 if [ ! -f "$bin" ]; then
136186 echo "::error::missing secure-exec-sidecar binary artifact for ${p}"
@@ -140,8 +190,8 @@ jobs:
140190 echo "::error::missing platform package dir $dest"
141191 exit 1
142192 fi
143- cp "$bin" "${dest}/secure-exec-sidecar "
144- chmod +x "${dest}/secure-exec-sidecar "
193+ cp "$bin" "${dest}/${binname} "
194+ chmod +x "${dest}/${binname} "
145195 echo "Placed binary for ${p}"
146196 done
147197 - name : Bump package versions for build
@@ -152,7 +202,8 @@ jobs:
152202 - name : Build TypeScript packages
153203 run : |
154204 npx turbo build \
155- --filter='!./examples/*'
205+ --filter='!./examples/*' \
206+ --filter='!@secure-exec/website'
156207 - name : Finalize package versions for publish
157208 run : |
158209 pnpm --filter=publish exec tsx src/ci/bin.ts bump-versions \
@@ -178,10 +229,10 @@ jobs:
178229 - uses : actions/checkout@v4
179230 with :
180231 fetch-depth : 0
181- - uses : pnpm/action-setup@v4
232+ - run : corepack enable
182233 - uses : actions/setup-node@v4
183234 with :
184- node-version : 22
235+ node-version : " 22 "
185236 cache : pnpm
186237 cache-dependency-path : pnpm-lock.yaml
187238 - run : pnpm install --frozen-lockfile --filter=publish
@@ -196,13 +247,18 @@ jobs:
196247 set -euo pipefail
197248 declare -A PLATFORM_TARGET=(
198249 [linux-x64-gnu]=x86_64-unknown-linux-gnu
250+ [linux-arm64-gnu]=aarch64-unknown-linux-gnu
251+ [darwin-x64]=x86_64-apple-darwin
252+ [darwin-arm64]=aarch64-apple-darwin
199253 )
200254 mkdir -p release-assets
201255 for p in $SIDECAR_PLATFORMS; do
202- bin="artifacts/sidecar-${p}/secure-exec-sidecar"
256+ binname="secure-exec-sidecar"
257+ suffix=""
258+ bin="artifacts/sidecar-${p}/${binname}"
203259 if [ -f "$bin" ]; then
204260 target="${PLATFORM_TARGET[$p]}"
205- cp "$bin" "release-assets/secure-exec-sidecar-${target}"
261+ cp "$bin" "release-assets/secure-exec-sidecar-${target}${suffix} "
206262 else
207263 echo "::warning::missing secure-exec-sidecar binary for ${p}"
208264 fi
@@ -274,14 +330,18 @@ jobs:
274330 publish-crates :
275331 needs : [context, build-sidecar, release-assets]
276332 name : " Publish crates.io"
277- if : ${{ !cancelled() && needs.build-sidecar.result == 'success' && (needs.release-assets.result == 'success' || needs.release-assets.result == 'skipped') }}
333+ # Release-only: on previews the crates publish is a dry-run that still does a
334+ # full compile/package, and any error there reddened the WHOLE run even though
335+ # the npm deliverable published fine (FALLING_OUT.md §4b). The 4 build-sidecar
336+ # legs already compile every crate, so the preview dry-run added only noise.
337+ if : ${{ !cancelled() && needs.build-sidecar.result == 'success' && needs.release-assets.result == 'success' && needs.context.outputs.trigger == 'release' }}
278338 runs-on : ubuntu-latest
279339 steps :
280340 - uses : actions/checkout@v4
281- - uses : pnpm/action-setup@v4
341+ - run : corepack enable
282342 - uses : actions/setup-node@v4
283343 with :
284- node-version : 22
344+ node-version : " 22 "
285345 cache : pnpm
286346 cache-dependency-path : pnpm-lock.yaml
287347 - uses : dtolnay/rust-toolchain@stable
@@ -294,7 +354,14 @@ jobs:
294354 key : ${{ runner.os }}-x86_64-unknown-linux-gnu-rusty-v8-${{ hashFiles('Cargo.lock') }}
295355 restore-keys : |
296356 ${{ runner.os }}-x86_64-unknown-linux-gnu-rusty-v8-
297- - run : pnpm install --frozen-lockfile
357+ # Install the full workspace except the `website` package. website is a
358+ # leaf (nothing depends on it, and it is not published here), and pnpm 10.x
359+ # intermittently loses a symlink-ordering race creating website/node_modules
360+ # (ENOENT before linking pixelmatch). Excluding it deterministically avoids
361+ # the flake. `--frozen-lockfile` still validates the full lockfile.
362+ - name : Install workspace dependencies
363+ shell : bash
364+ run : pnpm install --frozen-lockfile --filter='!@secure-exec/website'
298365 - name : Bump Cargo versions
299366 run : |
300367 pnpm --filter=publish exec tsx src/ci/bin.ts bump-versions \
0 commit comments