Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
67 changes: 60 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ jobs:
# 并在判定为发布改动时就地校验 changelog 与版本号;其余 PR 照旧跑全量测试。
classify:
name: Classify changes
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
outputs:
release_only: ${{ steps.check.outputs.release_only }}
Expand All @@ -105,11 +104,17 @@ jobs:
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: python3 script/release_pr.py check
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
python3 script/release_pr.py check
else
# 非 PR 事件也必须产生成功输出;否则 needs 此 job 的矩阵会被整体跳过。
echo "release_only=false" >> "$GITHUB_OUTPUT"
fi

# PR 快车道:Linux 跑完整 `cargo test --all`;macOS / Windows 只编译
# (`cargo check --workspace --all-targets`,含测试目标)不链接、不跑测试,
# 平台相关的编译问题仍然会在 PR 阶段暴露。完整三平台测试在 push main
# PR 快车道:Linux 跑完整 `cargo test --all`;macOS / Windows 的 workspace
# 只做 `cargo check --workspace --all-targets`(含测试目标),不链接、不跑测试;
# Windows 额外定向运行真实内嵌 X11 lib 测试。完整三平台测试在 push main
# 与 workflow_dispatch 时执行。
test:
name: Test (${{ matrix.platform }}, ${{ matrix.target }})
Expand All @@ -122,6 +127,38 @@ jobs:
runs-on: ${{ matrix.run_on }}
steps:
- uses: actions/checkout@v7
- name: Set up Python for Windows X11 component
if: ${{ matrix.platform == 'windows' }}
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Prepare embedded Windows X11 component
id: x11-component
if: ${{ matrix.platform == 'windows' }}
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$archive = Join-Path $env:RUNNER_TEMP "navop-x11-windows-x86_64.zip"
# PowerShell 不默认暴露 Git for Windows 的 usr\bin;只在本 step
# 补上其中的 OpenSSL,避免依赖 runner 的偶然 PATH,也不改写全局 PATH。
$gitOpenSsl = Join-Path $env:ProgramFiles "Git\usr\bin\openssl.exe"
if (Test-Path -LiteralPath $gitOpenSsl -PathType Leaf) {
$env:Path = "$(Split-Path -Parent $gitOpenSsl);$env:Path"
}
Get-Command python -ErrorAction Stop | Out-Null
Get-Command openssl -ErrorAction Stop | Out-Null
python --version
openssl version
python script/prepare-windows-x11-component.py `
--target windows-x86_64 `
--output $archive
if ($LASTEXITCODE -ne 0) {
throw "Windows X11 component preparation failed with exit code $LASTEXITCODE"
}
if (-not (Test-Path -LiteralPath $archive -PathType Leaf)) {
throw "Prepared Windows X11 component is missing: '$archive'"
}
"archive=$archive" >> $env:GITHUB_OUTPUT
# gpui 单个 crate 的 rustc 命令行在 Windows 上约 35K 字符(大量
# `--extern` / `-L dependency` 长路径),超过 CreateProcess 的 32,767
# 上限;sccache 冷编译时会以 `os error 206` 失败。把 target 目录换到
Expand Down Expand Up @@ -225,11 +262,27 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
# PR 快车道:macOS / Windows 只编译(含测试目标),不链接、不跑测试。
# 完整测试仍在 Linux 以及 push main / 手动触发时跑三平台。
# PR 快车道:macOS / Windows 的 workspace 只编译(含测试目标),不链接、不跑测试。
# 完整测试仍在 Linux 以及 push main / 手动触发时跑三平台;X11 定向 lib 测试例外见下。
- name: Check the workspace (PR fast lane)
if: ${{ github.event_name == 'pull_request' && matrix.platform != 'linux' }}
run: cargo check --workspace --all-targets
# 只给 lib 测试注入真实组件:它同时编译内嵌构建并运行
# configured_archive_matches_its_pinned_manifest,验证 SHA256 + Ed25519。
# 后续 workspace check / test-windows.ps1 不继承该 env;普通测试不访问组件网络。
- name: Test Windows X11 component with real embedded archive
if: ${{ matrix.platform == 'windows' }}
shell: pwsh
env:
NAVOP_X11_BUNDLED_ARCHIVE: ${{ steps.x11-component.outputs.archive }}
run: |
if ([string]::IsNullOrWhiteSpace($env:NAVOP_X11_BUNDLED_ARCHIVE)) {
throw "NAVOP_X11_BUNDLED_ARCHIVE is missing"
}
cargo test --locked -p x11_component --lib --target ${{ matrix.target }}
if ($LASTEXITCODE -ne 0) {
throw "Embedded x11_component lib tests failed with exit code $LASTEXITCODE"
}
- name: Test Windows
if: ${{ matrix.platform == 'windows' && github.event_name != 'pull_request' }}
shell: pwsh
Expand Down
106 changes: 92 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,25 @@ jobs:
# 资产名({binary}-{target}.tar.gz|.zip),bundle_name 是 macOS
# .app 目录名,portable_marker 是便携版标记文件名。全量与独立
# 产品同 tag 发布,公开产物名统一 {product}-{version}-{label}。
macos_arm64='{"target":"aarch64-apple-darwin","os":"macos-latest","product":"navop","binary":"navop","archive":"navop-aarch64-apple-darwin.tar.gz","public_label":"macos-arm64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":false}'
macos_x64='{"target":"x86_64-apple-darwin","os":"macos-15-intel","product":"navop","binary":"navop","archive":"navop-x86_64-apple-darwin.tar.gz","public_label":"macos-x64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":false}'
linux_x64='{"target":"x86_64-unknown-linux-gnu","os":"ubuntu-latest","product":"navop","binary":"navop","archive":"navop-x86_64-unknown-linux-gnu.tar.gz","public_label":"linux-x64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":false}'
linux_arm64='{"target":"aarch64-unknown-linux-gnu","os":"ubuntu-24.04-arm","product":"navop","binary":"navop","archive":"navop-aarch64-unknown-linux-gnu.tar.gz","public_label":"linux-arm64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":true,"windows_native_rdp":false}'
windows_x64='{"target":"x86_64-pc-windows-msvc","os":"windows-latest","product":"navop","binary":"navop.exe","archive":"navop-x86_64-pc-windows-msvc.zip","public_label":"windows-x64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":true,"windows_arch":"x64"}'
windows_x86='{"target":"i686-pc-windows-msvc","os":"windows-latest","product":"navop","binary":"navop.exe","archive":"navop-i686-pc-windows-msvc.zip","public_label":"win32","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":true,"windows_arch":"x86"}'
macos_arm64='{"target":"aarch64-apple-darwin","os":"macos-latest","product":"navop","binary":"navop","archive":"navop-aarch64-apple-darwin.tar.gz","public_label":"macos-arm64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
macos_x64='{"target":"x86_64-apple-darwin","os":"macos-15-intel","product":"navop","binary":"navop","archive":"navop-x86_64-apple-darwin.tar.gz","public_label":"macos-x64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
linux_x64='{"target":"x86_64-unknown-linux-gnu","os":"ubuntu-latest","product":"navop","binary":"navop","archive":"navop-x86_64-unknown-linux-gnu.tar.gz","public_label":"linux-x64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
linux_arm64='{"target":"aarch64-unknown-linux-gnu","os":"ubuntu-24.04-arm","product":"navop","binary":"navop","archive":"navop-aarch64-unknown-linux-gnu.tar.gz","public_label":"linux-arm64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":true,"windows_native_rdp":false,"x11_target":""}'
windows_x64='{"target":"x86_64-pc-windows-msvc","os":"windows-latest","product":"navop","binary":"navop.exe","archive":"navop-x86_64-pc-windows-msvc.zip","public_label":"windows-x64","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":true,"windows_arch":"x64","x11_target":"windows-x86_64"}'
# i686 明确不内嵌;空 x11_target 同时保证不注入 bundle env。
windows_x86='{"target":"i686-pc-windows-msvc","os":"windows-latest","product":"navop","binary":"navop.exe","archive":"navop-i686-pc-windows-msvc.zip","public_label":"win32","bundle_name":"Navop","portable_marker":"navop.portable","arm_linux":false,"windows_native_rdp":true,"windows_arch":"x86","x11_target":""}'
# 独立产品只覆盖主力平台(无 linux-arm64 / win32),对齐原
# standalone-products.yml 的平台面;win32 的 shell-plugins 依赖
# 仅支持 64 位,等独立产品需要 32 位时再单独评估。
shell_macos_arm64='{"target":"aarch64-apple-darwin","os":"macos-latest","product":"navop-shell","binary":"navop-shell","archive":"navop-shell-aarch64-apple-darwin.tar.gz","public_label":"macos-arm64","bundle_name":"Navop Shell","portable_marker":"navop-shell.portable","arm_linux":false,"windows_native_rdp":false}'
shell_macos_x64='{"target":"x86_64-apple-darwin","os":"macos-15-intel","product":"navop-shell","binary":"navop-shell","archive":"navop-shell-x86_64-apple-darwin.tar.gz","public_label":"macos-x64","bundle_name":"Navop Shell","portable_marker":"navop-shell.portable","arm_linux":false,"windows_native_rdp":false}'
shell_linux_x64='{"target":"x86_64-unknown-linux-gnu","os":"ubuntu-latest","product":"navop-shell","binary":"navop-shell","archive":"navop-shell-x86_64-unknown-linux-gnu.tar.gz","public_label":"linux-x64","bundle_name":"Navop Shell","portable_marker":"navop-shell.portable","arm_linux":false,"windows_native_rdp":false}'
shell_windows_x64='{"target":"x86_64-pc-windows-msvc","os":"windows-latest","product":"navop-shell","binary":"navop-shell.exe","archive":"navop-shell-x86_64-pc-windows-msvc.zip","public_label":"windows-x64","bundle_name":"Navop Shell","portable_marker":"navop-shell.portable","arm_linux":false,"windows_native_rdp":true,"windows_arch":"x64"}'
data_macos_arm64='{"target":"aarch64-apple-darwin","os":"macos-latest","product":"navop-data","binary":"navop-data","archive":"navop-data-aarch64-apple-darwin.tar.gz","public_label":"macos-arm64","bundle_name":"Navop Data","portable_marker":"navop-data.portable","arm_linux":false,"windows_native_rdp":false}'
data_macos_x64='{"target":"x86_64-apple-darwin","os":"macos-15-intel","product":"navop-data","binary":"navop-data","archive":"navop-data-x86_64-apple-darwin.tar.gz","public_label":"macos-x64","bundle_name":"Navop Data","portable_marker":"navop-data.portable","arm_linux":false,"windows_native_rdp":false}'
data_linux_x64='{"target":"x86_64-unknown-linux-gnu","os":"ubuntu-latest","product":"navop-data","binary":"navop-data","archive":"navop-data-x86_64-unknown-linux-gnu.tar.gz","public_label":"linux-x64","bundle_name":"Navop Data","portable_marker":"navop-data.portable","arm_linux":false,"windows_native_rdp":false}'
data_windows_x64='{"target":"x86_64-pc-windows-msvc","os":"windows-latest","product":"navop-data","binary":"navop-data.exe","archive":"navop-data-x86_64-pc-windows-msvc.zip","public_label":"windows-x64","bundle_name":"Navop Data","portable_marker":"navop-data.portable","arm_linux":false,"windows_native_rdp":true,"windows_arch":"x64"}'
shell_macos_arm64='{"target":"aarch64-apple-darwin","os":"macos-latest","product":"navop-shell","binary":"navop-shell","archive":"navop-shell-aarch64-apple-darwin.tar.gz","public_label":"macos-arm64","bundle_name":"Navop Shell","portable_marker":"navop-shell.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
shell_macos_x64='{"target":"x86_64-apple-darwin","os":"macos-15-intel","product":"navop-shell","binary":"navop-shell","archive":"navop-shell-x86_64-apple-darwin.tar.gz","public_label":"macos-x64","bundle_name":"Navop Shell","portable_marker":"navop-shell.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
shell_linux_x64='{"target":"x86_64-unknown-linux-gnu","os":"ubuntu-latest","product":"navop-shell","binary":"navop-shell","archive":"navop-shell-x86_64-unknown-linux-gnu.tar.gz","public_label":"linux-x64","bundle_name":"Navop Shell","portable_marker":"navop-shell.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
shell_windows_x64='{"target":"x86_64-pc-windows-msvc","os":"windows-latest","product":"navop-shell","binary":"navop-shell.exe","archive":"navop-shell-x86_64-pc-windows-msvc.zip","public_label":"windows-x64","bundle_name":"Navop Shell","portable_marker":"navop-shell.portable","arm_linux":false,"windows_native_rdp":true,"windows_arch":"x64","x11_target":"windows-x86_64"}'
data_macos_arm64='{"target":"aarch64-apple-darwin","os":"macos-latest","product":"navop-data","binary":"navop-data","archive":"navop-data-aarch64-apple-darwin.tar.gz","public_label":"macos-arm64","bundle_name":"Navop Data","portable_marker":"navop-data.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
data_macos_x64='{"target":"x86_64-apple-darwin","os":"macos-15-intel","product":"navop-data","binary":"navop-data","archive":"navop-data-x86_64-apple-darwin.tar.gz","public_label":"macos-x64","bundle_name":"Navop Data","portable_marker":"navop-data.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
data_linux_x64='{"target":"x86_64-unknown-linux-gnu","os":"ubuntu-latest","product":"navop-data","binary":"navop-data","archive":"navop-data-x86_64-unknown-linux-gnu.tar.gz","public_label":"linux-x64","bundle_name":"Navop Data","portable_marker":"navop-data.portable","arm_linux":false,"windows_native_rdp":false,"x11_target":""}'
# standalone-data 与 full i686 不准备、不内嵌;使用内置 X11 时明确失败,无网络回退。
data_windows_x64='{"target":"x86_64-pc-windows-msvc","os":"windows-latest","product":"navop-data","binary":"navop-data.exe","archive":"navop-data-x86_64-pc-windows-msvc.zip","public_label":"windows-x64","bundle_name":"Navop Data","portable_marker":"navop-data.portable","arm_linux":false,"windows_native_rdp":true,"windows_arch":"x64","x11_target":""}'

case "$RELEASE_PLATFORM" in
all)
Expand Down Expand Up @@ -369,6 +371,45 @@ jobs:
"$RUNNER_TEMP/ziglang/bin/python" -m ziglang version
cargo-zigbuild --version

- name: Set up Python for embedded Windows X11 component
if: runner.os == 'Windows' && matrix.x11_target != ''
uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Prepare embedded Windows X11 component
id: x11-component
if: runner.os == 'Windows' && matrix.x11_target != ''
shell: pwsh
env:
X11_TARGET: ${{ matrix.x11_target }}
run: |
$ErrorActionPreference = "Stop"
if ($env:X11_TARGET -ne "windows-x86_64") {
throw "Unexpected Windows X11 release target: '$env:X11_TARGET'"
}
$archive = Join-Path $env:RUNNER_TEMP "navop-x11-$env:X11_TARGET.zip"
# 只在本 step 暴露 Git for Windows 自带的 OpenSSL;不写 GITHUB_PATH,
# 不改变后续 Cargo / RDP probe 的工具解析顺序。
$gitOpenSsl = Join-Path $env:ProgramFiles "Git\usr\bin\openssl.exe"
if (Test-Path -LiteralPath $gitOpenSsl -PathType Leaf) {
$env:Path = "$(Split-Path -Parent $gitOpenSsl);$env:Path"
}
Get-Command python -ErrorAction Stop | Out-Null
Get-Command openssl -ErrorAction Stop | Out-Null
python --version
openssl version
python script/prepare-windows-x11-component.py `
--target $env:X11_TARGET `
--output $archive
if ($LASTEXITCODE -ne 0) {
throw "Windows X11 component preparation failed with exit code $LASTEXITCODE"
}
if (-not (Test-Path -LiteralPath $archive -PathType Leaf)) {
throw "Prepared Windows X11 component is missing: '$archive'"
}
"archive=$archive" >> $env:GITHUB_OUTPUT

- name: Configure MSVC environment
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
Expand Down Expand Up @@ -477,7 +518,13 @@ jobs:
NAVOP_PUBLIC_BASE_URL: ${{ vars.NAVOP_PUBLIC_BASE_URL }}
NAVOP_WEBSITE_BASE_URL: ${{ vars.NAVOP_WEBSITE_BASE_URL }}
ONETCLI_TEAM_MANAGEMENT_URL_TEMPLATE: ${{ vars.ONETCLI_TEAM_MANAGEMENT_URL_TEMPLATE }}
# 非内嵌矩阵项的 output 不存在,表达式得到空字符串;下一步立即清除,
# 使 build.rs 看到“变量缺失”而不是会报错的空路径。
NAVOP_X11_BUNDLED_ARCHIVE: ${{ steps.x11-component.outputs.archive }}
run: |
if ([string]::IsNullOrWhiteSpace($env:NAVOP_X11_BUNDLED_ARCHIVE)) {
Remove-Item Env:NAVOP_X11_BUNDLED_ARCHIVE -ErrorAction SilentlyContinue
}
if ([string]::IsNullOrWhiteSpace($env:VCToolsInstallDir)) {
throw "VCToolsInstallDir is not configured"
}
Expand Down Expand Up @@ -537,6 +584,37 @@ jobs:
throw "Release binary was not created: '$binary'"
}

- name: Verify embedded X11 archive in release binary
if: runner.os == 'Windows' && matrix.x11_target != ''
shell: pwsh
env:
NAVOP_X11_BUNDLED_ARCHIVE: ${{ steps.x11-component.outputs.archive }}
RELEASE_BINARY: target/${{ matrix.target }}/release/${{ matrix.binary }}
run: |
if ([string]::IsNullOrWhiteSpace($env:NAVOP_X11_BUNDLED_ARCHIVE)) {
throw "NAVOP_X11_BUNDLED_ARCHIVE is missing"
}
# 只读取 Windows 本地产物,不执行其中任何二进制。完整 zip 字节必须
# 出现在 exe 中,直接排除 build.rs 静默生成空占位或漏嵌的情况。
@'
from pathlib import Path
import hashlib
import os

archive = Path(os.environ["NAVOP_X11_BUNDLED_ARCHIVE"])
binary = Path(os.environ["RELEASE_BINARY"])
payload = archive.read_bytes()
executable = binary.read_bytes()
if not payload:
raise SystemExit("Prepared X11 archive is empty")
if payload not in executable:
raise SystemExit(f"Embedded X11 archive was not found in {binary}")
print(
f"Verified embedded X11 archive in {binary}: "
f"{len(payload)} bytes, sha256={hashlib.sha256(payload).hexdigest()}"
)
'@ | python -

- name: Validate Windows executable manifest
if: runner.os == 'Windows'
shell: pwsh
Expand Down
Loading
Loading