Skip to content

Commit 41bc0c2

Browse files
Merge pull request #1040 from manaflow-ai/cmux-sandbox-1
cmux sandbox 1
2 parents 9ef1834 + 8ee6dc8 commit 41bc0c2

106 files changed

Lines changed: 35233 additions & 4 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/sandbox.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Sandbox (Rust)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- packages/sandbox/**
8+
- .github/workflows/sandbox.yml
9+
pull_request:
10+
paths:
11+
- packages/sandbox/**
12+
- .github/workflows/sandbox.yml
13+
workflow_dispatch:
14+
15+
env:
16+
REGISTRY: ghcr.io
17+
IMAGE_NAME: ${{ github.repository }}-sandbox
18+
19+
jobs:
20+
rust-checks:
21+
name: Rust checks
22+
runs-on: ubuntu-24.04
23+
env:
24+
CARGO_TERM_COLOR: always
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Rust
30+
uses: dtolnay/rust-toolchain@stable
31+
with:
32+
components: clippy, rustfmt
33+
34+
- name: Cache cargo registry + build
35+
uses: Swatinem/rust-cache@v2
36+
with:
37+
workspaces: packages/sandbox
38+
39+
- name: Format
40+
run: cargo fmt --all -- --check
41+
working-directory: packages/sandbox
42+
43+
- name: Clippy
44+
run: cargo clippy --all-targets --all-features -- -D warnings
45+
working-directory: packages/sandbox
46+
47+
- name: Tests
48+
run: cargo test --all-features --locked
49+
working-directory: packages/sandbox
50+
51+
docker-build:
52+
name: Build Docker image (${{ matrix.platform }})
53+
runs-on: ${{ matrix.runner }}
54+
needs: rust-checks
55+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
56+
permissions:
57+
contents: read
58+
packages: write
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
include:
63+
- platform: linux/amd64
64+
runner: ubuntu-24.04
65+
- platform: linux/arm64
66+
runner: ubuntu-24.04-arm
67+
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
72+
- name: Set up QEMU
73+
uses: docker/setup-qemu-action@v3
74+
75+
- name: Set up Docker Buildx
76+
uses: docker/setup-buildx-action@v3
77+
78+
- name: Log in to GHCR
79+
uses: docker/login-action@v3
80+
with:
81+
registry: ${{ env.REGISTRY }}
82+
username: ${{ github.actor }}
83+
password: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Extract metadata for Docker
86+
id: meta
87+
uses: docker/metadata-action@v5
88+
with:
89+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
90+
tags: |
91+
type=ref,event=branch
92+
type=sha,prefix=
93+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
94+
95+
- name: Build and push by digest
96+
id: build
97+
uses: docker/build-push-action@v6
98+
with:
99+
context: .
100+
file: packages/sandbox/Dockerfile
101+
platforms: ${{ matrix.platform }}
102+
labels: ${{ steps.meta.outputs.labels }}
103+
cache-from: type=gha,scope=${{ matrix.platform }}
104+
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
105+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
106+
107+
- name: Export digest
108+
run: |
109+
mkdir -p /tmp/digests
110+
digest="${{ steps.build.outputs.digest }}"
111+
touch "/tmp/digests/${digest#sha256:}"
112+
113+
- name: Upload digest
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
117+
path: /tmp/digests/*
118+
if-no-files-found: error
119+
retention-days: 1
120+
121+
docker-merge:
122+
name: Create multi-arch manifest
123+
runs-on: ubuntu-24.04
124+
needs: docker-build
125+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
126+
permissions:
127+
contents: read
128+
packages: write
129+
steps:
130+
- name: Download digests
131+
uses: actions/download-artifact@v4
132+
with:
133+
path: /tmp/digests
134+
pattern: digests-*
135+
merge-multiple: true
136+
137+
- name: Set up Docker Buildx
138+
uses: docker/setup-buildx-action@v3
139+
140+
- name: Log in to GHCR
141+
uses: docker/login-action@v3
142+
with:
143+
registry: ${{ env.REGISTRY }}
144+
username: ${{ github.actor }}
145+
password: ${{ secrets.GITHUB_TOKEN }}
146+
147+
- name: Extract metadata for Docker
148+
id: meta
149+
uses: docker/metadata-action@v5
150+
with:
151+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
152+
tags: |
153+
type=ref,event=branch
154+
type=sha,prefix=
155+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
156+
157+
- name: Create manifest list and push
158+
working-directory: /tmp/digests
159+
run: |
160+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
161+
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
162+
163+
- name: Inspect image
164+
run: |
165+
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ jobs:
6666
CMUX_BUILD_LINUX: "0"
6767
# Skip Docker E2E tests in CI for stability/speed
6868
CMUX_SKIP_DOCKER_TESTS: "1"
69+
# Skip slow cargo crates handled in dedicated workflows
70+
CMUX_SKIP_CARGO_CRATES: "sandbox"
6971
# Stack Auth env vars
7072
STACK_SECRET_SERVER_KEY: ${{ secrets.STACK_SECRET_SERVER_KEY }}
7173
STACK_SUPER_SECRET_ADMIN_KEY: ${{ secrets.STACK_SUPER_SECRET_ADMIN_KEY }}

apps/server/native/core/index.d.ts

Whitespace-only changes.

packages/sandbox/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/target
2+
/dist
3+
/*.log
4+
/tools/esctest
5+
/tools/esctest2
6+
/.tmp_acp_repos

packages/sandbox/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Do not use .unwrap (except in tests).
2+
Make sure to run clippy and fix all lint warnings.
3+
Before finishing, make sure to run tests and cargo fmt.
4+
After tests pass, ALWAYS run `./scripts/reload.sh` to rebuild the CLI, rebuild the Docker container, and restart the dev server. This ensures the user has the latest changes immediately available.
5+
After finishing, use the macOS `say` command to notify the user with a short description of what to check/the next action the user should take (like a shell command/url/program they should interact with to veriy).

packages/sandbox/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

0 commit comments

Comments
 (0)