跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.devinenterprise.com/llms.txt

Use this file to discover all available pages before exploring further.

Devin 支持将 Windows 用作构建和会话平台。Windows 环境与 Linux 一样使用 bash shell (Git Bash) ,因此大多数蓝图命令无需修改即可在这两个平台上运行。
Windows 支持目前仅面向有限用户开放。如果你有兴趣试用 Devin 的 Windows 支持,请联系我们了解更多信息并获取访问权限。

工作原理

Windows 支持与 Linux 一样,基于同一套声明式配置系统。关键区别在于蓝图中的 runs-on 字段,它会告诉 Devin 在哪个平台上构建和运行。 由于两个平台都使用 bash,你可以在 Linux 和 Windows 上编写相同的 shell 命令。主要区别在于文件系统结构以及可用的包管理器:
方面Linux (默认)Windows
主目录/home/ubuntu/c/Users/Administrator
代码仓库目录~/repos/<repo-name>/c/Users/Administrator/repos/<repo-name>
包管理器apt-getchocowinget 或直接下载安装程序

Windows 蓝图编写

单平台蓝图

如果你的代码仓库仅针对 Windows,请在顶层使用 runs-on: windows
runs-on: windows

initialize:
  - name: "Install Node.js"
    uses: github.com/actions/setup-node@v4
    with:
      node-version: "20"

  - name: "Install build tools"
    run: |
      choco install visualstudio2022buildtools -y
      choco install python --version=3.12 -y

maintenance: |
  npm install

knowledge:
  - name: lint
    contents: npm run lint
  - name: test
    contents: npm test
  - name: build
    contents: npm run build

多平台蓝图

要同时为 Linux 和 Windows 构建同一代码仓库,请使用多块 YAML 格式。每个块都会声明各自的 runs-on 标签:
- runs-on: default
  initialize: |
    curl -LsSf https://astral.sh/uv/install.sh | sh
    apt-get update && apt-get install -y build-essential

  maintenance: |
    uv sync

  knowledge:
    - name: test
      contents: uv run pytest

- runs-on: windows
  initialize: |
    choco install python --version=3.12 -y

  maintenance: |
    uv sync

  knowledge:
    - name: test
      contents: uv run pytest
每个块都会为对应平台生成单独的快照构建。会话将从对应平台的快照启动。

runs-on 字段

runs-on 字段对应于你账户中已注册的一项机器配置:
平台
default or linuxLinux (默认平台)
windowsWindows
你可以将 runs-on 指定为字符串或列表:
# 单个平台
runs-on: windows

# 在同一块中指定多个平台(每个平台运行相同的命令)
runs-on: [default, windows]
当一个块列出多个平台时,构建系统会使用相同的命令,为每个平台创建一个快照。
列表语法会在列表中的每个平台上运行完全相同的命令。只有在命令确实支持跨平台时才应使用它 (例如 npm installuv sync) 。对于平台专用命令 (例如 Linux 上的 apt-get 或 Windows 上的 choco) ,请改用多块格式——每个平台对应一个块。

Windows 会话的行为

Shell

Windows 会话默认使用 Git Bash 作为 shell,也就是 Linux 上使用的同一种 bash shell。标准 bash 语法在两个平台上都通用:
- run: |
    export MY_VAR="hello"
    echo $MY_VAR

路径

Windows 使用 Git Bash 的路径格式 (/c/...,而不是 C:\...) :
# Linux 路径
- run: cp config.json ~/.config/myapp/config.json

# Windows 路径(Git Bash 格式)
- run: cp config.json /c/Users/Administrator/.config/myapp/config.json

Secrets

在会话期间,可通过标准 bash 语法 ($SECRET_NAME) 以环境变量的形式使用 Secrets:
maintenance:
  - name: "Configure registry"
    run: |
      npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN

文件附件

在 Windows 上,上传的文件会保存到 /c/Users/Administrator/.files/,而不是 /home/ubuntu/.files/

适用于 Windows 的蓝图提示

安装工具

使用 choco (Chocolatey) 、winget 或直接下载脚本:
initialize:
  - name: "Install Chocolatey packages"
    run: |
      choco install git -y
      choco install nodejs-lts -y
      choco install python --version=3.12 -y

  - name: "Install with winget"
    run: |
      winget install --id Microsoft.DotNet.SDK.8 --accept-source-agreements --accept-package-agreements

常见模式

.NET 项目:
runs-on: windows

initialize:
  - name: "Install .NET SDK"
    run: |
      winget install --id Microsoft.DotNet.SDK.8 --accept-source-agreements --accept-package-agreements

maintenance: |
  dotnet restore

knowledge:
  - name: build
    contents: dotnet build
  - name: test
    contents: dotnet test
  - name: lint
    contents: dotnet format --verify-no-changes
Visual Studio / C++ 项目:
runs-on: windows

initialize:
  - name: "Install Visual Studio Build Tools"
    run: |
      choco install visualstudio2022buildtools -y
      choco install visualstudio2022-workload-vctools -y

maintenance: |
  msbuild /t:Restore MySolution.sln

knowledge:
  - name: build
    contents: msbuild MySolution.sln /p:Configuration=Release
  - name: test
    contents: vstest.console.exe bin/Release/Tests.dll