GitHub Actions runner as a schedulable Python sandbox via WebSocket remote objects
Project description
WorkflowVM
将 GitHub Actions 免费 Ubuntu runner 作为可调度 Python 沙盒,通过 WebSocket 远程对象协议从服务器端透明操作远程 Python 环境。
快速开始
1. 配置账号池
编辑 accounts.yml:
accounts:
- username: your-github-username
token: ghp_YOUR_CLASSIC_PAT # 需要 repo + workflow scope
runner_repo: wvm-runner
max_concurrent: 5
server:
host: 0.0.0.0
port: 8765
api_token: "your-server-api-token"
2. 初始化 runner repo(自动)
workflowvm setup --config accounts.yml
setup 命令会自动为 accounts.yml 中的每个账号创建 runner repo(若不存在)并推送 workflow 文件。workflowvm serve 启动时也会自动执行此初始化。
3. 启动服务器
方式 A:直接安装运行
pip install workflowvm
workflowvm serve --config accounts.yml
方式 B:Docker
mkdir config
cp accounts.yml config/
# 将 docker-compose.yml 中的 OWNER 替换为你的 GitHub 用户名
docker compose up -d
4. 使用 SDK
import sys; sys.path.insert(0, '.')
import workflowvm
ctrl = workflowvm.Controller(
"wss://your-server:8765",
token="your-server-api-token",
config_path="accounts.yml",
)
vm = ctrl.acquire(timeout=120, max_duration=300)
# 透明远程对象操作
vm.os = vm.__import__("os")
print(vm.os.system("whoami")) # 在 GitHub Actions runner 上执行
f = vm.open("/etc/hostname")
content = f.read()
print(vm._repr(content)) # → 'runner-hostname\n'
vm.release()
Classic PAT 权限
在 GitHub Settings → Developer settings → Personal access tokens → Generate new token (classic) 中勾选:
repo- 完整仓库访问workflow- 触发 workflow_dispatch(必需)
架构
SDK (调用方)
└─ Controller.acquire() → RemoteVM
└─ 服务器 (WebSocket server + 账号池 + 实例池)
└─ GitHub API workflow_dispatch
└─ GitHub Actions Ubuntu runner
└─ agent.py → 反连 WebSocket
测试
pytest tests/ -v
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file workflowvm-0.2.1.tar.gz.
File metadata
- Download URL: workflowvm-0.2.1.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3e8ea07b37b956b955f54a0304bcea073e49515f7852a7f043504a6360407be
|
|
| MD5 |
3792e2285851d9ed25909200052b5505
|
|
| BLAKE2b-256 |
f8edc6a4cf69abd169cd02806d25aee5bbf7f1a835b01a4c94c6685cb8c553c9
|
File details
Details for the file workflowvm-0.2.1-py3-none-any.whl.
File metadata
- Download URL: workflowvm-0.2.1-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80af8c27652e84436f953f4bf533337ec54f86f0f43d529db45e7ed82559e27f
|
|
| MD5 |
a3999dc9ae37d6642b626710fee14d6b
|
|
| BLAKE2b-256 |
c5428d3a4cd678f59ee71a40462cefd328e4feca90fdd52c00c9034345c82feb
|