Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ on:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
verify:
name: Verify
runs-on: ubuntu-24.04
environment: dev
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.3.0
with:
persist-credentials: false

- name: Setup Bun
uses: oven-sh/setup-bun@v2
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.2.21

- name: Cache Bun install cache
uses: actions/cache@v4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.bun/install/cache
Expand All @@ -25,35 +32,25 @@ jobs:
${{ runner.os }}-bun-install-

- name: Use Node.js 24
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24

- name: Install dependencies
run: bun install
run: bun install --frozen-lockfile

- name: Checks and tests (parallel on one runner)
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
STACK_SECRET_SERVER_KEY: ${{ secrets.STACK_SECRET_SERVER_KEY }}
STACK_SUPER_SECRET_ADMIN_KEY: ${{ secrets.STACK_SUPER_SECRET_ADMIN_KEY }}
STACK_DATA_VAULT_SECRET: ${{ secrets.STACK_DATA_VAULT_SECRET }}
CMUX_GITHUB_APP_ID: ${{ secrets.CMUX_GITHUB_APP_ID }}
CMUX_GITHUB_APP_PRIVATE_KEY: ${{ secrets.CMUX_GITHUB_APP_PRIVATE_KEY }}
CMUX_TASK_RUN_JWT_SECRET: ${{ secrets.CMUX_TASK_RUN_JWT_SECRET }}
MORPH_API_KEY: ${{ secrets.MORPH_API_KEY }}
CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
NEXT_PUBLIC_STACK_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_STACK_PROJECT_ID }}
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY: ${{ secrets.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY }}
NEXT_PUBLIC_CONVEX_URL: ${{ secrets.NEXT_PUBLIC_CONVEX_URL }}
CI: "true"
run: |
set -euo pipefail
bun run check & pid1=$!
(cd packages/cmux && bun run test) & pid2=$!
wait $pid1; s1=$?
wait $pid2; s2=$?
s1=0
s2=0
wait "$pid1" || s1=$?
wait "$pid2" || s2=$?
if [ $s1 -ne 0 ] || [ $s2 -ne 0 ]; then
echo "At least one task failed"
exit 1
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/cmux-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- .github/workflows/cmux-env.yml
workflow_dispatch:

permissions:
contents: read

jobs:
rust-checks:
name: Rust checks
Expand All @@ -20,15 +23,17 @@ jobs:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.3.0
with:
persist-credentials: false

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
components: clippy, rustfmt

- name: Cache cargo registry + build
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.7.8
with:
workspaces: crates/cmux-env

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/cmux-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- .github/workflows/cmux-proxy.yml
workflow_dispatch:

permissions:
contents: read

jobs:
rust-checks:
name: Rust checks
Expand All @@ -20,15 +23,17 @@ jobs:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.3.0
with:
persist-credentials: false

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
components: clippy, rustfmt

- name: Cache cargo registry + build
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.7.8
with:
workspaces: crates/cmux-proxy

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/cmux-pty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- .github/workflows/cmux-pty.yml
workflow_dispatch:

permissions:
contents: read

jobs:
rust-checks:
name: Rust checks
Expand All @@ -20,15 +23,17 @@ jobs:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.3.0
with:
persist-credentials: false

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
components: clippy, rustfmt

- name: Cache cargo registry + build
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.7.8
with:
workspaces: crates/cmux-pty

Expand Down
66 changes: 50 additions & 16 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,21 @@ on:
- prompt-wrapper.sh
workflow_dispatch:

permissions:
contents: read

env:
REGISTRY: docker.io
IMAGE_NAME: manaflow/cmux

jobs:
docker-build:
name: Build Docker image (${{ matrix.platform }})
# The build pushes to Docker Hub with repository credentials. A manual
# dispatch must use the protected main ref, never arbitrary branch code.
if: >-
github.ref == 'refs/heads/main' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
runs-on: ${{ matrix.runner }}
permissions:
contents: read
Expand All @@ -52,7 +60,7 @@ jobs:

steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
tool-cache: false
android: true
Expand All @@ -63,24 +71,27 @@ jobs:
swap-storage: true

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.3.0
with:
ref: ${{ github.sha }}
persist-credentials: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.6.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.11.1

- name: Log in to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.5.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PAT }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.8.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
Expand All @@ -90,7 +101,7 @@ jobs:

- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.18.0
with:
context: .
file: Dockerfile
Expand All @@ -101,13 +112,15 @@ jobs:
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true

- name: Export digest
env:
BUILD_DIGEST: ${{ steps.build.outputs.digest }}
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
digest="$BUILD_DIGEST"
touch "/tmp/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: worker-digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
path: /tmp/digests/*
Expand All @@ -116,31 +129,34 @@ jobs:

docker-merge:
name: Create multi-arch manifest
if: >-
github.ref == 'refs/heads/main' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-24.04
needs: docker-build
permissions:
contents: read
steps:
- name: Download digests
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: /tmp/digests
pattern: worker-digests-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.11.1

- name: Log in to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.5.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PAT }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.8.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
Expand All @@ -151,9 +167,27 @@ jobs:
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
shopt -s nullglob
digest_files=(*)
if (( ${#digest_files[@]} == 0 )); then
echo "No image digests were uploaded" >&2
exit 1
fi

metadata_args=()
while IFS= read -r tag; do
metadata_args+=("-t" "$tag")
done < <(jq -r '.tags[]' <<< "$DOCKER_METADATA_OUTPUT_JSON")

digest_args=()
for digest_file in "${digest_files[@]}"; do
digest_args+=("${REGISTRY}/${IMAGE_NAME}@sha256:${digest_file}")
done

docker buildx imagetools create "${metadata_args[@]}" "${digest_args[@]}"

- name: Inspect image
env:
IMAGE_REF: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
run: |
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect "$IMAGE_REF"
11 changes: 8 additions & 3 deletions .github/workflows/global-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- .github/workflows/global-proxy.yml
workflow_dispatch:

permissions:
contents: read

jobs:
rust-checks:
name: Rust checks
Expand All @@ -20,15 +23,17 @@ jobs:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.3.0
with:
persist-credentials: false

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
components: clippy, rustfmt

- name: Cache cargo registry + build
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.7.8
with:
workspaces: apps/global-proxy

Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/host-screenshot-collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- .github/workflows/host-screenshot-collector.yml
workflow_dispatch:

permissions:
contents: read

concurrency:
group: host-screenshot-collector-${{ github.ref }}
cancel-in-progress: false
Expand All @@ -18,14 +21,20 @@ env:
jobs:
build-and-sync:
name: Build and Sync to Convex
# This job publishes to Convex with the electron environment secret. A
# manual run must use the protected main revision, never branch code.
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: electron
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.3.0
with:
ref: ${{ github.sha }}
persist-credentials: false

- name: Setup Bun
uses: oven-sh/setup-bun@v2
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.2.21

Expand Down
Loading
Loading