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
60 changes: 60 additions & 0 deletions .github/workflows/desktop-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,65 @@ jobs:
working-directory: desktop
run: node scripts/prepare-bundle.mjs

- name: Install pinned uv for local-server dependency validation
if: ${{ matrix.prepare_payload }}
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: "0.11.30"
enable-cache: false

- name: Resolve Windows local-server dependencies
if: matrix.os == 'windows-latest'
working-directory: desktop
shell: pwsh
run: |
uv pip install `
--dry-run `
--target "$env:RUNNER_TEMP\hugagent-deps-windows" `
--python-version 3.11 `
--python-platform x86_64-pc-windows-msvc `
--requirements generated/server-ce/requirements.txt `
--requirements generated/server-ce/requirements-mem0.txt `
--requirements generated/server-ce/docker/requirements-script-runner.txt `
"protobuf<7" `
"pymilvus==2.5.18" `
"milvus-lite==3.1.0"

- name: Validate macOS bootstrap on the native shell
if: matrix.os == 'macos-latest'
working-directory: desktop
run: npm run test:scripts

- name: Resolve macOS 12 compatible local-server dependencies
if: matrix.os == 'macos-latest'
working-directory: desktop
run: |
uv --system-certs pip install \
--dry-run \
--target "$RUNNER_TEMP/hugagent-deps-arm64" \
--python-version 3.11 \
--python-platform aarch64-apple-darwin \
--requirements generated/server-ce/requirements.txt \
--requirements generated/server-ce/requirements-mem0.txt \
--requirements generated/server-ce/docker/requirements-script-runner.txt \
--overrides resources/server-bootstrap/requirements-macos-overrides.txt \
--only-binary pikepdf \
"protobuf<7" \
"pymilvus==2.5.18" \
"milvus-lite==3.1.0"
uv --system-certs pip install \
--dry-run \
--target "$RUNNER_TEMP/hugagent-deps-x86_64" \
--python-version 3.11 \
--python-platform x86_64-apple-darwin \
--requirements generated/server-ce/requirements.txt \
--requirements generated/server-ce/requirements-mem0.txt \
--requirements generated/server-ce/docker/requirements-script-runner.txt \
--overrides resources/server-bootstrap/requirements-macos-overrides.txt \
--only-binary pikepdf \
"protobuf<7" \
"pymilvus==2.5.18" \
"milvus-lite==3.1.0"

- name: Run desktop Rust tests
run: cargo test --manifest-path desktop/src-tauri/Cargo.toml
21 changes: 11 additions & 10 deletions .github/workflows/desktop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
# TAURI_SIGNING_PRIVATE_KEY_PASSWORD
#
# To cut a release:
# 1. Keep desktop/package.json, desktop/src-tauri/Cargo.toml, and
# desktop/src-tauri/tauri.conf.json on the same version.
# 2. Push or dispatch exactly `desktop-vX.Y.Z` for that version.
# 1. Run `npm --prefix desktop run version:desktop -- X.Y.Z` and commit the
# synchronized version files.
# 2. Push `desktop-vX.Y.Z`, or manually dispatch this workflow from that commit;
# manual runs derive the release tag from the committed desktop version.
# 3. Review the draft release after every platform succeeds, then publish it.

name: Desktop Release
Expand All @@ -23,21 +24,20 @@ on:
tags:
- "desktop-v*"
workflow_dispatch:
inputs:
tag:
description: "Release tag; must match the desktop version (for example, desktop-v0.2.1)"
required: true

permissions:
contents: read

concurrency:
group: desktop-release-${{ github.event.inputs.tag || github.ref_name }}
group: desktop-release-${{ github.ref }}
cancel-in-progress: false

jobs:
validate-release:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.desktop_version.outputs.version }}
release_tag: ${{ steps.desktop_version.outputs.release_tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -52,8 +52,9 @@ jobs:
run: npm run test:scripts

- name: Validate release tag and desktop versions
id: desktop_version
env:
RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }}
RELEASE_TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
run: node desktop/scripts/validate-release-version.mjs "$RELEASE_TAG"

build:
Expand Down Expand Up @@ -138,7 +139,7 @@ jobs:
NODE_OPTIONS: "--max-old-space-size=4096"
with:
projectPath: desktop
tagName: ${{ github.event.inputs.tag || github.ref_name }}
tagName: ${{ needs.validate-release.outputs.release_tag }}
releaseName: "HugAgentOS Desktop __VERSION__"
releaseBody: "Download the installer for your platform below. See the docs for setup."
releaseDraft: true
Expand Down
4 changes: 2 additions & 2 deletions desktop/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "hugagent-desktop",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"description": "HugAgentOS 桌面客户端(远程连接 + Windows/macOS 无 Docker 本机服务)",
"scripts": {
"tauri": "tauri",
"dev": "tauri dev",
"build": "tauri build",
"test:scripts": "node --test scripts/*.test.mjs"
"test:scripts": "node --test scripts/*.test.mjs",
"version:desktop": "node scripts/set-desktop-version.mjs"
},
"devDependencies": {
"@tauri-apps/cli": "^2"
Expand Down
72 changes: 71 additions & 1 deletion desktop/resources/server-bootstrap/install-local-server.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,46 @@ function Resolve-Node {
return $null
}

function Resolve-Bash {
$Candidates = @(
(Join-Path $env:ProgramFiles "Git\bin\bash.exe"),
(Join-Path ${env:ProgramFiles(x86)} "Git\bin\bash.exe"),
(Join-Path $env:LOCALAPPDATA "Programs\Git\bin\bash.exe")
)
$WinGetPackages = Join-Path $env:LOCALAPPDATA "Microsoft\WinGet\Packages"
if (Test-Path $WinGetPackages) {
Get-ChildItem $WinGetPackages -Filter "bash.exe" -Recurse -ErrorAction SilentlyContinue | ForEach-Object {
if ($_.FullName -like "*Git*\bin\bash.exe") {
$Candidates += $_.FullName
}
}
}
foreach ($Candidate in $Candidates | Select-Object -Unique) {
if ($Candidate -and (Test-Path $Candidate)) {
try {
& $Candidate --version 2>$null | Out-Null
if ($LASTEXITCODE -eq 0) {
return $Candidate
}
}
catch {
# Try the next native Git Bash candidate.
}
}
}
return $null
}

if (-not (Test-Path (Join-Path $BundleDir "pyproject.toml"))) {
throw "The desktop package doesn't contain a valid CE server payload."
}
if (-not (Test-Path (Join-Path $BundleDir "src\frontend\dist\index.html"))) {
throw "The bundled CE web application is missing."
}
$MemoryRequirements = Join-Path $BundleDir "requirements-mem0.txt"
if (-not (Test-Path $MemoryRequirements)) {
throw "The desktop package doesn't contain the persistent-memory dependencies."
}

New-Item -ItemType Directory -Path $InstallRoot -Force | Out-Null
$SourceDir = Join-Path $InstallRoot "source"
Expand Down Expand Up @@ -170,13 +204,49 @@ Invoke-Checked $VenvPython @(
"-r", (Join-Path $SourceDir "requirements.txt")
) "Unable to install the server dependencies"

Write-ProgressLine 58 "正在安装永久记忆运行环境…"
Invoke-Checked $VenvPython @(
"-m", "pip", "install", "--disable-pip-version-check", "--prefer-binary", "--upgrade",
"-r", (Join-Path $SourceDir "requirements-mem0.txt"),
"protobuf<7", "pymilvus==2.5.18", "milvus-lite==3.1.0"
) "Unable to install the persistent-memory dependencies"

Write-ProgressLine 70 "正在安装本机脚本与文档处理能力…"
Invoke-Checked $VenvPython @(
"-m", "pip", "install", "--disable-pip-version-check", "--prefer-binary",
"-r", (Join-Path $SourceDir "docker\requirements-script-runner.txt")
) "Unable to install the local tool dependencies"

Write-ProgressLine 77 "正在准备可选的 Node.js 文档能力…"
Write-ProgressLine 75 "正在准备本机 Bash 脚本能力…"
$BashExecutableFile = Join-Path $InstallRoot "bash-executable.txt"
$Bash = Resolve-Bash
if (-not $Bash) {
$Winget = Get-Command "winget.exe" -ErrorAction SilentlyContinue
if ($Winget) {
try {
Invoke-Checked $Winget.Source @(
"install", "--id", "Git.Git", "--exact", "--scope", "user", "--silent",
"--accept-package-agreements", "--accept-source-agreements", "--disable-interactivity"
) "Unable to install Git Bash with winget"
$Bash = Resolve-Bash
}
catch {
Write-Warning "Git Bash couldn't be installed automatically. Python and JavaScript still work; Bash scripts remain unavailable. $($_.Exception.Message)"
}
}
}
if ($Bash) {
[System.IO.File]::WriteAllText(
$BashExecutableFile,
[string]$Bash,
[System.Text.UTF8Encoding]::new($false)
)
}
elseif (Test-Path $BashExecutableFile) {
Remove-Item $BashExecutableFile -Force
}

Write-ProgressLine 78 "正在准备可选的 Node.js 文档能力…"
$NodeExecutableFile = Join-Path $InstallRoot "node-executable.txt"
$Node = Resolve-Node
if (-not $Node) {
Expand Down
Loading
Loading