Skip to content

Commit 78e0a52

Browse files
authored
Merge pull request #19 from rivet-dev/nathan/v8-process-isolation-pt1
feat: V8 process isolation (part 1)
2 parents fa73599 + 2e06f8a commit 78e0a52

118 files changed

Lines changed: 22308 additions & 3386 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,31 @@ jobs:
4444
registry-url: https://registry.npmjs.org
4545

4646
- name: Install dependencies
47-
run: pnpm install --frozen-lockfile
47+
run: pnpm install --no-frozen-lockfile
4848

4949
- name: Type check
5050
run: pnpm turbo check-types
5151

5252
- name: Build
5353
run: pnpm turbo build
5454

55+
- name: Build linux-x64 binary via Docker
56+
run: |
57+
cd crates/v8-runtime
58+
docker build -f docker/Dockerfile.linux-x64-gnu -o type=local,dest=npm/linux-x64-gnu .
59+
5560
- name: Publish to npm
5661
run: |
5762
FAILURES=""
63+
64+
# Publish workspace packages
5865
for dir in $(pnpm -r ls --json --depth -1 | jq -r '.[] | select(.private != true) | .path'); do
5966
# Skip the root package
6067
if [ "$dir" = "$(pwd)" ]; then
6168
continue
6269
fi
6370
NAME=$(jq -r .name "$dir/package.json")
6471
VERSION="${{ inputs.version }}"
65-
# Skip if already published
6672
if npm view "${NAME}@${VERSION}" version >/dev/null 2>&1; then
6773
echo "⏭ ${NAME}@${VERSION} already published, skipping."
6874
continue
@@ -72,6 +78,24 @@ jobs:
7278
FAILURES="${FAILURES} ${NAME}"
7379
fi
7480
done
81+
82+
# Publish v8 platform packages (not in pnpm workspace)
83+
for dir in crates/v8-runtime/npm/*/; do
84+
if [ ! -f "$dir/package.json" ]; then
85+
continue
86+
fi
87+
NAME=$(jq -r .name "$dir/package.json")
88+
VERSION="${{ inputs.version }}"
89+
if npm view "${NAME}@${VERSION}" version >/dev/null 2>&1; then
90+
echo "⏭ ${NAME}@${VERSION} already published, skipping."
91+
continue
92+
fi
93+
echo "Publishing ${NAME}@${VERSION}..."
94+
if ! (cd "$dir" && npm publish --access public --tag ${{ inputs.npm-tag }}); then
95+
FAILURES="${FAILURES} ${NAME}"
96+
fi
97+
done
98+
7599
if [ -n "$FAILURES" ]; then
76100
echo "::error::Failed to publish:${FAILURES}"
77101
exit 1

.github/workflows/rust.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "crates/v8-runtime/**"
9+
- ".github/workflows/rust.yml"
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- "crates/v8-runtime/**"
15+
- ".github/workflows/rust.yml"
16+
17+
jobs:
18+
build:
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- target: x86_64-unknown-linux-gnu
24+
os: ubuntu-latest
25+
npm-dir: linux-x64-gnu
26+
binary: secure-exec-v8
27+
test: true
28+
- target: aarch64-unknown-linux-gnu
29+
os: ubuntu-latest
30+
npm-dir: linux-arm64-gnu
31+
binary: secure-exec-v8
32+
cross: true
33+
- target: x86_64-apple-darwin
34+
os: macos-13
35+
npm-dir: darwin-x64
36+
binary: secure-exec-v8
37+
test: true
38+
- target: aarch64-apple-darwin
39+
os: macos-latest
40+
npm-dir: darwin-arm64
41+
binary: secure-exec-v8
42+
test: true
43+
- target: x86_64-pc-windows-msvc
44+
os: windows-latest
45+
npm-dir: win32-x64
46+
binary: secure-exec-v8.exe
47+
test: true
48+
runs-on: ${{ matrix.os }}
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
- name: Set up Rust toolchain
54+
uses: dtolnay/rust-toolchain@stable
55+
with:
56+
toolchain: "1.85.0"
57+
targets: ${{ matrix.target }}
58+
59+
- name: Cache Rust build artifacts
60+
uses: actions/cache@v4
61+
with:
62+
path: |
63+
~/.cargo/registry
64+
~/.cargo/git
65+
crates/v8-runtime/target
66+
key: rust-${{ matrix.target }}-${{ hashFiles('crates/v8-runtime/Cargo.lock') }}
67+
restore-keys: |
68+
rust-${{ matrix.target }}-
69+
70+
# Cross-compilation toolchain for linux-arm64
71+
- name: Install cross-compilation tools
72+
if: matrix.cross
73+
run: |
74+
sudo apt-get update
75+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
76+
77+
- name: Configure cross-compilation linker
78+
if: matrix.cross
79+
working-directory: crates/v8-runtime
80+
run: |
81+
mkdir -p .cargo
82+
cat > .cargo/config.toml <<'EOF'
83+
[target.aarch64-unknown-linux-gnu]
84+
linker = "aarch64-linux-gnu-gcc"
85+
EOF
86+
87+
- name: Build
88+
working-directory: crates/v8-runtime
89+
run: cargo build --release --target ${{ matrix.target }}
90+
91+
- name: Run tests
92+
if: matrix.test
93+
working-directory: crates/v8-runtime
94+
run: cargo test --release --target ${{ matrix.target }}
95+
96+
- name: Upload binary artifact
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: v8-${{ matrix.npm-dir }}
100+
path: crates/v8-runtime/target/${{ matrix.target }}/release/${{ matrix.binary }}

0 commit comments

Comments
 (0)