Skip to content

Commit 16509e8

Browse files
committed
feat: add Run 2.0 experimental WASI component runtime
Run 2.0 introduces WASI 0.2 component support as an opt-in experimental feature. Access via `run v2 --help`. New features: - Cross-language component composition via WIT interfaces - Instant startup (<10ms cold start) - Hermetic, reproducible builds with toolchain lockfile - Edge deployment (Cloudflare, AWS Lambda, Vercel) - Docker Compose migration support - Hot reload development server New files: - src/v2/ - Core v2 runtime implementation - registry-server/ - Self-hosted component registry - examples/v2/ - Working examples and templates - MIGRATION.md - Docker to Run 2.0 migration guide - bench/, benches/, benchmarks/ - Performance testing Version bump: 0.3.2 -> 0.4.0
1 parent 0fb9dec commit 16509e8

File tree

137 files changed

+24626
-1190
lines changed

Some content is hidden

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

137 files changed

+24626
-1190
lines changed

.github/workflows/ci.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["master", "main"]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
name: Test on ${{ matrix.os }}
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: dtolnay/rust-toolchain@stable
23+
with:
24+
components: rustfmt, clippy
25+
26+
- name: Cache cargo registry
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.cargo/registry
30+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
31+
32+
- name: Cache cargo index
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.cargo/git
36+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
37+
38+
- name: Cache cargo build
39+
uses: actions/cache@v4
40+
with:
41+
path: target
42+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
43+
44+
- name: Install wasm-tools
45+
run: cargo install wasm-tools
46+
47+
- name: Build (v2)
48+
run: cargo build --features v2 --release
49+
50+
- name: Test (v2)
51+
run: cargo test --features v2 --lib --release
52+
53+
- name: Clippy
54+
run: cargo clippy --features v2 -- -D warnings
55+
56+
- name: Format check
57+
run: cargo fmt -- --check
58+
59+
integration:
60+
name: Integration Tests
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- uses: dtolnay/rust-toolchain@stable
66+
67+
- name: Install wasm-tools
68+
run: cargo install wasm-tools
69+
70+
- name: Install cargo-component
71+
run: cargo install cargo-component
72+
73+
- name: Build Run CLI
74+
run: cargo build --features v2 --release
75+
76+
- name: Install Run
77+
run: sudo cp target/release/run /usr/local/bin/run
78+
79+
- name: Run integration tests
80+
run: |
81+
cd examples/v2
82+
run build
83+
run test
84+
85+
reproducibility:
86+
name: Reproducible Builds
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
91+
- uses: dtolnay/rust-toolchain@stable
92+
93+
- name: Install wasm-tools
94+
run: cargo install wasm-tools
95+
96+
- name: Install cargo-component
97+
run: cargo install cargo-component
98+
99+
- name: Build Run CLI
100+
run: cargo build --features v2 --release
101+
102+
- name: First build
103+
run: |
104+
cargo run --features v2 -- build --reproducible
105+
mkdir -p /tmp/build1
106+
cp -r target/wasm/*.wasm /tmp/build1/
107+
108+
- name: Clean
109+
run: cargo clean
110+
111+
- name: Second build
112+
run: |
113+
cargo run --features v2 -- build --reproducible
114+
mkdir -p /tmp/build2
115+
cp -r target/wasm/*.wasm /tmp/build2/
116+
117+
- name: Compare builds
118+
run: |
119+
for f in /tmp/build1/*.wasm; do
120+
name=$(basename "$f")
121+
if [ -f "/tmp/build2/$name" ]; then
122+
sha1=$(sha256sum "$f" | cut -d' ' -f1)
123+
sha2=$(sha256sum "/tmp/build2/$name" | cut -d' ' -f1)
124+
if [ "$sha1" != "$sha2" ]; then
125+
echo "FAIL: $name is not reproducible"
126+
exit 1
127+
fi
128+
echo "OK: $name is reproducible"
129+
fi
130+
done
131+
132+
security:
133+
name: Security Audit
134+
runs-on: ubuntu-latest
135+
steps:
136+
- uses: actions/checkout@v4
137+
138+
- uses: dtolnay/rust-toolchain@stable
139+
140+
- name: Install cargo-audit
141+
run: cargo install cargo-audit
142+
143+
- name: Security audit
144+
run: cargo audit
145+
146+
benchmark:
147+
name: Performance Benchmarks
148+
runs-on: ubuntu-latest
149+
steps:
150+
- uses: actions/checkout@v4
151+
152+
- uses: dtolnay/rust-toolchain@stable
153+
154+
- name: Install wasm-tools
155+
run: cargo install wasm-tools
156+
157+
- name: Run benchmarks
158+
run: cargo bench --features v2

.github/workflows/docker.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Docker Compatibility
2+
3+
on:
4+
push:
5+
branches: ["master", "main"]
6+
pull_request:
7+
schedule:
8+
- cron: '0 0 * * 0' # Weekly on Sunday
9+
10+
jobs:
11+
docker-bridge:
12+
name: Docker Bridge Tests
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: dtolnay/rust-toolchain@stable
19+
20+
- name: Install Docker
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y docker.io
24+
sudo systemctl start docker
25+
26+
- name: Build Run CLI
27+
run: cargo build --features v2 --release
28+
29+
- name: Test Docker availability
30+
run: |
31+
cargo run --features v2 -- info
32+
33+
- name: Start Docker service via Run
34+
run: |
35+
cargo run --features v2 -- dev --bridge postgres
36+
37+
- name: Test hybrid Run + Docker
38+
run: |
39+
cargo test --features v2 --test docker_bridge
40+
41+
compose-migration:
42+
name: Docker Compose Migration
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- uses: dtolnay/rust-toolchain@stable
49+
50+
- name: Install Docker Compose
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get install -y docker-compose
54+
55+
- name: Build Run CLI
56+
run: cargo build --features v2 --release
57+
58+
- name: Create sample docker-compose.yml
59+
run: |
60+
cat > docker-compose.yml << 'EOF'
61+
version: '3'
62+
services:
63+
db:
64+
image: postgres:15
65+
environment:
66+
POSTGRES_PASSWORD: secret
67+
app:
68+
build: .
69+
depends_on:
70+
- db
71+
EOF
72+
73+
- name: Migrate compose to run.toml
74+
run: |
75+
cargo run --features v2 -- compose migrate docker-compose.yml run.toml
76+
77+
- name: Verify migration
78+
run: |
79+
cat run.toml
80+
cargo run --features v2 -- info

.github/workflows/edge.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Edge Deployment
2+
3+
on:
4+
push:
5+
branches: ["master", "main"]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
cloudflare-deploy:
11+
name: Deploy to Cloudflare Workers
12+
runs-on: ubuntu-latest
13+
if: github.event_name == 'workflow_dispatch'
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: dtolnay/rust-toolchain@stable
19+
20+
- name: Install wasm-tools
21+
run: cargo install wasm-tools
22+
23+
- name: Install Wrangler
24+
run: npm install -g wrangler
25+
26+
- name: Build Run CLI
27+
run: cargo build --features v2 --release
28+
29+
- name: Build WASI component
30+
run: |
31+
cargo run --features v2 -- build --release
32+
33+
- name: Deploy to Cloudflare
34+
env:
35+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
36+
run: |
37+
cargo run --features v2 -- deploy --target edge --provider cloudflare
38+
39+
aws-lambda-deploy:
40+
name: Deploy to AWS Lambda
41+
runs-on: ubuntu-latest
42+
if: github.event_name == 'workflow_dispatch'
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- uses: dtolnay/rust-toolchain@stable
48+
49+
- name: Install wasm-tools
50+
run: cargo install wasm-tools
51+
52+
- name: Install AWS CLI
53+
run: |
54+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
55+
unzip awscliv2.zip
56+
sudo ./aws/install
57+
58+
- name: Build Run CLI
59+
run: cargo build --features v2 --release
60+
61+
- name: Build WASI component
62+
run: |
63+
cargo run --features v2 -- build --release
64+
65+
- name: Deploy to AWS Lambda
66+
env:
67+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
68+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
69+
AWS_REGION: us-east-1
70+
run: |
71+
cargo run --features v2 -- deploy --target edge --provider aws-lambda
72+
73+
vercel-deploy:
74+
name: Deploy to Vercel
75+
runs-on: ubuntu-latest
76+
if: github.event_name == 'workflow_dispatch'
77+
78+
steps:
79+
- uses: actions/checkout@v4
80+
81+
- uses: dtolnay/rust-toolchain@stable
82+
83+
- name: Install wasm-tools
84+
run: cargo install wasm-tools
85+
86+
- name: Install Vercel CLI
87+
run: npm install -g vercel
88+
89+
- name: Build Run CLI
90+
run: cargo build --features v2 --release
91+
92+
- name: Build WASI component
93+
run: |
94+
cargo run --features v2 -- build --release
95+
96+
- name: Deploy to Vercel
97+
env:
98+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
99+
run: |
100+
cargo run --features v2 -- deploy --target edge --provider vercel
101+
102+
edge-smoke-test:
103+
name: Edge Deployment Smoke Test
104+
runs-on: ubuntu-latest
105+
106+
steps:
107+
- uses: actions/checkout@v4
108+
109+
- uses: dtolnay/rust-toolchain@stable
110+
111+
- name: Install wasm-tools
112+
run: cargo install wasm-tools
113+
114+
- name: Build Run CLI
115+
run: cargo build --features v2 --release
116+
117+
- name: Build test component
118+
run: |
119+
cargo run --features v2 -- build --release
120+
121+
- name: Test edge manifest generation
122+
run: |
123+
cargo run --features v2 -- deploy --target edge --provider cloudflare --dry-run
124+
125+
- name: Verify manifest
126+
run: |
127+
test -f target/deploy/edge-manifest.json
128+
cat target/deploy/edge-manifest.json

0 commit comments

Comments
 (0)