CI never creates or destroys environments. A developer provisions the
environment once. CI only creates and removes workspaces.
Why Use RMUX for CI
RMUX workspaces skip the setup tax that ephemeral CI runners pay on every run:| Step | GitHub runner | RMUX workspace |
|---|---|---|
| Checkout repo | ~15s | ~5s (git worktree) |
| Install dependencies | 60-120s (cold) | 10-20s (warm cache) |
| Start services (Docker Compose) | 120-300s (pull images) | 0s (already running) |
| DB migrations / seed | 30-60s | 0s (already done) |
| Total setup | 3-8 min | ~15-30s |
- Your project has a complex dev environment (Docker Compose stacks, databases, GPUs)
- Environment setup time dominates test execution time
- You need VPC access or internal services that runners can’t reach
- You want dev/CI parity (tests run in the same environment developers use)
Setup
Create a CI token
Create a service token for the CI runner. This only needs to happen once.Copy the token value for the next step.
Add GitHub secrets
In your repo settings, add two secrets:
The environment must already be provisioned and in
| Secret | Value |
|---|---|
RMUX_CI_TOKEN | The token from step 1 |
RMUX_ENVIRONMENT | Environment name (e.g. my-project) or ID (e.g. env_abc123) |
ready state.Example Workflow
.github/workflows/test.yml
workspace new creates a git worktree on the remote environment. Multiple
PRs can run concurrently since each workspace is isolated at the filesystem
level.
Environment Resolution
Workspace commands resolve the target environment in this order:--envflag (explicit override)RMUX_ENVIRONMENTenv var.rmux/state.jsondirectory binding (local dev)
RMUX_ENVIRONMENT once in the
workflow env block and all workspace commands pick it up.
You can also override per-command:
env_*) are accepted.
Cleaning Up Stale Workspaces
If a CI runner is killed or GitHub has an outage, the cleanup step may not run. Useworkspace prune to remove orphaned workspaces.
Manual prune
Scheduled prune
Add a cron workflow to your repository:.github/workflows/prune.yml
Prune options
| Option | Description |
|---|---|
--prefix <prefix> | Only prune workspaces whose name starts with this prefix |
--stale <duration> | Only prune workspaces idle longer than this duration (30s, 5m, 2h, 1d) |
--dry-run | List candidates without deleting |
-f, --force | Skip the confirmation prompt (required in non-TTY / CI) |
Concurrency
Multiple CI workspaces share a single VM. They are isolated at the filesystem level (separate git worktrees) but share CPU, memory, disk, and the Docker daemon. Shared resources can be an advantage: Docker layer caches,node_modules
caches, and pre-started services are available to all workspaces without
redundant setup.
If concurrent CI runs overwhelm the VM, size the environment appropriately or
use GitHub Actions concurrency groups to limit parallel runs.