Skip to content

A full-featured download manager.

feat(windows): add native arm64 packages for beta.52 (#2402)

Dr_rOotb7a77d297961
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 74043f65..51cc9650 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -197,6 +197,8 @@ jobs:
tests/scripts/electron-package-contract.test.ts
tests/scripts/flatpak-native-host.test.ts
tests/scripts/finalize-appimage-artifact.test.ts
+ tests/scripts/fetch-engine.test.ts
+ tests/scripts/fetch-engine-path-parity.test.ts
tests/scripts/native-binary-target.test.ts
tests/scripts/obsidian-docs.test.ts
tests/scripts/release-metadata.test.ts
@@ -212,6 +214,7 @@ jobs:
tests/scripts/docker-server-runtime.test.ts
tests/scripts/server-runtime-workflow.test.ts
tests/scripts/smoke-server-package.test.ts
+ tests/scripts/smoke-electron-cleanup.test.ts
tests/scripts/stage-server-app.test.ts
tests/scripts/verify-electron-package.test.ts
tests/scripts/verify-appimage-artifact.test.ts
@@ -219,6 +222,7 @@ jobs:
tests/scripts/verify-container-publication.test.ts
tests/scripts/verify-server-package.test.ts
tests/scripts/verify-update-artifacts.test.ts
+ tests/scripts/windows-artifact-names.test.ts
tests/scripts/workflow-release-matrix.test.ts
tests/scripts/workflow-flatpak-release.test.ts
tests/scripts/workflow-snap.test.ts
@@ -399,9 +403,17 @@ jobs:
platform: win32
arch: x64
rust_target: x86_64-pc-windows-msvc
- electron_builder_args: --win --x64
+ electron_builder_args: --win nsis zip --x64
resources_dir: release/win-unpacked/resources
app_path: release/win-unpacked
+ - target: win32-arm64
+ os: windows-11-arm
+ platform: win32
+ arch: arm64
+ rust_target: aarch64-pc-windows-msvc
+ electron_builder_args: --win nsis zip --arm64
+ resources_dir: release/win-arm64-unpacked/resources
+ app_path: release/win-arm64-unpacked
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
@@ -632,6 +644,15 @@ jobs:
}
}
+ - name: Smoke test native Windows Electron runtime
+ if: matrix.platform == 'win32'
+ run: >-
+ pnpm run smoke:electron-package --
+ --app-dir "${{ matrix.app_path }}"
+ --platform ${{ matrix.platform }}
+ --arch ${{ matrix.arch }}
+ --report "release/size-reports/${{ matrix.target }}-runtime.json"
+
- name: Verify staged Windows aria2 WebSocket contract
if: matrix.platform == 'win32'
env:
@@ -647,6 +668,6 @@ jobs:
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: electron-size-report-${{ matrix.target }}-${{ github.run_attempt }}
- path: release/size-reports/${{ matrix.target }}.json
+ path: release/size-reports/${{ matrix.target }}*.json
if-no-files-found: error
retention-days: 14
diff --git a/.github/workflows/finalize-filesystems.yml b/.github/workflows/finalize-filesystems.yml
index d92a50ab..2d2eee15 100644
--- a/.github/workflows/finalize-filesystems.yml
+++ b/.github/workflows/finalize-filesystems.yml
@@ -61,10 +61,12 @@ jobs:
env:
MATRIX_FILESYSTEM: ${{ matrix.filesystem }}
run: |
- # Formatting tools do not provide the Azure runner's kernel drivers.
- # Match the running kernel rather than installing a newer meta-package.
- sudo apt-get install --yes --no-install-recommends "linux-modules-extra-$(uname -r)"
- sudo modprobe "$MATRIX_FILESYSTEM"
+ # New kernels include these drivers in linux-modules; older kernels
+ # may need the separate extra package matching the running kernel.
+ if ! sudo modprobe "$MATRIX_FILESYSTEM"; then
+ sudo apt-get install --yes --no-install-recommends "linux-modules-extra-$(uname -r)"
+ sudo modprobe "$MATRIX_FILESYSTEM"
+ fi
- name: Build native sidecar
run: cargo build --manifest-path packages/finalize-fs/Cargo.toml --locked
- name: Test publication and recovery on a disposable volume
diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml
index 85087f01..96bb6681 100644
--- a/.github/workflows/flatpak.yml
+++ b/.github/workflows/flatpak.yml
@@ -341,7 +341,7 @@ jobs:
-path "*/native-messaging-hosts/*" \
\) -print -quit)"
output="$("$aria2c" --version)"
- printf "%s\n" "$output" | grep -qF "aria2 version 1.37.0-motrix.18"
+ printf "%s\n" "$output" | grep -qF "aria2 version 1.37.0-motrix.19"
printf "%s\n" "$output" | grep -qF "Async DNS"
printf "%s\n" "$output" | grep -qF "BitTorrent"
printf "%s\n" "$output" | grep -qF "HTTPS"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7df72a15..317b6570 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,6 +1,6 @@
# Motrix — native multi-platform build and release
#
-# A tag push builds each platform on a native runner, assembles the five
+# A tag push builds each platform on a native runner, assembles the six
# independently produced artifact sets, validates their updater metadata, and
# publishes exactly once. A manual dispatch exercises the same build and
# assembly path without signing or publishing.
@@ -17,9 +17,7 @@
# tree (src/main/platform/appimage-integration.ts). Snap has its own
# strict-confinement build and Store promotion workflows. Flatpak reuses its
# native build and installed-payload checks and joins both Linux release sets.
-# 32-bit targets remain
-# unsupported. Windows arm64 remains reserved until the aria2 lock supplies that
-# architecture.
+# 32-bit targets remain unsupported.
name: Build/Release
@@ -161,9 +159,17 @@ jobs:
platform: win32
arch: x64
rust_target: x86_64-pc-windows-msvc
- electron_builder_args: --win --x64
+ electron_builder_args: --win nsis zip --x64
resources_dir: release/win-unpacked/resources
app_path: release/win-unpacked
+ - target: win32-arm64
+ os: windows-11-arm
+ platform: win32
+ arch: arm64
+ rust_target: aarch64-pc-windows-msvc
+ electron_builder_args: --win nsis zip --arm64
+ resources_dir: release/win-arm64-unpacked/resources
+ app_path: release/win-arm64-unpacked
# rustc's musl std is self-contained; overriding the linker with Ubuntu's
# musl-gcc mixes CRTs and produces binaries that SIGSEGV at load (see
@@ -370,6 +376,15 @@ jobs:
}
}
+ - name: Smoke test native Windows Electron runtime
+ if: matrix.platform == 'win32'
+ run: >-
+ pnpm run smoke:electron-package --
+ --app-dir "${{ matrix.app_path }}"
+ --platform ${{ matrix.platform }}
+ --arch ${{ matrix.arch }}
+ --report "release/size-reports/${{ matrix.target }}-runtime.json"
+
- name: Verify staged Windows aria2 WebSocket contract
if: matrix.platform == 'win32'
env:
@@ -567,6 +582,7 @@ jobs:
release/*.tar.gz
release/latest*.yml
release/size-reports/${{ matrix.target }}.json
+ release/size-reports/${{ matrix.target }}-runtime.json
release/*.zip
if-no-files-found: error
retention-days: 7
@@ -621,10 +637,19 @@ jobs:
platform: win32
arch: x64
signing_environment: windows-release-signing
- electron_builder_args: --win --x64
+ electron_builder_args: --win nsis zip --x64
resources_dir: release/win-unpacked/resources
app_path: release/win-unpacked
electron_sha256: eee30dc8fa1f5ea95490e59f44e46ea68dd24c6e93d22facf70fe5c2d4c2665c
+ - target: win32-arm64
+ os: windows-11-arm
+ platform: win32
+ arch: arm64
+ signing_environment: windows-release-signing
+ electron_builder_args: --win nsis zip --arm64 '-c.nsis.artifactName=Motrix-Setup-${version}-arm64.exe' '-c.win.artifactName=Motrix-${version}-win-arm64.${ext}'
+ resources_dir: release/win-arm64-unpacked/resources
+ app_path: release/win-arm64-unpacked
+ electron_sha256: ee2621a4513f92a952273d5363e153db6f0e4dd183d89f2c0f740faa13623316
env:
CUSTOM_DMGBUILD_PATH: ''
ELECTRON_BUILDER_7ZIP_PATH: ''
@@ -901,7 +926,7 @@ jobs:
EXPECTED_COMMIT: ${{ github.sha }}
EXPECTED_PLATFORM: ${{ matrix.platform }}
# Updated only after reviewing the verifier source itself.
- VERIFIER_SHA256: efbb213aec76deba536afce7da0e37837ceb495c3b8510caf25f12c0e62f3eb8
+ VERIFIER_SHA256: ab62dcb67eecb1c74430dfb2460a4c464f65bca521a72c3faa590b44e175eb15
run: |
const crypto = require('node:crypto')
const fs = require('node:fs')
diff --git a/README.md b/README.md
index b014da64..d1e3c750 100644
--- a/README.md
+++ b/README.md
@@ -22,15 +22,16 @@ The same core powers two ways to run Motrix:
## 🧪 Beta testing
Motrix Turbo v2 is currently in beta. After its remaining release gates pass,
-download [v2.0.0-beta.51 from GitHub Releases](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.51)
-and read the [full release notes](./docs/release-notes/2.0.0-beta.51.md) before
+download [v2.0.0-beta.52 from GitHub Releases](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.52)
+and read the [full release notes](./docs/release-notes/2.0.0-beta.52.md) before
installing it.
Back up your existing Motrix data and downloads before testing. The desktop
Migration Assistant imports selected v1 tasks as paused records and preserves
the original files. Resuming downloads requires a separate explicit action.
-This beta bundles aria2 1.37.0-motrix.18, enabling Windows in-place BT
-activation on supported local NTFS volumes with explicit authorization. See the
+This beta adds native Windows ARM64 packages with aria2 1.37.0-motrix.19.
+Windows in-place BT activation remains available on supported local NTFS
+volumes with explicit authorization. See the
[migration guide](./docs/legacy-migration.md) for supported volumes, file permissions,
and recovery. Keep a backup of the v1 profile and the engine's pre-upgrade database
snapshot. When practical, test v2 in parallel using a separate OS account,
@@ -146,7 +147,7 @@ package that matches your operating system and architecture:
| Platform | Architectures | Packages / channel | Recommendation |
|----------|---------------|--------------------|----------------|
| macOS 13+ | `arm64` (Apple Silicon), `x64` (Intel) | `.dmg` / `.zip` | Use the `.dmg` matching your Mac; choose `x64` only for an Intel-based Mac |
-| Windows | `x64` | `.exe` (NSIS installer) / `.zip` | Use the `.exe` installer for a normal installation or `.zip` for a manually extracted copy |
+| Windows | `x64`, `arm64` | `.exe` (NSIS installer) / `.zip` | Use the `.exe` installer for a normal installation or `.zip` for a manually extracted copy |
| Linux | `x64`, `arm64` | `.AppImage` / `.deb` / `.rpm` | Use the portable `.AppImage` on any distribution, `.deb` on Debian or Ubuntu, or `.rpm` on Fedora or openSUSE |
| Linux (Snap Store) | `amd64`, `arm64` | `latest/edge` | Install the strictly confined beta with `sudo snap install motrix --edge` |
| Linux (Flatpak) | `x86_64`, `aarch64` | `.flatpak` | Install a versioned bundle from a release that includes it; see the [Flatpak guide](docs/flatpak.md) |
@@ -163,8 +164,9 @@ interfaces. Release tags build and validate Flatpak application bundles for
both architectures before publication. Older releases, including beta.39,
contain only the Flatpak Native Host companion. These single-file bundles
require manual upgrades; they do not configure a Motrix update repository.
-Windows `arm64` and all 32-bit packages are not available.
-Windows `x64` packages are unsigned and may trigger a Windows SmartScreen
+Windows ARM64 computers can use the native `arm64` installer or ZIP.
+All 32-bit packages remain unavailable.
+Windows `x64` and `arm64` packages are unsigned and may trigger a Windows SmartScreen
warning.
### Command-line client
@@ -185,7 +187,7 @@ downloaded resources:
```bash
mkdir -p motrix-data downloads
sudo chown 1000:1000 motrix-data downloads
-export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.51'
+export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.52'
export MOTRIX_PUBLIC_URL='http://nas.example.lan:8080'
docker compose pull server
docker compose up -d --wait
diff --git a/README.zh-CN.md b/README.zh-CN.md
index eb8f78f9..e7177031 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -22,12 +22,13 @@ Motrix 是一款界面简洁、功能丰富的桌面下载管理器,可处理
## 🧪 Beta 测试
Motrix Turbo v2 目前仍处于 beta 阶段。剩余发布门禁通过后,请从 GitHub Releases
-下载 [v2.0.0-beta.51](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.51),
-并在安装前阅读[完整发布说明](./docs/release-notes/2.0.0-beta.51.zh-CN.md)。
+下载 [v2.0.0-beta.52](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.52),
+并在安装前阅读[完整发布说明](./docs/release-notes/2.0.0-beta.52.zh-CN.md)。
测试前请备份现有 Motrix 数据和下载文件。桌面端迁移助手会将选中的 v1 任务
-导入为暂停记录,并保留原文件;恢复下载需要单独明确操作。本 beta 捆绑 aria2 1.37.0-motrix.18,
-支持在符合条件的 Windows 本地 NTFS 卷上明确授权后原位激活 BT 任务。
+导入为暂停记录,并保留原文件;恢复下载需要单独明确操作。本 beta 新增 Windows
+ARM64 原生安装包,捆绑 aria2 1.37.0-motrix.19。符合条件的 Windows 本地 NTFS 卷
+仍支持在明确授权后原位激活 BT 任务。
支持的磁盘类型、文件权限和恢复方式见[迁移指南](./docs/legacy-migration.zh-CN.md)。
请保留 v1 配置和引擎升级前数据库快照的备份。条件允许时,建议通过独立的系统
账户、设备或 Docker 数据目录与现有环境并行测试 v2。
@@ -141,7 +142,7 @@ Motrix Extension 已上架官方浏览器扩展商店,配合 Motrix 2 使用
| 平台 | 架构 | 安装包 / 通道 | 选择建议 |
|------|------|---------------|----------|
| macOS 13+ | `arm64`(Apple Silicon)、`x64`(Intel) | `.dmg` / `.zip` | 选择与 Mac 架构匹配的 `.dmg`;仅 Intel Mac 使用 `x64` |
-| Windows | `x64` | `.exe`(NSIS 安装包)/ `.zip` | 常规安装使用 `.exe`;`.zip` 可解压后手动运行 |
+| Windows | `x64`、`arm64` | `.exe`(NSIS 安装包)/ `.zip` | 常规安装使用 `.exe`;`.zip` 可解压后手动运行 |
| Linux | `x64`、`arm64` | `.AppImage` / `.deb` / `.rpm` | 任意发行版可使用便携的 `.AppImage`,Debian 或 Ubuntu 使用 `.deb`,Fedora 或 openSUSE 使用 `.rpm` |
| Linux(Snap Store) | `amd64`、`arm64` | `latest/edge` | 使用 `sudo snap install motrix --edge` 安装严格限制的 beta |
| Linux(Flatpak) | `x86_64`、`aarch64` | `.flatpak` | 从包含该格式的 Release 下载对应版本的安装包,详见 [Flatpak 安装指南](docs/flatpak.zh-CN.md) |
@@ -153,7 +154,8 @@ Snap Store 安装包使用严格限制。已批准的 `personal-files` interface
之外的通用文件访问权限。Release tag 会构建并验证两种架构的 Flatpak 主程序包,
通过后再发布。beta.39 等旧版本仅包含 Flatpak Native Host 配套程序。
这些单文件安装包需要手动升级,不会配置 Motrix 更新仓库。
-同时不提供 Windows `arm64` 和任何 32 位安装包。Windows `x64` 安装包未签名,
+Windows ARM64 电脑可选择原生 `arm64` 安装包或 ZIP。仍不提供任何 32 位安装包。
+Windows `x64` 和 `arm64` 安装包均未签名,
可能触发 Windows SmartScreen 警告。
### 命令行客户端
@@ -173,7 +175,7 @@ Beta 只发布不可变的版本 tag,不会更新 `latest`;仓库的 `compos
```bash
mkdir -p motrix-data downloads
sudo chown 1000:1000 motrix-data downloads
-export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.51'
+export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.52'
export MOTRIX_PUBLIC_URL='http://nas.example.lan:8080'
docker compose pull server
docker compose up -d --wait
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index f3a8d517..37743bc7 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -102,8 +102,8 @@ must obtain permission or replace the font before distributing the build.
Desktop builds bundle an `aria2c` executable pinned by
`scripts/engine.lock.json`:
-- **Version:** 1.37.0-motrix.18
-- **Source:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.18>
+- **Version:** 1.37.0-motrix.19
+- **Source:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.19>
- **License:** GNU General Public License v2.0 or later (`GPL-2.0-or-later`)
- **Full license text:** `THIRD_PARTY_LICENSES/aria2-COPYING`
- **OpenSSL exception / notice:**
diff --git a/THIRD_PARTY_NOTICES.zh-CN.md b/THIRD_PARTY_NOTICES.zh-CN.md
index 4609db1f..0fca987c 100644
--- a/THIRD_PARTY_NOTICES.zh-CN.md
+++ b/THIRD_PARTY_NOTICES.zh-CN.md
@@ -87,8 +87,8 @@ Safari 图标是从 macOS 27.0(26A428)自带的 Safari 27.0 中 `Safari.app/
桌面版随应用打包 `aria2c` 可执行文件,版本由 `scripts/engine.lock.json` 固定:
-- **版本:** 1.37.0-motrix.18
-- **对应源码:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.18>
+- **版本:** 1.37.0-motrix.19
+- **对应源码:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.19>
- **许可证:** GNU General Public License v2.0 or later(`GPL-2.0-or-later`)
- **完整许可证文本:** `THIRD_PARTY_LICENSES/aria2-COPYING`
- **OpenSSL 例外条款 / 声明:**
diff --git a/docs/release-notes/2.0.0-beta.52.md b/docs/release-notes/2.0.0-beta.52.md
new file mode 100644
index 00000000..fa5baae8
--- /dev/null
+++ b/docs/release-notes/2.0.0-beta.52.md
@@ -0,0 +1,72 @@
+# Motrix 2.0.0-beta.52
+
+English | [简体中文](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.52/docs/release-notes/2.0.0-beta.52.zh-CN.md)
+
+Motrix 2.0.0-beta.52 adds native Windows ARM64 desktop packages, including
+aria2 1.37.0-motrix.19, the filesystem helper, and the browser Native Host.
+
+## Highlights
+
+- Windows ARM64 computers can use a native NSIS installer or portable ZIP.
+ Electron, SQLite, aria2, and both native helpers use the ARM64 build.
+ The new engine is published separately as
+ [aria2 1.37.0-motrix.19](https://github.com/motrixapp/aria2/releases/tag/v1.37.0-motrix.19).
+- Windows x64 download names stay unchanged. ARM64 installers and ZIPs have
+ an explicit `arm64` suffix. Both architectures share the Windows update
+ channel, which selects the installer for the running app's architecture.
+- Native Windows release checks cover the packaged application, SQLite,
+ native helpers, and aria2 WebSocket communication. Engine release checks
+ also exercise HTTPS certificate trust, long paths, task cookies, and legacy
+ checkpoint recovery on Windows ARM64.
+
+## Choosing a Windows package
+
+| Computer / app architecture | Installer | Portable archive |
+|-----------------------------|-----------|------------------|
+| x64 | `Motrix-Setup-2.0.0-beta.52.exe` | `Motrix-2.0.0-beta.52-win.zip` |
+| ARM64 | `Motrix-Setup-2.0.0-beta.52-arm64.exe` | `Motrix-2.0.0-beta.52-win-arm64.zip` |
+
+An existing x64 installation running under Windows ARM emulation stays on the
+x64 update path. To switch to the native build, back up your profile, close
+Motrix, and install the ARM64 package. Do not run both architectures against the
+same profile at the same time.
+
+Windows packages are unsigned and may trigger SmartScreen. Download from the
+official GitHub prerelease. No 32-bit desktop packages are provided.
+
+## Planned downloads after release gates pass
+
+| Distribution | Architectures | Planned output |
+|--------------|---------------|----------------|
+| macOS 13 or later | `arm64`, `x64` | Signed and notarized DMG and ZIP |
+| Windows | `x64`, `arm64` | Unsigned NSIS installer and ZIP |
+| Linux | `x64`, `arm64` | AppImage, DEB, RPM, and pacman |
+| Flatpak application | `x86_64`, `aarch64` | Versioned `.flatpak` bundle |
+| Flatpak Native Host companion | `linux/x64`, `linux/arm64` | Versioned `.tar.gz` archive |
+| Docker Hub / GHCR | `linux/amd64`, `linux/arm64` | Immutable `2.0.0-beta.52` tag |
+| Snap Store | `amd64`, `arm64` | Verified build set on `latest/edge` |
+
+After every container gate passes, use
+`docker.io/motrixapp/motrix-server:2.0.0-beta.52` or
+`ghcr.io/agalwood/motrix-server:2.0.0-beta.52`. See the
+[Docker Server guide](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.52/docs/docker-server.md).
+Beta publication does not update stable container aliases.
+
+Snap users can install with `sudo snap install motrix --edge`. Flatpak bundles
+require manual updates with `flatpak install --user --or-update`; update the
+Native Host companion separately. See the
+[Flatpak guide](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.52/docs/flatpak.md).
+
+## Before testing
+
+Back up the profile and downloads before upgrading. Legacy migration still
+imports paused records and requires explicit authorization before reusing
+BitTorrent data. Windows recovery requires a local fixed NTFS volume and the
+ownership, path, and permission checks described in the
+[migration guide](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.52/docs/legacy-migration.md).
+Retain the engine's pre-schema5 database backup.
+
+Real Windows SMB Explorer behavior, native fnOS acceptance, and the complete
+Chromium Extension download-submission flow remain outside this release's
+verified coverage. Report reproducible issues with your OS, architecture,
+package type, and reproduction steps.
diff --git a/docs/release-notes/2.0.0-beta.52.zh-CN.md b/docs/release-notes/2.0.0-beta.52.zh-CN.md
new file mode 100644
index 00000000..fded46fd
--- /dev/null
+++ b/docs/release-notes/2.0.0-beta.52.zh-CN.md
@@ -0,0 +1,64 @@
+# Motrix 2.0.0-beta.52
+
+[English](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.52/docs/release-notes/2.0.0-beta.52.md) | 简体中文
+
+Motrix 2.0.0-beta.52 新增 Windows ARM64 原生桌面安装包,包含
+aria2 1.37.0-motrix.19、文件系统辅助程序和浏览器 Native Host。
+
+## 主要变化
+
+- Windows ARM64 电脑可以使用原生 NSIS 安装包或便携 ZIP。Electron、SQLite、
+ aria2 和两个原生辅助程序均使用 ARM64 构建。新引擎已独立发布为
+ [aria2 1.37.0-motrix.19](https://github.com/motrixapp/aria2/releases/tag/v1.37.0-motrix.19)。
+- Windows x64 下载文件名保持不变,ARM64 安装包和 ZIP 带有明确的 `arm64`
+ 后缀。两种架构共用 Windows 更新通道,根据正在运行的应用架构选择安装包。
+- Windows 原生发布检查覆盖打包后的应用、SQLite、原生辅助程序和 aria2
+ WebSocket 通信。引擎发布检查还会在 Windows ARM64 上验证 HTTPS 证书信任、
+ 长路径、任务 Cookie 和旧版进度恢复。
+
+## 选择 Windows 安装包
+
+| 电脑/应用架构 | 安装程序 | 便携压缩包 |
+|---------------|----------|------------|
+| x64 | `Motrix-Setup-2.0.0-beta.52.exe` | `Motrix-2.0.0-beta.52-win.zip` |
+| ARM64 | `Motrix-Setup-2.0.0-beta.52-arm64.exe` | `Motrix-2.0.0-beta.52-win-arm64.zip` |
+
+在 Windows ARM 仿真环境下运行的现有 x64 安装仍沿用 x64 更新路径。
+切换到原生版本前,请备份配置、退出 Motrix,再安装 ARM64 版本。
+不要让两种架构的应用同时使用同一份配置。
+
+Windows 安装包均未签名,可能触发 SmartScreen。请从官方 GitHub 预发布版下载。
+本版本不提供 32 位桌面安装包。
+
+## 发布门禁通过后的计划下载
+
+| 分发方式 | 架构 | 计划产物 |
+|----------|------|----------|
+| macOS 13 或更新版本 | `arm64`、`x64` | 已签名并公证的 DMG 和 ZIP |
+| Windows | `x64`、`arm64` | 未签名的 NSIS 安装包和 ZIP |
+| Linux | `x64`、`arm64` | AppImage、DEB、RPM 和 pacman |
+| Flatpak 主程序 | `x86_64`、`aarch64` | 带版本号的 `.flatpak` 安装包 |
+| Flatpak Native Host 配套程序 | `linux/x64`、`linux/arm64` | 带版本号的 `.tar.gz` 压缩包 |
+| Docker Hub/GHCR | `linux/amd64`、`linux/arm64` | 不可变的 `2.0.0-beta.52` tag |
+| Snap Store | `amd64`、`arm64` | `latest/edge` 上通过验证的构建集 |
+
+全部容器门禁通过后,可使用
+`docker.io/motrixapp/motrix-server:2.0.0-beta.52` 或
+`ghcr.io/agalwood/motrix-server:2.0.0-beta.52`。详见
+[Docker Server 指南](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.52/docs/docker-server.zh-CN.md)。
+Beta 发布不会更新稳定容器别名。
+
+Snap 用户可通过 `sudo snap install motrix --edge` 安装。Flatpak 单文件包需要
+使用 `flatpak install --user --or-update` 手动更新,Native Host 配套程序需单独
+更新。详见 [Flatpak 指南](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.52/docs/flatpak.zh-CN.md)。
+
+## 测试前须知
+
+升级前请备份配置和下载文件。旧版迁移仍只导入暂停记录,复用 BitTorrent 数据前
+需要明确授权。Windows 恢复要求本地固定 NTFS 卷,并须通过
+[迁移指南](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.52/docs/legacy-migration.zh-CN.md)
+说明的所有权、路径及权限检查。请保留引擎升级前的 pre-schema5 数据库备份。
+
+真实 Windows SMB 共享上的 Explorer 行为、原生 fnOS 验收以及完整 Chromium
+扩展下载提交流程仍不在本次已验证范围内。反馈问题时,请提供操作系统、架构、
+安装包类型和复现步骤。
diff --git a/electron-builder.json b/electron-builder.json
index 444ab8d8..7a638813 100644
--- a/electron-builder.json
+++ b/electron-builder.json
@@ -159,10 +159,7 @@
]
},
"win": {
- "target": [
- { "target": "nsis", "arch": ["x64"] },
- { "target": "zip", "arch": ["x64"] }
- ],
+ "target": ["nsis", "zip"],
"extraResources": [
{ "from": "./extra/aria2.conf", "to": "./extra/aria2.conf" },
{ "from": "./dist/builtin-plugins", "to": "./builtin-plugins" },
@@ -185,6 +182,7 @@
"nsis": {
"include": "build/installer.nsh",
"artifactName": "${productName}-Setup-${version}.${ext}",
+ "buildUniversalInstaller": false,
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"deleteAppDataOnUninstall": false,
diff --git a/electron-builder.signing.json b/electron-builder.signing.json
index 9b24d7d3..6682edd2 100644
--- a/electron-builder.signing.json
+++ b/electron-builder.signing.json
@@ -157,10 +157,7 @@
]
},
"win": {
- "target": [
- { "target": "nsis", "arch": ["x64"] },
- { "target": "zip", "arch": ["x64"] }
- ],
+ "target": ["nsis", "zip"],
"extraResources": [
{ "from": "./extra/aria2.conf", "to": "./extra/aria2.conf" },
{ "from": "./dist/builtin-plugins", "to": "./builtin-plugins" },
@@ -181,6 +178,7 @@
]
},
"nsis": {
+ "buildUniversalInstaller": false,
"include": "trusted/installer.nsh",
"script": null,
"customNsisBinary": null,
diff --git a/flatpak/app.motrix.native.metainfo.xml b/flatpak/app.motrix.native.metainfo.xml
index eb301327..eb983af3 100644
--- a/flatpak/app.motrix.native.metainfo.xml
+++ b/flatpak/app.motrix.native.metainfo.xml
@@ -68,6 +68,15 @@
</screenshots>
<releases>
+ <release version="2.0.0-beta.52" date="2026-10-21">
+ <description>
+ <p>
+ Adds native Windows ARM64 installers and portable archives with
+ aria2 1.37.0-motrix.19, native filesystem and browser helpers,
+ architecture-aware update metadata, and native runtime release checks.
+ </p>
+ </description>
+ </release>
<release version="2.0.0-beta.51" date="2026-10-20">
<description>
<p>
diff --git a/flatpak/app.motrix.native.yml b/flatpak/app.motrix.native.yml
index 22e5fbd2..e6345be9 100644
--- a/flatpak/app.motrix.native.yml
+++ b/flatpak/app.motrix.native.yml
@@ -101,7 +101,7 @@ modules:
set -e
output="$(src/aria2c --version)"
printf '%s\n' "$output"
- printf '%s\n' "$output" | grep -qF 'aria2 version 1.37.0-motrix.18'
+ printf '%s\n' "$output" | grep -qF 'aria2 version 1.37.0-motrix.19'
for feature in \
'Async DNS' \
'BitTorrent' \
@@ -123,8 +123,8 @@ modules:
sources:
- type: git
url: https://github.com/motrixapp/aria2.git
- tag: v1.37.0-motrix.18
- commit: f86316d812d4e1afa8949095e6d0941e558873ab
+ tag: v1.37.0-motrix.19
+ commit: 5c636cc13753a3b3384ec7f51a2587f851d2e4bd
x-checker-data:
type: git
tag-pattern: ^v([\d.]+-motrix\.\d+)$
@@ -136,9 +136,9 @@ modules:
commands:
- |
sed -i -E \
- 's/AC_INIT\(\[aria2\],\[[^]]+\]/AC_INIT([aria2],[1.37.0-motrix.18]/' \
+ 's/AC_INIT\(\[aria2\],\[[^]]+\]/AC_INIT([aria2],[1.37.0-motrix.19]/' \
configure.ac
- grep -qF 'AC_INIT([aria2],[1.37.0-motrix.18]' configure.ac
+ grep -qF 'AC_INIT([aria2],[1.37.0-motrix.19]' configure.ac
- type: script
dest-filename: autogen.sh
commands:
diff --git a/package.json b/package.json
index e6ffd3bd..831d5210 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"type": "module",
"productName": "Motrix",
"homepage": "https://motrix.app",
- "version": "2.0.0-beta.51",
+ "version": "2.0.0-beta.52",
"packageManager": "[email protected]+sha512.ba40a37eb1a370d60fea8c4cf1d364c13bcccef518e98ad2bcee954f539d38da37458e58261a3fa55e06523450ea0ffff9f497b135be41f2c15c1642bacace6c",
"description": "A full-featured download manager",
"keywords": [],
diff --git a/packages/finalize-fs/build.mjs b/packages/finalize-fs/build.mjs
index 689543ae..277c8ba4 100644
--- a/packages/finalize-fs/build.mjs
+++ b/packages/finalize-fs/build.mjs
@@ -11,6 +11,7 @@ const targets = new Map([
['darwin-x64', 'x86_64-apple-darwin'],
['linux-arm64', 'aarch64-unknown-linux-musl'],
['linux-x64', 'x86_64-unknown-linux-musl'],
+ ['win32-arm64', 'aarch64-pc-windows-msvc'],
['win32-x64', 'x86_64-pc-windows-msvc'],
])
diff --git a/packages/native-host/build.mjs b/packages/native-host/build.mjs
index 13085951..de24d621 100644
--- a/packages/native-host/build.mjs
+++ b/packages/native-host/build.mjs
@@ -42,8 +42,6 @@ export const BUILD_TARGETS = new Map([
binaryName: 'motrix-native-host.exe',
},
],
- // Reserved for a future release matrix. This mapping does not create a
- // placeholder and is only built when an actual Windows arm64 job invokes it.
[
'win32-arm64',
{
diff --git a/packages/native-host/build.test.mjs b/packages/native-host/build.test.mjs
index 06d3be2a..e6014430 100644
--- a/packages/native-host/build.test.mjs
+++ b/packages/native-host/build.test.mjs
@@ -60,19 +60,25 @@ test('defaults to the host and supports explicit environment mapping', () => {
)
})
-test('maps every release target and reserves Windows arm64 without output', () => {
+test('maps release targets including native Windows arm64', () => {
assert.equal(
BUILD_TARGETS.get('win32-arm64').rustTarget,
'aarch64-pc-windows-msvc'
)
- assert.equal(
- resolveBuildTarget(
- { platform: 'win32', arch: 'x64' },
+ for (const [arch, rustTarget] of [
+ ['x64', 'x86_64-pc-windows-msvc'],
+ ['arm64', 'aarch64-pc-windows-msvc'],
+ ]) {
+ const target = resolveBuildTarget(
+ { platform: 'win32', arch },
{},
{ platform: 'darwin', arch: 'arm64' }
- ).binaryName,
- 'motrix-native-host.exe'
- )
+ )
+ assert.equal(target.binaryName, 'motrix-native-host.exe')
+ assert.equal(target.rustTarget, rustTarget)
+ const args = cargoBuildArguments(target, '/tmp/native-host-target')
+ assert.equal(args[args.indexOf('--target') + 1], rustTarget)
+ }
assert.throws(
() =>
resolveBuildTarget(
diff --git a/scripts/assemble-release-artifacts.mjs b/scripts/assemble-release-artifacts.mjs
index b15d88ec..df85b35f 100644
--- a/scripts/assemble-release-artifacts.mjs
+++ b/scripts/assemble-release-artifacts.mjs
@@ -99,6 +99,17 @@ export const RELEASE_TARGETS = [
manifestAssetNames: (version) => [`Motrix-Setup-${version}.exe`],
legacyAssetName: (version) => `Motrix-Setup-${version}.exe`,
},
+ {
+ name: 'win32-arm64',
+ manifestName: 'latest.yml',
+ betaManifestName: 'beta.yml',
+ assetNames: (version) => [
+ `Motrix-Setup-${version}-arm64.exe`,
+ `Motrix-${version}-win-arm64.zip`,
+ ],
+ manifestAssetNames: (version) => [`Motrix-Setup-${version}-arm64.exe`],
+ legacyAssetName: (version) => `Motrix-Setup-${version}-arm64.exe`,
+ },
]
const RELEASE_ASSET_EXTENSIONS = [
@@ -195,29 +206,33 @@ export async function assembleReleaseArtifacts({
}
}
- const macArm64 = targetResults.find(
- (target) => target.name === 'darwin-arm64'
- )
- const macX64 = targetResults.find((target) => target.name === 'darwin-x64')
- for (const manifestName of targetManifestNames(macX64, channel)) {
- const macManifest = mergeMacManifests(
- macX64.manifests.get(manifestName),
- macArm64.manifests.get(manifestName),
- manifestName
+ for (const platform of ['darwin', 'win32']) {
+ const arm64 = targetResults.find(
+ (target) => target.name === `${platform}-arm64`
)
- addOutputFile(outputFiles, manifestName, {
- kind: 'content',
- content: dump(macManifest, {
- lineWidth: -1,
- noRefs: true,
- sortKeys: false,
- }),
- target: 'darwin',
- })
+ const x64 = targetResults.find(
+ (target) => target.name === `${platform}-x64`
+ )
+ for (const manifestName of targetManifestNames(x64, channel)) {
+ const manifest = mergeArchitectureManifests(
+ x64.manifests.get(manifestName),
+ arm64.manifests.get(manifestName),
+ manifestName
+ )
+ addOutputFile(outputFiles, manifestName, {
+ kind: 'content',
+ content: dump(manifest, {
+ lineWidth: -1,
+ noRefs: true,
+ sortKeys: false,
+ }),
+ target: platform,
+ })
+ }
}
for (const target of targetResults) {
- if (target.name.startsWith('darwin-')) continue
+ if (!target.name.startsWith('linux-')) continue
for (const manifestName of targetManifestNames(target, channel)) {
const manifest = target.manifests.get(manifestName)
addOutputFile(outputFiles, manifestName, {
@@ -508,16 +523,14 @@ function parseManifestFile(manifestName, index, value) {
return value
}
-function mergeMacManifests(x64, arm64, manifestName) {
+function mergeArchitectureManifests(x64, arm64, manifestName) {
if (x64.version !== arm64.version) {
throw new Error(
`${manifestName}: architecture versions differ (${x64.version} and ${arm64.version})`
)
}
- if (!x64.legacyFile.url.endsWith('.zip')) {
- throw new Error(`${manifestName}: x64 legacy path must reference a ZIP`)
- }
-
+ // Keep x64 first and retain its legacy path. The NSIS updater falls back to
+ // the first EXE for existing x64 names, while ARM64 selects the named asset.
const files = []
const byName = new Map()
for (const file of [...x64.files, ...arm64.files]) {
diff --git a/scripts/before-pack-verify.mjs b/scripts/before-pack-verify.mjs
index e47d6966..671f28a2 100644
--- a/scripts/before-pack-verify.mjs
+++ b/scripts/before-pack-verify.mjs
@@ -11,6 +11,7 @@ import { constants } from 'node:fs'
import { access, readFile, stat } from 'node:fs/promises'
import path from 'node:path'
import { assertNativeBinaryTarget } from './native-binary-target.mjs'
+import { configureWindowsArtifactNames } from './windows-artifact-names.mjs'
// electron-builder Arch enum ordinals (builder-util/src/arch.ts).
const ARCH_NAMES = {
@@ -141,6 +142,9 @@ export default async function beforePack(context) {
)
}
await verifyStage(projectDir, platform, archName)
+ if (platform === 'win32') {
+ configureWindowsArtifactNames(context.targets, archName)
+ }
const engineBin = platform === 'win32' ? 'aria2c.exe' : 'aria2c'
const hostBin =
platform === 'win32' ? 'motrix-native-host.exe' : 'motrix-native-host'
diff --git a/scripts/electron-package-utils.mjs b/scripts/electron-package-utils.mjs
index be99f5b9..8f5cb735 100644
--- a/scripts/electron-package-utils.mjs
+++ b/scripts/electron-package-utils.mjs
@@ -22,6 +22,7 @@ const SUPPORTED_TARGETS = [
'darwin-x64',
'linux-arm64',
'linux-x64',
+ 'win32-arm64',
'win32-x64',
]
const SUPPORTED_PLATFORMS = ['darwin', 'linux', 'win32']
diff --git a/scripts/electron-runtime-dependencies.json b/scripts/electron-runtime-dependencies.json
index 20dbe13a..462ca1d6 100644
--- a/scripts/electron-runtime-dependencies.json
+++ b/scripts/electron-runtime-dependencies.json
@@ -5,6 +5,7 @@
"darwin-x64",
"linux-arm64",
"linux-x64",
+ "win32-arm64",
"win32-x64"
],
"common": [
diff --git a/scripts/engine.lock.json b/scripts/engine.lock.json
index 1fd69290..0bacd6cf 100644
--- a/scripts/engine.lock.json
+++ b/scripts/engine.lock.json
@@ -1,50 +1,56 @@
{
"engine": "aria2",
"repo": "motrixapp/aria2",
- "tag": "v1.37.0-motrix.18",
- "version": "1.37.0-motrix.18",
+ "tag": "v1.37.0-motrix.19",
+ "version": "1.37.0-motrix.19",
"assets": {
"darwin-arm64": {
- "file": "aria2c-1.37.0-motrix.18-darwin-arm64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.19-darwin-arm64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "e25c881f60b2fbbf21e2137f5b39646e28524cd38b4dca76530abecf4edf1363",
- "binarySha256": "cd1da52159a5bcba3214ee80a7870f988b43d32839f5e02c5b63715814c5a1f3"
+ "archiveSha256": "c564bf41994626a78ee69d316d3e0d4257b168a2bcf57805ca9923de081203da",
+ "binarySha256": "ef5708614ef2a7423d17e3697c2272fd288ab49cba4589bc5ff732d52aa78a61"
},
"darwin-x64": {
- "file": "aria2c-1.37.0-motrix.18-darwin-x64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.19-darwin-x64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "ef37bb8cdcdb61fd055db259930b97baed96056799dbe4db47a62c718e52687a",
- "binarySha256": "ccc02625f9d37cb4f2cd57e129e2e3ccb99eb0874255ccab31905cdd27c38f29"
+ "archiveSha256": "441f54e2424e71c717a014ebb6916d42cb602a68b95dfdd7d5b76ef327c8fabc",
+ "binarySha256": "4be7906ac4fbf86ff243b5b759aef099661a416eaea64e3669883514f372e866"
+ },
+ "win32-arm64": {
+ "file": "aria2c-1.37.0-motrix.19-win32-arm64.zip",
+ "bin": "aria2c.exe",
+ "archiveSha256": "1c1e96304bee4a9e32728839f62751d359f48e28f1d78c724271cf8443769718",
+ "binarySha256": "ae5fff45eff6f86b14da86344a644ca557d6c86973a863d3924607d0cc7417d8"
},
"win32-x64": {
- "file": "aria2c-1.37.0-motrix.18-win32-x64.zip",
+ "file": "aria2c-1.37.0-motrix.19-win32-x64.zip",
"bin": "aria2c.exe",
- "archiveSha256": "612990ae8f0a406c38a7de67795eee0ef031bf8b9c2031f4ea0933640db2589a",
- "binarySha256": "514cebdce6496eaacd76a5aa217848db3aee572747075bfa572c23430e3d5c04"
+ "archiveSha256": "9a03827fb170062cff886125382e72f525102df1dd5cf95f945c02ebb569e18f",
+ "binarySha256": "0bd858816412abba22a3d417bba3d0f1196e9b7156d8d0745920f618cd6a51bc"
},
"win32-ia32": {
- "file": "aria2c-1.37.0-motrix.18-win32-ia32.zip",
+ "file": "aria2c-1.37.0-motrix.19-win32-ia32.zip",
"bin": "aria2c.exe",
- "archiveSha256": "2a40692b15ed7825d6621701dd46f80adadb5074264dfe6545dc948b4192a9a8",
- "binarySha256": "8645bb7c27d2e45768025c29e4cdc5811918cd70e59291b79070198107200b44"
+ "archiveSha256": "dc0700a60cbd1e39de2839fa0f85ea738b1843abc9f43062264766f9585ca4f8",
+ "binarySha256": "74b887855c00ece41753a090fb6ec2dfd658b83d74c258b53d5ec37f029c20ab"
},
"linux-x64": {
- "file": "aria2c-1.37.0-motrix.18-linux-x64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.19-linux-x64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "b772e5a95438b77ce96d4a50bdf6e9cfc5e3a4d636395ce21b566f45843943c1",
- "binarySha256": "73ca99bc94a6d92e18dab25ab9065cb4c694c82d42a57f1076d9d9924fd6585e"
+ "archiveSha256": "1f36d1bc98b31ac1df0fb060d47624aa27e3e802ed1e1c375a515a505354e342",
+ "binarySha256": "164e909adadc01024e8dae80061d1698502b0f7f83d314fe7f28ed1845034d21"
},
"linux-arm64": {
- "file": "aria2c-1.37.0-motrix.18-linux-arm64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.19-linux-arm64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "ba91cf22bd5de76282326a6d75bfe5b19d1c1f8acbd91e739e185e9b400195d1",
- "binarySha256": "c009310fa67de325e3b4cabb783ebc86422da3ad42de50d294fabd4b55242134"
+ "archiveSha256": "7ccba6e77a38c516fc9a67c530765b5ebf00084dfaad1295939d8e6a018e7297",
+ "binarySha256": "d9161b9bc97afb409d00273a8de3f89fd550ec928a542ec3c5a68ed8fb5ba151"
},
"linux-arm": {
- "file": "aria2c-1.37.0-motrix.18-linux-armv7l.tar.gz",
+ "file": "aria2c-1.37.0-motrix.19-linux-armv7l.tar.gz",
"bin": "aria2c",
- "archiveSha256": "39525e2d56e6f4b723eaa02196ec0ce2a6e3df61c170cd7bebea283c36b66f8b",
- "binarySha256": "b3d01b78e41ab9c5d120c15814893d0d1e624df5b86095012c340954f214b014"
+ "archiveSha256": "be3b64bd84d343bc30693e45974613817e99602a53bced96f7361a618f82e71d",
+ "binarySha256": "235ed2fdddaaef6b34564eadbee0d76d0b724c852f8b36381d44f25618ede8ee"
}
}
}
diff --git a/scripts/fetch-engine.mjs b/scripts/fetch-engine.mjs
index 71ed0784..6bd61c94 100644
--- a/scripts/fetch-engine.mjs
+++ b/scripts/fetch-engine.mjs
@@ -64,6 +64,7 @@ function resolveTimeoutMs() {
const DESKTOP_TARGETS = [
{ key: 'darwin-arm64', os: 'darwin', releaseArch: 'arm64', ext: 'tar.gz' },
{ key: 'darwin-x64', os: 'darwin', releaseArch: 'x64', ext: 'tar.gz' },
+ { key: 'win32-arm64', os: 'win32', releaseArch: 'arm64', ext: 'zip' },
{ key: 'win32-x64', os: 'win32', releaseArch: 'x64', ext: 'zip' },
{ key: 'win32-ia32', os: 'win32', releaseArch: 'ia32', ext: 'zip' },
{ key: 'linux-x64', os: 'linux', releaseArch: 'x64', ext: 'tar.gz' },
@@ -510,6 +511,12 @@ export async function run(argv, deps = defaultDeps) {
const hostMode = !args.all && !args.platform && !args.arch
if (hostMode && !lock.assets[resolveHostKey(host.platform, host.arch)]) {
const hostKey = resolveHostKey(host.platform, host.arch)
+ if (DESKTOP_TARGETS.some((target) => target.key === hostKey)) {
+ deps.logError(
+ `[fetch-engine] supported desktop target ${hostKey} is missing from the lockfile; regenerate it from a complete aria2 release`
+ )
+ return EXIT_FAILURE
+ }
deps.log(
`[fetch-engine] no prebuilt aria2 binary for this host (${hostKey}) — ` +
'skipping (this platform is not packaged)'
diff --git a/scripts/release-signing-input.mjs b/scripts/release-signing-input.mjs
index 0355233a..19aa536a 100644
--- a/scripts/release-signing-input.mjs
+++ b/scripts/release-signing-input.mjs
@@ -41,7 +41,7 @@ const TRUSTED_INPUT_SHA256 = Object.freeze({
'scripts/sign-macos.mjs':
'98bda5c77dce2a3e5d9c9a2f8211f4d5594d060bf9d2839326db50dc41f8c58b',
'electron-builder.signing.json':
- '33831fd485494061fe26de6b2a3aa4d1b67d4ae4821316f8f3b4d06831ff7e19',
+ 'be1f3217bef5d85f3f76420f8762887f7d8b1d1d9447c6cae4f6f4e1996a7301',
'signing-build-resources/256x256.png':
'044d3b64a14aa512ca41469372d1ad630557daaeb2cb4e709d34f2d3c57d4c3b',
'signing-build-resources/background.tiff':
@@ -69,7 +69,7 @@ const TRUSTED_INPUT_SHA256 = Object.freeze({
'scripts/electron-package-size-budgets.json':
'6a7585a5f922cfc5a90e83ac778bcd46efae90ba9079853e3a66ad275b2438c7',
'scripts/electron-package-utils.mjs':
- '9d408f9edc91182be5d5aed39f2c5a5d20f5523e08d9c08e630c23c66302daa8',
+ '8834f6e22db4212655368a31815c7f86ac16c3065aacabb99e83878b9df43831',
'scripts/before-build-use-staged-dependencies.mjs':
'acbd47ea1ac9397990ec0d605cb1f5e627c3db265bd1e3a6588a7c65635af315',
'scripts/native-binary-target.mjs':
@@ -313,9 +313,6 @@ function parseOptions(argv) {
if (options.mode === 'create' && !options.archive) {
throw new Error('--archive is required in create mode')
}
- if (options.platform === 'win32' && options.arch !== 'x64') {
- throw new Error('Windows signing input only supports x64')
- }
return options
}
diff --git a/scripts/smoke-electron-package.mjs b/scripts/smoke-electron-package.mjs
index cd327700..34699643 100644
--- a/scripts/smoke-electron-package.mjs
+++ b/scripts/smoke-electron-package.mjs
@@ -17,6 +17,9 @@ import { fileURLToPath } from 'node:url'
import { promisify } from 'node:util'
import electronPath from 'electron'
import { chromium } from 'playwright'
+import { MenuItemIds } from '../src/main/menu/menu-ids.ts'
+import { Commands } from '../src/shared/protocol/commands.ts'
+import { Queries } from '../src/shared/protocol/queries.ts'
import { parseTarget, stringifySortedJson } from './electron-package-utils.mjs'
const execFileAsync = promisify(execFile)
@@ -148,18 +151,143 @@ async function runElectronNodeHelper(mode, args) {
return JSON.parse(stdout)
}
-async function stopPackagedApp(child) {
- if (child.exitCode !== null || child.signalCode !== null) return
- child.kill('SIGTERM')
- await Promise.race([
- new Promise((resolve) => child.once('exit', resolve)),
- new Promise((_, reject) =>
- setTimeout(
- () => reject(new Error('packaged app did not stop after SIGTERM')),
- 15_000
+function hasExited(child) {
+ return child.exitCode !== null || child.signalCode !== null
+}
+
+function observeExit(child, timeoutMs, label) {
+ let timer
+ let onExit
+ let onError
+ const dispose = () => {
+ clearTimeout(timer)
+ child.off('exit', onExit)
+ child.off('error', onError)
+ }
+ const promise = new Promise((resolve, reject) => {
+ onExit = (code, signal) => {
+ dispose()
+ resolve({ code, signal })
+ }
+ onError = (error) => {
+ dispose()
+ reject(error)
+ }
+ child.once('exit', onExit)
+ child.once('error', onError)
+ timer = setTimeout(() => {
+ dispose()
+ reject(new Error(`${label} timed out after ${timeoutMs}ms`))
+ }, timeoutMs)
+ if (hasExited(child)) onExit(child.exitCode, child.signalCode)
+ })
+ return { promise, dispose }
+}
+
+async function forceStopPackagedApp(child, options) {
+ if (hasExited(child)) return
+ if (!Number.isSafeInteger(child.pid) || child.pid <= 0) {
+ throw new Error('packaged app has no owned process ID for cleanup')
+ }
+ const exited = observeExit(child, options.forceTimeoutMs, 'app cleanup')
+ try {
+ await Promise.all([
+ exited.promise,
+ Promise.resolve().then(() => {
+ if (hasExited(child)) return
+ if (options.platform === 'win32') {
+ return options.execFile(
+ 'taskkill.exe',
+ ['/PID', String(child.pid), '/T', '/F'],
+ { windowsHide: true, timeout: options.forceTimeoutMs }
+ )
+ }
+ child.kill('SIGKILL')
+ }),
+ ])
+ } finally {
+ exited.dispose()
+ }
+}
+
+export async function stopPackagedApp(child, mainPage, options = {}) {
+ const cleanup = {
+ platform: options.platform ?? process.platform,
+ forceTimeoutMs: options.forceTimeoutMs ?? 5000,
+ execFile: options.execFile ?? execFileAsync,
+ }
+ let shutdownError
+ let evaluationError
+ const exited = observeExit(
+ child,
+ options.timeoutMs ?? 15_000,
+ 'packaged app graceful shutdown'
+ )
+ try {
+ if (!hasExited(child) && cleanup.platform !== 'win32') {
+ // Unix delivers SIGTERM to the application's termination handler, which
+ // performs its ordinary engine and storage cleanup. Windows treats this
+ // signal as abrupt process termination, so it needs renderer IPC instead.
+ child.kill('SIGTERM')
+ } else if (!hasExited(child)) {
+ if (!mainPage)
+ throw new Error('packaged main renderer is unavailable for shutdown')
+ // Register the exit listener before asking Electron to quit. The page
+ // may be destroyed before evaluate receives its IPC response, so only
+ // the process exit status determines whether shutdown succeeded.
+ Promise.resolve()
+ .then(() =>
+ mainPage.evaluate(
+ async ({ query, command, itemId }) => {
+ const snapshot = await window.motrix.invoke(query)
+ await window.motrix.invoke(command, {
+ itemId,
+ revision: snapshot.revision,
+ trigger: 'menu',
+ selectedTaskId: null,
+ })
+ },
+ {
+ query: Queries.GetApplicationMenu,
+ command: Commands.ExecuteApplicationMenuItem,
+ itemId: MenuItemIds.AppQuit,
+ }
+ )
+ )
+ .catch((error) => {
+ evaluationError = error
+ })
+ }
+ const result = await exited.promise
+ if (result.code !== 0 || result.signal !== null) {
+ throw new Error(
+ `packaged app did not exit cleanly: code=${result.code}, signal=${result.signal}`
+ )
+ }
+ } catch (error) {
+ shutdownError = error
+ if (evaluationError) {
+ shutdownError = new Error(
+ `${error.message}: ${evaluationError.message}`,
+ {
+ cause: error,
+ }
)
- ),
- ])
+ }
+ } finally {
+ exited.dispose()
+ if (shutdownError) {
+ try {
+ await forceStopPackagedApp(child, cleanup)
+ } catch (cleanupError) {
+ shutdownError = new AggregateError(
+ [shutdownError, cleanupError],
+ `packaged app shutdown and cleanup failed: ${shutdownError.message}; ${cleanupError.message}`
+ )
+ }
+ }
+ }
+ if (shutdownError) throw shutdownError
}
async function connectToRenderer(debugPort, child, readStderr) {
@@ -218,6 +346,7 @@ async function runPackagedApplication(layout, tempDir) {
const rendererErrors = []
let browser
+ let mainPage
let stderr = ''
const child = spawn(
layout.executable,
@@ -246,6 +375,7 @@ async function runPackagedApplication(layout, tempDir) {
browser = await connectToRenderer(debugPort, child, () => stderr.trim())
await markProgress('launched')
const page = await findMainPage(browser)
+ mainPage = page
await markProgress('first-window')
page.on('pageerror', (error) => rendererErrors.push(error.message))
page.on('console', (message) => {
@@ -272,10 +402,13 @@ async function runPackagedApplication(layout, tempDir) {
windowReady: true,
}
} finally {
- await markProgress('stopping')
- await stopPackagedApp(child)
- await browser?.close().catch(() => {})
- await markProgress('stopped')
+ try {
+ await markProgress('stopping').catch(() => {})
+ await stopPackagedApp(child, mainPage)
+ await markProgress('stopped')
+ } finally {
+ await browser?.close().catch(() => {})
+ }
}
}
diff --git a/scripts/verify-flatpak-packaging.mjs b/scripts/verify-flatpak-packaging.mjs
index 90743641..b3c4cc7e 100644
--- a/scripts/verify-flatpak-packaging.mjs
+++ b/scripts/verify-flatpak-packaging.mjs
@@ -18,8 +18,8 @@ export const FLATPAK_BUILDER_TOOLS_COMMIT =
// tag resolves to is pinned by hand (and cross-checked against the manifest).
export const ARIA2_SOURCE = Object.freeze({
url: 'https://github.com/motrixapp/aria2.git',
- // v1.37.0-motrix.18 — current Motrix aria2 fork release
- commit: 'f86316d812d4e1afa8949095e6d0941e558873ab',
+ // v1.37.0-motrix.19 — current Motrix aria2 fork release
+ commit: '5c636cc13753a3b3384ec7f51a2587f851d2e4bd',
})
const PNPM_SOURCE = Object.freeze({
diff --git a/scripts/verify-update-artifacts.mjs b/scripts/verify-update-artifacts.mjs
index 3551050d..d1d89163 100644
--- a/scripts/verify-update-artifacts.mjs
+++ b/scripts/verify-update-artifacts.mjs
@@ -83,6 +83,21 @@ export async function verifyUpdateArtifacts({
)
}
}
+ if (requireAll && platform.suffix === '') {
+ const expected = [
+ `Motrix-Setup-${version}.exe`,
+ `Motrix-Setup-${version}-arm64.exe`,
+ ]
+ if (
+ manifest.legacyFile.url !== expected[0] ||
+ manifest.files.length !== expected.length ||
+ manifest.files.some((file, index) => file.url !== expected[index])
+ ) {
+ throw new Error(
+ `${manifest.name}: Windows updates must list x64 then arm64 installers and retain the x64 legacy path`
+ )
+ }
+ }
for (const file of manifest.files) {
const previous = verified.get(file.url)
diff --git a/scripts/verify-windows-native-host-dependencies.ps1 b/scripts/verify-windows-native-host-dependencies.ps1
index 70394291..acd2072b 100644
--- a/scripts/verify-windows-native-host-dependencies.ps1
+++ b/scripts/verify-windows-native-host-dependencies.ps1
@@ -26,17 +26,27 @@ if ($null -eq $dumpbin) {
$installationPath = & $vswhere `
-latest `
-products '*' `
- -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
+ -requiresAny `
+ -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.Tools.ARM64 `
-property installationPath
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($installationPath)) {
throw 'Could not locate a Visual Studio installation with MSVC tools'
}
- $dumpbin = Get-ChildItem `
- -Path (Join-Path $installationPath 'VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe') `
- -File |
- Sort-Object -Property FullName -Descending |
- Select-Object -First 1
+ $hostTools = if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq 'Arm64') {
+ @('Hostarm64\arm64', 'Hostarm64\x64', 'Hostx64\x64', 'Hostx86\x86')
+ } else {
+ @('Hostx64\x64', 'Hostx86\x86')
+ }
+ foreach ($hostTool in $hostTools) {
+ $dumpbin = Get-ChildItem `
+ -Path (Join-Path $installationPath "VC\Tools\MSVC\*\bin\$hostTool\dumpbin.exe") `
+ -File `
+ -ErrorAction SilentlyContinue |
+ Sort-Object -Property FullName -Descending |
+ Select-Object -First 1
+ if ($null -ne $dumpbin) { break }
+ }
if ($null -eq $dumpbin) {
throw "dumpbin.exe was not found below $installationPath"
}
diff --git a/scripts/windows-artifact-names.mjs b/scripts/windows-artifact-names.mjs
new file mode 100644
index 00000000..883a0276
--- /dev/null
+++ b/scripts/windows-artifact-names.mjs
@@ -0,0 +1,26 @@
+// Keep the existing x64 download URLs while distinguishing native ARM64
+// installers and archives. Signing jobs pass the same patterns as explicit
+// builder options because that isolated phase intentionally disables hooks.
+export function windowsArtifactNamePatterns(arch) {
+ if (arch !== 'x64' && arch !== 'arm64') {
+ throw new Error(`unsupported Windows artifact architecture: ${arch}`)
+ }
+ const suffix = arch === 'arm64' ? '-arm64' : ''
+ return {
+ nsis: `\${productName}-Setup-\${version}${suffix}.\${ext}`,
+ zip: `\${productName}-\${version}-win${suffix}.\${ext}`,
+ }
+}
+
+export function configureWindowsArtifactNames(targets, arch) {
+ const patterns = windowsArtifactNamePatterns(arch)
+ for (const target of targets) {
+ const pattern = patterns[target.name]
+ if (!pattern) continue
+ // electron-builder creates targets before beforePack, and NSIS copies its
+ // options in the constructor. Update the target's resolved options rather
+ // than only mutating packager.config, which would leave NSIS unchanged.
+ target.options = { ...target.options, artifactName: pattern }
+ if (target.name === 'nsis') target.options.buildUniversalInstaller = false
+ }
+}
diff --git a/tests/check-third-party-notices.test.ts b/tests/check-third-party-notices.test.ts
index 1776d210..b78465b1 100644
--- a/tests/check-third-party-notices.test.ts
+++ b/tests/check-third-party-notices.test.ts
@@ -460,9 +460,9 @@ describe('third-party graph dependency notices', () => {
expect(notice).toContain('SFNS-Regular.ttf')
expect(notice).toContain('https://developer.apple.com/fonts/')
- expect(notice).toContain('1.37.0-motrix.18')
+ expect(notice).toContain('1.37.0-motrix.19')
expect(notice).toContain(
- 'https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.18'
+ 'https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.19'
)
expect(notice).toContain('GPL-2.0-or-later')
expect(notice).toContain('THIRD_PARTY_LICENSES/aria2-COPYING')
diff --git a/tests/generate-third-party-notices.test.ts b/tests/generate-third-party-notices.test.ts
index 368c0c09..64c93baa 100644
--- a/tests/generate-third-party-notices.test.ts
+++ b/tests/generate-third-party-notices.test.ts
@@ -171,7 +171,7 @@ describe('third-party notice generator', () => {
expect(bundle.packageCount).toBeGreaterThan(100)
expect(inventory).toContain('| @xyflow/react | 12.12.0 |')
- expect(inventory).toContain('| aria2 | 1.37.0-motrix.18 |')
+ expect(inventory).toContain('| aria2 | 1.37.0-motrix.19 |')
expect(inventory).toContain('| motrix.filename-template | 1.1.1 |')
expect(inventory).toContain('Apple San Francisco tray font')
expect(licenses).toContain('GNU GENERAL PUBLIC LICENSE')
@@ -282,7 +282,7 @@ describe('third-party notice generator', () => {
expect(licenses).toContain('GNU GENERAL PUBLIC LICENSE')
}
const serverInventory = server.files['THIRD_PARTY_DEPENDENCIES.md']
- expect(serverInventory).toContain('| aria2 | 1.37.0-motrix.18 |')
+ expect(serverInventory).toContain('| aria2 | 1.37.0-motrix.19 |')
expect(serverInventory).toContain('| motrix.filename-template | 1.1.1 |')
expect(serverInventory).not.toContain('| Electron |')
diff --git a/tests/scripts/assemble-release-artifacts.test.ts b/tests/scripts/assemble-release-artifacts.test.ts
index 6a522666..b993a187 100644
--- a/tests/scripts/assemble-release-artifacts.test.ts
+++ b/tests/scripts/assemble-release-artifacts.test.ts
@@ -1,3 +1,4 @@
+import { spawnSync } from 'node:child_process'
import { createHash } from 'node:crypto'
import {
access,
@@ -27,7 +28,7 @@ afterEach(async () => {
})
describe('assembleReleaseArtifacts', () => {
- it('flattens five targets and merges both macOS updater files', async () => {
+ it('flattens six targets and merges architecture-specific updater files', async () => {
const fixture = await createFixture()
const result = await assembleReleaseArtifacts({
@@ -42,6 +43,7 @@ describe('assembleReleaseArtifacts', () => {
'linux-x64',
'linux-arm64',
'win32-x64',
+ 'win32-arm64',
])
expect(result.manifests).toHaveLength(8)
expect(await readdir(fixture.output)).toEqual(
@@ -128,6 +130,93 @@ describe('assembleReleaseArtifacts', () => {
await expect(access(fixture.paths.macArm64Zip)).resolves.toBeUndefined()
})
+ it.each(['2.0.0', '2.0.0-beta.52'])(
+ 'preserves x64 updates while routing Windows ARM64 for %s',
+ async (version) => {
+ const fixture = await createFixture(version)
+ if (version.includes('-beta.')) {
+ for (const target of await readdir(fixture.input)) {
+ const directory = path.join(fixture.input, target, 'release')
+ for (const file of await readdir(directory)) {
+ if (file.startsWith('latest'))
+ await unlink(path.join(directory, file))
+ }
+ }
+ }
+ await assembleReleaseArtifacts({
+ inputDirectory: fixture.input,
+ outputDirectory: fixture.output,
+ version,
+ })
+ const name = version.includes('-beta.') ? 'beta.yml' : 'latest.yml'
+ const manifest = load(
+ await readFile(path.join(fixture.output, name), 'utf8')
+ ) as {
+ path: string
+ sha512: string
+ files: Array<{ url: string; sha512: string }>
+ }
+ expect(manifest.files.map((file) => file.url)).toEqual([
+ fixture.names.windowsExe,
+ fixture.names.windowsArm64Exe,
+ ])
+ expect(manifest.path).toBe(fixture.names.windowsExe)
+ expect(manifest.sha512).toBe(sha512(fixture.contents.windowsExe))
+ // Run the installed updater's real selector under both process architectures.
+ for (const arch of ['x64', 'arm64']) {
+ const result = spawnSync(
+ process.execPath,
+ [
+ '-e',
+ `
+ Object.defineProperty(process, 'arch', { value: ${JSON.stringify(arch)} });
+ const { findFile } = require('electron-updater/out/providers/Provider');
+ const files = JSON.parse(process.argv[1]).map(info => ({ info, url: new URL(info.url, 'https://dl.motrix.app/releases/') }));
+ process.stdout.write(findFile(files, 'exe').info.url);
+ `,
+ JSON.stringify(manifest.files),
+ ],
+ { encoding: 'utf8' }
+ )
+ expect(result.status, result.stderr).toBe(0)
+ expect(result.stdout).toBe(
+ arch === 'arm64'
+ ? fixture.names.windowsArm64Exe
+ : fixture.names.windowsExe
+ )
+ }
+ await expect(
+ verifyUpdateArtifacts({
+ directory: fixture.output,
+ version,
+ requireAll: true,
+ })
+ ).resolves.toBeDefined()
+ // A complete publication must not quietly lose the new architecture.
+ manifest.files.pop()
+ await writeFile(path.join(fixture.output, name), dump(manifest))
+ await expect(
+ verifyUpdateArtifacts({
+ directory: fixture.output,
+ version,
+ requireAll: true,
+ })
+ ).rejects.toThrow('Windows updates must list x64 then arm64')
+ }
+ )
+
+ it('rejects a missing Windows ARM64 installer', async () => {
+ const fixture = await createFixture()
+ await unlink(fixture.paths.windowsArm64Exe)
+ await expect(
+ assembleReleaseArtifacts({
+ inputDirectory: fixture.input,
+ outputDirectory: fixture.output,
+ version: VERSION,
+ })
+ ).rejects.toThrow('win32-arm64: required release asset')
+ })
+
it('rejects conflicting duplicate macOS manifest entries', async () => {
const fixture = await createFixture()
await writeManifest(
@@ -230,6 +319,7 @@ describe('assembleReleaseArtifacts', () => {
'linux-x64',
'linux-arm64',
'win32-x64',
+ 'win32-arm64',
]) {
const directory = path.join(
fixture.input,
@@ -694,6 +784,7 @@ async function createFixture(version = VERSION) {
macX64Dmg: `Motrix-${version}-x64.dmg`,
macX64Zip: `Motrix-${version}-x64.zip`,
windowsExe: `Motrix-Setup-${version}.exe`,
+ windowsArm64Exe: `Motrix-Setup-${version}-arm64.exe`,
}
const linuxArm64AppImageContent = Buffer.from('Linux arm64 AppImage')
const linuxX64AppImageContent = Buffer.from('Linux x64 AppImage')
@@ -720,6 +811,7 @@ async function createFixture(version = VERSION) {
macX64Dmg: Buffer.from('macOS x64 DMG'),
macX64Zip: Buffer.from('macOS x64 ZIP'),
windowsExe: Buffer.from('Windows x64 installer'),
+ windowsArm64Exe: Buffer.from('Windows ARM64 installer'),
}
const darwinArm64 = await makeTarget(input, 'darwin-arm64')
@@ -913,6 +1005,25 @@ async function createFixture(version = VERSION) {
names.windowsExe
)
+ const windowsArm64 = await makeTarget(input, 'win32-arm64')
+ await writeAsset(
+ windowsArm64,
+ names.windowsArm64Exe,
+ contents.windowsArm64Exe
+ )
+ const windowsArm64Zip = await writeAsset(
+ windowsArm64,
+ `Motrix-${version}-win-arm64.zip`
+ )
+ for (const manifest of ['latest.yml', 'beta.yml']) {
+ await writeManifest(
+ path.join(windowsArm64, manifest),
+ version,
+ [{ name: names.windowsArm64Exe, content: contents.windowsArm64Exe }],
+ names.windowsArm64Exe
+ )
+ }
+
return {
contents,
input,
@@ -937,6 +1048,8 @@ async function createFixture(version = VERSION) {
linuxX64Manifest,
macArm64Manifest,
macArm64Zip: macArm64Zip.path,
+ windowsArm64Exe: path.join(windowsArm64, names.windowsArm64Exe),
+ windowsArm64Zip: windowsArm64Zip.path,
windowsExe: path.join(windows, names.windowsExe),
windowsManifest,
windowsZip: windowsZip.path,
diff --git a/tests/scripts/before-pack-verify.test.ts b/tests/scripts/before-pack-verify.test.ts
index beb4ff3e..e2f6f472 100644
--- a/tests/scripts/before-pack-verify.test.ts
+++ b/tests/scripts/before-pack-verify.test.ts
@@ -23,6 +23,7 @@ describe('before-pack-verify', () => {
return {
electronPlatformName: platform,
arch,
+ targets: [],
packager: { projectDir },
}
}
@@ -233,13 +234,27 @@ describe('before-pack-verify', () => {
await expect(beforePack(context('win32'))).resolves.toBeUndefined()
})
- it('accepts Windows arm64 PE files for the reserved target contract', async () => {
+ it('accepts Windows arm64 PE files and names both release targets', async () => {
await writeStage('win32', 'arm64')
await writeBinary(enginePath('win32', 'arm64'), 0o644, 'win32', 'arm64')
await writeBinary(hostPath('win32', 'arm64'), 0o644, 'win32', 'arm64')
await writeBinary(finalizePath('win32', 'arm64'), 0o644, 'win32', 'arm64')
- await expect(beforePack(context('win32', 3))).resolves.toBeUndefined()
+ const buildContext = {
+ ...context('win32', 3),
+ targets: [
+ { name: 'nsis', options: { artifactName: 'legacy.exe' } },
+ { name: 'zip', options: undefined },
+ ],
+ }
+ await expect(beforePack(buildContext)).resolves.toBeUndefined()
+ expect(buildContext.targets.map((target) => target.options)).toEqual([
+ {
+ artifactName: `\${productName}-Setup-\${version}-arm64.\${ext}`,
+ buildUniversalInstaller: false,
+ },
+ { artifactName: `\${productName}-\${version}-win-arm64.\${ext}` },
+ ])
})
it('rejects an MZ-only Windows file without a PE/COFF target header', async () => {
diff --git a/tests/scripts/electron-package-contract.test.ts b/tests/scripts/electron-package-contract.test.ts
index a9e0235f..f255e81a 100644
--- a/tests/scripts/electron-package-contract.test.ts
+++ b/tests/scripts/electron-package-contract.test.ts
@@ -224,6 +224,7 @@ describe('Electron package contracts', () => {
'darwin-x64',
'linux-arm64',
'linux-x64',
+ 'win32-arm64',
'win32-x64',
],
common: [
diff --git a/tests/scripts/fetch-engine-path-parity.test.ts b/tests/scripts/fetch-engine-path-parity.test.ts
index c316bd96..242cc4f7 100644
--- a/tests/scripts/fetch-engine-path-parity.test.ts
+++ b/tests/scripts/fetch-engine-path-parity.test.ts
@@ -13,6 +13,7 @@ const MATRIX: Array<[NodeJS.Platform, string]> = [
['darwin', 'arm64'],
['darwin', 'x64'],
['win32', 'x64'],
+ ['win32', 'arm64'],
['win32', 'ia32'],
['linux', 'x64'],
['linux', 'arm64'],
diff --git a/tests/scripts/fetch-engine.test.ts b/tests/scripts/fetch-engine.test.ts
index 90bcfb85..0891d5e7 100644
--- a/tests/scripts/fetch-engine.test.ts
+++ b/tests/scripts/fetch-engine.test.ts
@@ -17,6 +17,7 @@ import {
resolveExtractCommand,
resolveHostKey,
run,
+ runWriteLock,
selectKeys,
sha256Hex,
verifyDigest,
@@ -458,6 +459,40 @@ describe('run', () => {
expect(s.downloads).toHaveLength(0)
})
+ it('fails closed when Windows ARM64 is missing from the engine lock', async () => {
+ const s = makeStub({
+ host: { platform: 'win32', arch: 'arm64' },
+ lock: makeLock(['win32-x64']),
+ })
+ expect(await run([], s.deps)).toBe(EXIT_FAILURE)
+ expect(s.errors.join('\n')).toContain(
+ 'supported desktop target win32-arm64 is missing from the lockfile'
+ )
+ expect(await run(['--platform', 'win32', '--arch', 'arm64'], s.deps)).toBe(
+ EXIT_USAGE
+ )
+ expect(s.downloads).toHaveLength(0)
+ })
+
+ it('installs the pinned Windows ARM64 binary without an x64 fallback', async () => {
+ const s = makeStub({
+ host: { platform: 'win32', arch: 'arm64' },
+ lock: makeLock(['win32-x64', 'win32-arm64']),
+ archive: ARCHIVE,
+ binary: BINARY,
+ })
+ expect(await run([], s.deps)).toBe(EXIT_OK)
+ expect(s.downloads).toEqual([
+ 'https://github.com/motrixapp/aria2/releases/download/v1/aria2c-1-win32-arm64.zip',
+ ])
+ expect(
+ s.files.get(path.join('/extra', 'win32', 'arm64', 'aria2c.exe'))
+ ).toEqual(BINARY)
+ expect(s.files.has(path.join('/extra', 'win32', 'x64', 'aria2c.exe'))).toBe(
+ false
+ )
+ })
+
it('--all installs every lockfile key', async () => {
const s = makeStub({
lock: makeLock(['darwin-arm64', 'linux-x64', 'win32-x64']),
@@ -510,6 +545,59 @@ describe('run', () => {
})
})
+describe('runWriteLock', () => {
+ const version = '1.37.0-motrix.19'
+ const files = [
+ `aria2c-${version}-darwin-arm64.tar.gz`,
+ `aria2c-${version}-darwin-x64.tar.gz`,
+ `aria2c-${version}-win32-arm64.zip`,
+ `aria2c-${version}-win32-x64.zip`,
+ `aria2c-${version}-win32-ia32.zip`,
+ `aria2c-${version}-linux-x64.tar.gz`,
+ `aria2c-${version}-linux-arm64.tar.gz`,
+ `aria2c-${version}-linux-armv7l.tar.gz`,
+ ]
+
+ it.each([true, false])(
+ 'requires a verified Windows ARM64 archive before writing (present=%s)',
+ async (includeArm64) => {
+ const archive = Buffer.from('verified archive')
+ const binary = Buffer.from('verified binary')
+ const stub = makeStub({ archive, binary })
+ const sums = files
+ .filter((file) => includeArm64 || !file.endsWith('win32-arm64.zip'))
+ .map((file) => `${sha256Hex(archive)} ${file}`)
+ .join('\n')
+ const writes: Array<{ assets: Record<string, unknown> }> = []
+ const deps = {
+ ...stub.deps,
+ download: async (url: string) =>
+ url.endsWith('/SHA256SUMS') ? Buffer.from(sums) : archive,
+ writeLockFile: async (lock: { assets: Record<string, unknown> }) => {
+ writes.push(lock)
+ },
+ }
+ const result = await runWriteLock({ tag: `v${version}` }, null, deps)
+ expect(result).toBe(includeArm64 ? EXIT_OK : EXIT_FAILURE)
+ if (includeArm64) {
+ expect(writes).toHaveLength(1)
+ expect(Object.keys(writes[0].assets)).toHaveLength(8)
+ expect(writes[0].assets['win32-arm64']).toEqual({
+ file: `aria2c-${version}-win32-arm64.zip`,
+ bin: 'aria2c.exe',
+ archiveSha256: sha256Hex(archive),
+ binarySha256: sha256Hex(binary),
+ })
+ } else {
+ expect(writes).toEqual([])
+ expect(stub.errors.join('\n')).toContain(
+ `SHA256SUMS is missing aria2c-${version}-win32-arm64.zip`
+ )
+ }
+ }
+ )
+})
+
// A1 — GNU tar (Linux) cannot read a .zip, so extraction must dispatch by
// extension: .zip prefers unzip (falls back to tar only when unzip is absent),
// .tar.gz always uses `tar -xzf`.
diff --git a/tests/scripts/release-signing-input.test.ts b/tests/scripts/release-signing-input.test.ts
index 7a9003d6..dbda5d6c 100644
--- a/tests/scripts/release-signing-input.test.ts
+++ b/tests/scripts/release-signing-input.test.ts
@@ -177,6 +177,40 @@ describe('isolated release signing input', () => {
})
})
+ it('isolates Windows ARM64 signing inputs and rejects an x64 target claim', async () => {
+ const { directory } = await createGeneratedSigningInput(
+ [
+ ['extra/win32/arm64/aria2c.exe', 'ARM64 aria2'],
+ [
+ 'packages/native-host/dist/win32-arm64/motrix-native-host.exe',
+ 'ARM64 native host',
+ ],
+ [
+ 'packages/finalize-fs/dist/win32-arm64/motrix-finalize-fs.exe',
+ 'ARM64 finalize filesystem sidecar',
+ ],
+ ['release/size-reports/win32-arm64.json', '{}'],
+ ],
+ [],
+ { platform: 'win32', arch: 'arm64' }
+ )
+ await expect(
+ verifySigningInput({
+ mode: 'verify',
+ directory,
+ platform: 'win32',
+ arch: 'arm64',
+ commit: COMMIT,
+ })
+ ).resolves.toMatchObject({
+ target: { key: 'win32-arm64', platform: 'win32', arch: 'arm64' },
+ })
+ await expect(verify(directory)).rejects.toThrow()
+ await expect(
+ readFile(path.join(directory, 'extra/win32/x64/aria2c.exe'))
+ ).rejects.toThrow()
+ })
+
it.each(['arm64', 'x64'] as const)(
'preserves shutdown permission metadata through isolated macOS signing: %s',
async (arch) => {
diff --git a/tests/scripts/smoke-electron-cleanup.test.ts b/tests/scripts/smoke-electron-cleanup.test.ts
new file mode 100644
index 00000000..2d0b3497
--- /dev/null
+++ b/tests/scripts/smoke-electron-cleanup.test.ts
@@ -0,0 +1,199 @@
+// @vitest-environment node
+
+import { EventEmitter } from 'node:events'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { stopPackagedApp } from '../../scripts/smoke-electron-package.mjs'
+import { MenuItemIds } from '../../src/main/menu/menu-ids'
+import { Commands } from '../../src/shared/protocol/commands'
+import { Queries } from '../../src/shared/protocol/queries'
+
+class OwnedChild extends EventEmitter {
+ pid = 4321
+ exitCode: number | null = null
+ signalCode: string | null = null
+ kill = vi.fn()
+
+ exit(code: number | null, signal: string | null = null) {
+ this.exitCode = code
+ this.signalCode = signal
+ this.emit('exit', code, signal)
+ }
+}
+
+afterEach(() => {
+ vi.useRealTimers()
+ vi.unstubAllGlobals()
+})
+
+describe('packaged Electron shutdown', () => {
+ it('requests the current menu quit action before waiting for Windows exit', async () => {
+ vi.useFakeTimers()
+ const child = new OwnedChild()
+ const execFile = vi.fn()
+ const invoke = vi.fn(async (channel) => {
+ expect(child.listenerCount('exit')).toBe(1)
+ if (channel === Queries.GetApplicationMenu) return { revision: 7 }
+ child.exit(0)
+ throw new Error('Execution context was destroyed')
+ })
+ vi.stubGlobal('window', { motrix: { invoke } })
+ const page = {
+ evaluate: vi.fn(async (action, channels) => action(channels)),
+ }
+
+ await expect(
+ stopPackagedApp(child, page, { platform: 'win32', execFile })
+ ).resolves.toBeUndefined()
+ expect(invoke.mock.calls).toEqual([
+ [Queries.GetApplicationMenu],
+ [
+ Commands.ExecuteApplicationMenuItem,
+ {
+ itemId: MenuItemIds.AppQuit,
+ revision: 7,
+ trigger: 'menu',
+ selectedTaskId: null,
+ },
+ ],
+ ])
+ expect(execFile).not.toHaveBeenCalled()
+ expect(child.kill).not.toHaveBeenCalled()
+ expect(child.listenerCount('exit')).toBe(0)
+ expect(child.listenerCount('error')).toBe(0)
+ expect(vi.getTimerCount()).toBe(0)
+ })
+
+ it.each(['darwin', 'linux'])(
+ 'retains graceful SIGTERM handling on %s',
+ async (platform) => {
+ vi.useFakeTimers()
+ const child = new OwnedChild()
+ const page = { evaluate: vi.fn() }
+ const execFile = vi.fn()
+ child.kill.mockImplementation((signal) => {
+ expect(child.listenerCount('exit')).toBe(1)
+ expect(signal).toBe('SIGTERM')
+ child.exit(0)
+ })
+ await expect(
+ stopPackagedApp(child, page, { platform, execFile })
+ ).resolves.toBeUndefined()
+ expect(child.kill).toHaveBeenCalledOnce()
+ expect(page.evaluate).not.toHaveBeenCalled()
+ expect(execFile).not.toHaveBeenCalled()
+ expect(child.listenerCount('exit')).toBe(0)
+ expect(vi.getTimerCount()).toBe(0)
+ }
+ )
+
+ it('bounds a hung IPC and kills only the owned Windows process tree without passing', async () => {
+ vi.useFakeTimers()
+ const child = new OwnedChild()
+ const execFile = vi.fn(async () => {
+ child.exit(1)
+ })
+ const page = { evaluate: vi.fn(() => new Promise(() => {})) }
+ const stopped = stopPackagedApp(child, page, {
+ platform: 'win32',
+ timeoutMs: 100,
+ forceTimeoutMs: 50,
+ execFile,
+ })
+ const failed = expect(stopped).rejects.toThrow(
+ 'graceful shutdown timed out after 100ms'
+ )
+ await vi.advanceTimersByTimeAsync(99)
+ expect(execFile).not.toHaveBeenCalled()
+ await vi.advanceTimersByTimeAsync(1)
+ await failed
+ expect(execFile).toHaveBeenCalledWith(
+ 'taskkill.exe',
+ ['/PID', '4321', '/T', '/F'],
+ { windowsHide: true, timeout: 50 }
+ )
+ expect(child.kill).not.toHaveBeenCalled()
+ expect(child.listenerCount('exit')).toBe(0)
+ expect(vi.getTimerCount()).toBe(0)
+ })
+
+ it('keeps IPC failure diagnostic and bounds fallback cleanup that never finishes', async () => {
+ vi.useFakeTimers()
+ const child = new OwnedChild()
+ const page = {
+ evaluate: vi.fn(async () => {
+ throw new Error('menu unavailable')
+ }),
+ }
+ const execFile = vi.fn(() => new Promise(() => {}))
+ const stopped = stopPackagedApp(child, page, {
+ platform: 'win32',
+ timeoutMs: 100,
+ forceTimeoutMs: 50,
+ execFile,
+ })
+ const failed = expect(stopped).rejects.toThrow(
+ /shutdown and cleanup failed:.*menu unavailable; app cleanup timed out after 50ms/
+ )
+ await vi.advanceTimersByTimeAsync(150)
+ await failed
+ expect(execFile).toHaveBeenCalledOnce()
+ expect(child.listenerCount('exit')).toBe(0)
+ expect(child.listenerCount('error')).toBe(0)
+ expect(vi.getTimerCount()).toBe(0)
+ })
+
+ it('cleans up a startup failure with no page without waiting for an IPC deadline', async () => {
+ vi.useFakeTimers()
+ const child = new OwnedChild()
+ const execFile = vi.fn(async () => {
+ child.exit(1)
+ })
+ await expect(
+ stopPackagedApp(child, undefined, {
+ platform: 'win32',
+ execFile,
+ })
+ ).rejects.toThrow('main renderer is unavailable')
+ expect(execFile).toHaveBeenCalledOnce()
+ expect(child.listenerCount('exit')).toBe(0)
+ expect(vi.getTimerCount()).toBe(0)
+ })
+
+ it('rejects a nonzero app exit and never taskkills an already exited PID', async () => {
+ const child = new OwnedChild()
+ const execFile = vi.fn()
+ const page = {
+ evaluate: vi.fn(async () => {
+ child.exit(2)
+ }),
+ }
+ await expect(
+ stopPackagedApp(child, page, {
+ platform: 'win32',
+ execFile,
+ })
+ ).rejects.toThrow('code=2')
+ expect(execFile).not.toHaveBeenCalled()
+ expect(child.listenerCount('exit')).toBe(0)
+ })
+
+ it('uses a bounded Unix fallback only after graceful shutdown fails', async () => {
+ vi.useFakeTimers()
+ const child = new OwnedChild()
+ child.kill.mockImplementation((signal) => {
+ if (signal === 'SIGKILL') child.exit(null, 'SIGKILL')
+ })
+ const page = { evaluate: vi.fn(() => new Promise(() => {})) }
+ const stopped = stopPackagedApp(child, page, {
+ platform: 'linux',
+ timeoutMs: 100,
+ })
+ const failed = expect(stopped).rejects.toThrow(
+ 'graceful shutdown timed out'
+ )
+ await vi.advanceTimersByTimeAsync(100)
+ await failed
+ expect(child.kill.mock.calls).toEqual([['SIGTERM'], ['SIGKILL']])
+ expect(vi.getTimerCount()).toBe(0)
+ })
+})
diff --git a/tests/scripts/stage-electron-app.test.ts b/tests/scripts/stage-electron-app.test.ts
index d9bfb1a6..859bf81d 100644
--- a/tests/scripts/stage-electron-app.test.ts
+++ b/tests/scripts/stage-electron-app.test.ts
@@ -63,6 +63,7 @@ function fixtureContract() {
'darwin-x64',
'linux-arm64',
'linux-x64',
+ 'win32-arm64',
'win32-x64',
],
common: ['@scope/pkg', 'alpha', 'gamma'],
@@ -132,6 +133,7 @@ async function createNativeFixture(): Promise<string> {
'darwin-x64',
'linux-arm64',
'linux-x64',
+ 'win32-arm64',
'win32-x64',
]) {
const separator = target.lastIndexOf('-')
@@ -422,7 +424,7 @@ describe('stageElectronApp', () => {
stageElectronApp({
repoRoot: root,
platform: 'win32',
- arch: 'arm64',
+ arch: 'ia32',
strict: true,
contract: fixtureContract(),
})
@@ -453,6 +455,7 @@ describe('stageElectronApp', () => {
['darwin', 'x64'],
['linux', 'arm64'],
['linux', 'x64'],
+ ['win32', 'arm64'],
['win32', 'x64'],
])('filters native and WASM content for %s-%s', async (platform, arch) => {
const root = await createNativeFixture()
diff --git a/tests/scripts/windows-artifact-names.test.ts b/tests/scripts/windows-artifact-names.test.ts
new file mode 100644
index 00000000..c89797d7
--- /dev/null
+++ b/tests/scripts/windows-artifact-names.test.ts
@@ -0,0 +1,166 @@
+import { readFile } from 'node:fs/promises'
+import { createRequire } from 'node:module'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, it } from 'vitest'
+import {
+ configureWindowsArtifactNames,
+ windowsArtifactNamePatterns,
+} from '../../scripts/windows-artifact-names.mjs'
+
+const require = createRequire(import.meta.url)
+const REPOSITORY_ROOT = path.resolve(
+ path.dirname(fileURLToPath(import.meta.url)),
+ '../..'
+)
+
+async function resolveConfiguredWindowsTargets(
+ configPath: string,
+ cliOptions: { win: string[]; x64?: boolean; arm64?: boolean }
+) {
+ require('app-builder-lib')
+ const { Platform } = require('app-builder-lib')
+ const { WinPackager } = require('app-builder-lib/out/winPackager')
+ const { normalizeOptions } = require('electron-builder/out/builder')
+ const {
+ computeArchToTargetNamesMap,
+ } = require('app-builder-lib/out/targets/targetFactory')
+ const config = JSON.parse(
+ await readFile(path.join(REPOSITORY_ROOT, configPath), 'utf8')
+ )
+ const packager = new WinPackager({
+ config,
+ metadata: { name: 'motrix', version: '2.0.0-beta.52' },
+ })
+ const options = normalizeOptions(cliOptions)
+ return computeArchToTargetNamesMap(
+ options.targets.get(Platform.WINDOWS),
+ packager,
+ Platform.WINDOWS
+ )
+}
+
+describe.each(['electron-builder.json', 'electron-builder.signing.json'])(
+ '%s Windows architecture selection',
+ (configPath) => {
+ it.each([
+ ['x64', false],
+ ['arm64', false],
+ ['x64', true],
+ ['arm64', true],
+ ])('selects only %s with explicit targets=%s', async (arch, explicit) => {
+ const { Arch } = require('builder-util')
+ const actual = await resolveConfiguredWindowsTargets(configPath, {
+ win: explicit ? ['nsis', 'zip'] : [],
+ [arch]: true,
+ })
+ expect([...actual]).toEqual([[Arch[arch], ['nsis', 'zip']]])
+ })
+
+ it('inherits the host architecture when no CLI architecture is selected', async () => {
+ const { Arch } = require('builder-util')
+ const actual = await resolveConfiguredWindowsTargets(configPath, {
+ win: [],
+ })
+ expect([...actual]).toEqual([[Arch[process.arch], ['nsis', 'zip']]])
+ })
+ }
+)
+
+describe('Windows artifact names', () => {
+ it('retains the existing x64 URLs and distinguishes ARM64 downloads', () => {
+ expect(windowsArtifactNamePatterns('x64')).toEqual({
+ nsis: `\${productName}-Setup-\${version}.\${ext}`,
+ zip: `\${productName}-\${version}-win.\${ext}`,
+ })
+ expect(windowsArtifactNamePatterns('arm64')).toEqual({
+ nsis: `\${productName}-Setup-\${version}-arm64.\${ext}`,
+ zip: `\${productName}-\${version}-win-arm64.\${ext}`,
+ })
+ expect(() => windowsArtifactNamePatterns('ia32')).toThrow(
+ 'unsupported Windows artifact architecture'
+ )
+ })
+
+ it('updates constructed targets without changing shared builder options', () => {
+ const sharedOptions = { artifactName: 'custom.exe', oneClick: false }
+ const targets = [
+ { name: 'nsis', options: sharedOptions },
+ { name: 'zip', options: undefined },
+ { name: 'dir', options: undefined },
+ ]
+ configureWindowsArtifactNames(targets, 'arm64')
+
+ expect(targets[0].options).toEqual({
+ artifactName: `\${productName}-Setup-\${version}-arm64.\${ext}`,
+ oneClick: false,
+ buildUniversalInstaller: false,
+ })
+ expect(targets[1].options).toEqual({
+ artifactName: `\${productName}-\${version}-win-arm64.\${ext}`,
+ })
+ expect(targets[2].options).toBeUndefined()
+ expect(sharedOptions).toEqual({
+ artifactName: 'custom.exe',
+ oneClick: false,
+ })
+
+ configureWindowsArtifactNames(targets, 'x64')
+ expect(targets[0].options?.artifactName).toBe(
+ `\${productName}-Setup-\${version}.\${ext}`
+ )
+ expect(targets[1].options?.artifactName).toBe(
+ `\${productName}-\${version}-win.\${ext}`
+ )
+ })
+
+ it.each([
+ ['x64', 1, ''],
+ ['arm64', 3, '-arm64'],
+ ])('configures real electron-builder %s targets', (arch, ordinal, suffix) => {
+ // Initialize the entry point first because the builder platform modules
+ // have circular dependencies. Exercise the installed pinned constructors,
+ // including their resolved options, without invoking a native build.
+ require('app-builder-lib')
+ const { WinPackager } = require('app-builder-lib/out/winPackager')
+ const {
+ NsisTarget,
+ } = require('app-builder-lib/out/targets/nsis/NsisTarget')
+ const {
+ ArchiveTarget,
+ } = require('app-builder-lib/out/targets/ArchiveTarget')
+ const {
+ AppPackageHelper,
+ CopyElevateHelper,
+ } = require('app-builder-lib/out/targets/nsis/nsisUtil')
+ const packager = new WinPackager({
+ config: {
+ productName: 'Motrix',
+ win: {},
+ nsis: { artifactName: 'legacy-installer.exe', oneClick: false },
+ },
+ metadata: { name: 'motrix', version: '2.0.0-beta.52' },
+ })
+ const nsis = new NsisTarget(
+ packager,
+ '/release',
+ 'nsis',
+ new AppPackageHelper(new CopyElevateHelper())
+ )
+ const zip = new ArchiveTarget('zip', '/release', packager)
+
+ expect(nsis.options).not.toBe(packager.config.nsis)
+ expect(zip.options).toBeUndefined()
+ configureWindowsArtifactNames([nsis, zip], arch)
+ expect(nsis.shouldBuildUniversalInstaller).toBe(false)
+ expect(nsis.options.oneClick).toBe(false)
+ expect(
+ packager.expandArtifactNamePattern(nsis.options, 'exe', ordinal)
+ ).toBe(`Motrix-Setup-2.0.0-beta.52${suffix}.exe`)
+ expect(
+ packager.expandArtifactNamePattern(zip.options, 'zip', ordinal)
+ ).toBe(`Motrix-2.0.0-beta.52-win${suffix}.zip`)
+ expect(packager.config.nsis.artifactName).toBe('legacy-installer.exe')
+ expect(packager.config.zip).toBeUndefined()
+ })
+})
diff --git a/tests/scripts/workflow-release-matrix.test.ts b/tests/scripts/workflow-release-matrix.test.ts
index 631173c4..54622c82 100644
--- a/tests/scripts/workflow-release-matrix.test.ts
+++ b/tests/scripts/workflow-release-matrix.test.ts
@@ -189,6 +189,13 @@ const EXPECTED_TARGETS: ExpectedTarget[] = [
arch: 'x64',
rustTarget: 'x86_64-pc-windows-msvc',
},
+ {
+ key: 'win32-arm64',
+ os: 'windows-11-arm',
+ platform: 'win32',
+ arch: 'arm64',
+ rustTarget: 'aarch64-pc-windows-msvc',
+ },
]
const EXPECTED_APP_PATHS = new Map([
['darwin-arm64', 'release/mac-arm64/Motrix.app'],
@@ -196,6 +203,7 @@ const EXPECTED_APP_PATHS = new Map([
['linux-arm64', 'release/linux-arm64-unpacked'],
['linux-x64', 'release/linux-unpacked'],
['win32-x64', 'release/win-unpacked'],
+ ['win32-arm64', 'release/win-arm64-unpacked'],
])
const ciSource = readFileSync(
@@ -253,7 +261,7 @@ describe('CI and release target matrix contract', () => {
['CI', ciWorkflow],
['release', releaseWorkflow],
] as const)(
- '%s matrix contains exactly the five supported targets',
+ '%s matrix contains exactly the six supported targets',
(_, workflow) => {
const { entries } = targetMatrix(workflow)
const actual = entries
@@ -383,7 +391,9 @@ describe('CI and release target matrix contract', () => {
expect(steps[verifierIndex]?.['continue-on-error']).not.toBe(true)
}
expect(stringField(uploadInputs, 'path')).toContain(
- `release/size-reports/\${{ matrix.target }}.json`
+ label === 'CI'
+ ? `release/size-reports/\${{ matrix.target }}*.json`
+ : `release/size-reports/\${{ matrix.target }}.json`
)
expect(stringField(uploadInputs, 'if-no-files-found')).toBe('error')
expect(steps.indexOf(upload as LooseRecord)).toBeGreaterThan(
@@ -392,6 +402,30 @@ describe('CI and release target matrix contract', () => {
}
)
+ it.each([
+ ['CI', ciWorkflow],
+ ['release', releaseWorkflow],
+ ] as const)(
+ '%s executes Windows packages on native runners before publishing',
+ (_, workflow) => {
+ const steps = jobSteps(targetMatrix(workflow).job)
+ const step = steps.find(
+ (entry) => entry.name === 'Smoke test native Windows Electron runtime'
+ )
+ expect(step).toBeDefined()
+ expect(stringField(step as LooseRecord, 'if')).toBe(
+ "matrix.platform == 'win32'"
+ )
+ expect(stringField(step as LooseRecord, 'run')).toContain(
+ 'pnpm run smoke:electron-package --'
+ )
+ expect(stringField(step as LooseRecord, 'run')).toContain(
+ `--arch \${{ matrix.arch }}`
+ )
+ expect(step?.['continue-on-error']).not.toBe(true)
+ }
+ )
+
it('hydrates the Electron runtime after install and before the release notice gate', () => {
const steps = jobSteps(targetMatrix(releaseWorkflow).job)
const dependencyIndex = steps.findIndex(
@@ -1529,6 +1563,66 @@ describe('release workflow publication contract', () => {
}
})
+ it('finalizes Windows assets with the names required by release assembly', () => {
+ const sign = asRecord(workflowJobs(releaseWorkflow).sign, 'sign job')
+ require('app-builder-lib')
+ const { WinPackager } = require('app-builder-lib/out/winPackager')
+ const {
+ NsisTarget,
+ } = require('app-builder-lib/out/targets/nsis/NsisTarget')
+ const {
+ ArchiveTarget,
+ } = require('app-builder-lib/out/targets/ArchiveTarget')
+ const {
+ AppPackageHelper,
+ CopyElevateHelper,
+ } = require('app-builder-lib/out/targets/nsis/nsisUtil')
+ const version = '2.0.0-beta.52'
+ for (const entry of matrixEntries(sign, 'sign')) {
+ if (entry.platform !== 'win32') continue
+ const config = JSON.parse(signingConfigSource)
+ const args = stringField(entry, 'electron_builder_args')
+ // The quoted macros must survive PowerShell unchanged. Apply exactly
+ // those reviewed overrides to the installed builder's real targets.
+ for (const [, section, pattern] of args.matchAll(
+ /'-c\.(nsis|win)\.artifactName=([^']+)'/g
+ )) {
+ config[section!].artifactName = pattern
+ }
+ const packager = new WinPackager({
+ config,
+ metadata: { name: 'motrix', version },
+ })
+ const nsis = new NsisTarget(
+ packager,
+ '/release',
+ 'nsis',
+ new AppPackageHelper(new CopyElevateHelper())
+ )
+ const zip = new ArchiveTarget('zip', '/release', packager)
+ const arch = entry.arch === 'arm64' ? 3 : 1
+ expect(nsis.shouldBuildUniversalInstaller).toBe(false)
+ const actual = [
+ packager.expandArtifactNamePattern(nsis.options, 'exe', arch),
+ packager.expandArtifactNamePattern(
+ zip.options,
+ 'zip',
+ arch,
+ `\${productName}-\${version}-win.\${ext}`,
+ false
+ ),
+ ]
+ const target = RELEASE_TARGETS.find(
+ (candidate: { name: string }) => candidate.name === entry.target
+ )
+ expect(actual).toEqual(target.assetNames(version))
+ if (entry.arch === 'arm64') {
+ expect(args).toContain("'-c.nsis.artifactName=")
+ expect(args).toContain("'-c.win.artifactName=")
+ }
+ }
+ })
+
it('isolates signing credentials behind platform-specific environments', () => {
const jobs = workflowJobs(releaseWorkflow)
const build = asRecord(jobs.build, 'build job')
@@ -1544,7 +1638,7 @@ describe('release workflow publication contract', () => {
)
const entries = matrixEntries(sign, 'sign')
expect(entries.map((entry) => stringField(entry, 'target')).sort()).toEqual(
- ['darwin-arm64', 'darwin-x64', 'win32-x64']
+ ['darwin-arm64', 'darwin-x64', 'win32-arm64', 'win32-x64']
)
for (const entry of entries) {
expect(stringField(entry, 'electron_sha256')).toMatch(/^[0-9a-f]{64}$/)