fix(desktop): proxy avatars and cross-compile per OS
Avatar requests now go to the selected server, since the bundled UI strips sharp. Windows and Linux runners build both architectures, so three machines cover all five targets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b6f61eef1b
commit
a6751f586d
4 files changed
+27
-24
No files matched your search
@@ -8,7 +8,8 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Native host runners, not the Docker-image runner. See the desktop README.
|
||||
# Host runners, not the Docker-image runner. Each runner cross-compiles
|
||||
# both architectures for its OS. See the desktop README.
|
||||
name: Desktop ${{ matrix.target }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: 720
|
||||
@@ -17,21 +18,21 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- target: windows-x64
|
||||
runner: desktop-windows-x64
|
||||
runner: desktop-windows
|
||||
arch: x64
|
||||
source: ${{ vars.DESKTOP_ELECTRON_SOURCE_WINDOWS_X64 }}
|
||||
source: ${{ vars.DESKTOP_ELECTRON_SOURCE_WINDOWS }}
|
||||
- target: windows-arm64
|
||||
runner: desktop-windows-arm64
|
||||
runner: desktop-windows
|
||||
arch: arm64
|
||||
source: ${{ vars.DESKTOP_ELECTRON_SOURCE_WINDOWS_ARM64 }}
|
||||
source: ${{ vars.DESKTOP_ELECTRON_SOURCE_WINDOWS }}
|
||||
- target: linux-x64
|
||||
runner: desktop-linux-x64
|
||||
runner: desktop-linux
|
||||
arch: x64
|
||||
source: ${{ vars.DESKTOP_ELECTRON_SOURCE_LINUX_X64 }}
|
||||
source: ${{ vars.DESKTOP_ELECTRON_SOURCE_LINUX }}
|
||||
- target: linux-arm64
|
||||
runner: desktop-linux-arm64
|
||||
runner: desktop-linux
|
||||
arch: arm64
|
||||
source: ${{ vars.DESKTOP_ELECTRON_SOURCE_LINUX_ARM64 }}
|
||||
source: ${{ vars.DESKTOP_ELECTRON_SOURCE_LINUX }}
|
||||
- target: macos-universal
|
||||
runner: desktop-macos
|
||||
arch: universal
|
||||
|
||||
+13
-10
@@ -30,7 +30,7 @@ pnpm build:desktop:runtime
|
||||
|
||||
This generates `src/out/otunes-<arch>/args.gn`, runs GN and Ninja, and extracts `dist.zip` into `apps/desktop/runtime/45.3.0-<platform>-<arch>`. It writes a runtime marker recording the version, platform, architecture and codec build setting. Packaging requires that marker and never downloads stock Electron as a fallback. The marker records build provenance, not a successful decoding test. Keep it with the extracted runtime.
|
||||
|
||||
Build natively for Windows and Linux. On macOS, `OTUNES_ELECTRON_ARCH=x64` or `arm64` selects the target CPU, allowing both slices to be compiled on one Mac. The scripts pin Electron 45.3.0. Update `electronVersion` in `scripts/config.mjs` and the checkout tag together when upgrading. The runtime output directory must not already exist. Move or remove a previous output before rebuilding.
|
||||
`OTUNES_ELECTRON_ARCH=x64` or `arm64` selects the target CPU, so one machine per OS can build both architectures. See the cross-compiling notes under Gitea builds. The scripts pin Electron 45.3.0. Update `electronVersion` in `scripts/config.mjs` and the checkout tag together when upgrading. The runtime output directory must not already exist. Move or remove a previous output before rebuilding.
|
||||
|
||||
## Run and package
|
||||
|
||||
@@ -51,19 +51,22 @@ The desktop gateway binds only to `127.0.0.1:47836`. A single instance owns that
|
||||
|
||||
`.gitea/workflows/desktop-build.yml` runs manually through `workflow_dispatch` and on `v*` tags, matching the Docker workflow. It builds the custom Electron runtime before each installer and uploads installers to the Actions run with `actions/upload-artifact@v3`. It does not create releases or publish to Flathub. Tags set the installer version, so use semantic version tags such as `v1.2.3`. Manual runs use the desktop package version.
|
||||
|
||||
Register these **native host** Gitea runner labels with `:host` execution, not Docker execution:
|
||||
Register these **host** Gitea runner labels with `:host` execution, not Docker execution. Each Windows and Linux runner cross-compiles both x64 and ARM64, so three machines cover all five targets:
|
||||
|
||||
| Runner label | Native Node architecture | Repository Actions variable for the Electron `src` path | Output |
|
||||
| Runner label | Host CPU | Repository Actions variable for the Electron `src` path | Output |
|
||||
| --- | --- | --- | --- |
|
||||
| `desktop-windows-x64` | x64 | `DESKTOP_ELECTRON_SOURCE_WINDOWS_X64` | x64 NSIS installer |
|
||||
| `desktop-windows-arm64` | arm64 | `DESKTOP_ELECTRON_SOURCE_WINDOWS_ARM64` | ARM64 NSIS installer |
|
||||
| `desktop-linux-x64` | x64 | `DESKTOP_ELECTRON_SOURCE_LINUX_X64` | x86-64 Flatpak |
|
||||
| `desktop-linux-arm64` | arm64 | `DESKTOP_ELECTRON_SOURCE_LINUX_ARM64` | AArch64 Flatpak |
|
||||
| `desktop-windows` | x64 | `DESKTOP_ELECTRON_SOURCE_WINDOWS` | x64 and ARM64 NSIS installers |
|
||||
| `desktop-linux` | x64 | `DESKTOP_ELECTRON_SOURCE_LINUX` | x86-64 and AArch64 Flatpaks |
|
||||
| `desktop-macos` | x64 or arm64 | `DESKTOP_ELECTRON_SOURCE_MACOS` | Universal DMG |
|
||||
|
||||
Here x86 means x86-64, not 32-bit IA-32. The workflow installs Node.js 24 and pnpm 10.1.0. The runner and its bootstrap Node.js must themselves be native to the requested architecture. Each runner also needs Git, Bash, Electron's platform build prerequisites, `depot_tools` on PATH, and a synced Electron v45.3.0 checkout prepared as described above. The source path is an absolute path outside the disposable Actions checkout. Separate build machines or checkouts avoid concurrent source-tree builds. GN/Ninja outputs remain in that source tree for incremental rebuilds. The workflow does not update that shared checkout or run `gclient sync` automatically.
|
||||
Here x86 means x86-64, not 32-bit IA-32. The workflow installs Node.js 24 and pnpm 10.1.0. Each runner needs Git, Bash, Electron's platform build prerequisites, `depot_tools` on PATH, and a synced Electron v45.3.0 checkout prepared as described above. The source path is an absolute path outside the disposable Actions checkout. Both architectures share one checkout with separate `out/otunes-<arch>` directories, so set runner capacity to 1. GN/Ninja outputs remain in that source tree for incremental rebuilds. The workflow does not update that shared checkout or run `gclient sync` automatically.
|
||||
|
||||
Windows runners need Visual Studio's Electron/Chromium build components and SDK, plus Developer Mode or symlink permissions. The ARM64 runner needs the ARM64 compiler tools. Mac runners need Xcode, its command-line tools, and both macOS SDK architectures. Linux runners need a native Chromium build environment, Flatpak >= 1.12.4, flatpak-builder >= 1.2.2, and a working user session with unprivileged sandbox support. Add Flathub for the runner user before the first build:
|
||||
Cross-compiling needs extra setup when syncing the checkout:
|
||||
|
||||
- Windows: set `ELECTRON_BUILDING_WOA=1` before `gclient sync` so the ARM64 toolchain is fetched. Electron lists x64 to ARM64 as experimental.
|
||||
- Linux: install the ARM64 sysroot with `build/linux/sysroot_scripts/install-sysroot.py --arch=arm64` from `src`. Building the AArch64 Flatpak on an x64 host also needs `qemu-user-static` with binfmt support.
|
||||
|
||||
Windows runners need Visual Studio's Electron/Chromium build components and SDK, plus Developer Mode or symlink permissions. Install the ARM64 build tools too. Mac runners need Xcode, its command-line tools, and both macOS SDK architectures. Linux runners need a native Chromium build environment, Flatpak >= 1.12.4, flatpak-builder >= 1.2.2, and a working user session with unprivileged sandbox support. Add Flathub for the runner user before the first build:
|
||||
|
||||
```sh
|
||||
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
@@ -77,7 +80,7 @@ To reproduce the CI build on a prepared runner:
|
||||
|
||||
```sh
|
||||
export OTUNES_ELECTRON_SOURCE=/absolute/path/to/electron/src
|
||||
export OTUNES_DESKTOP_ARCH=universal # macOS; use x64 or arm64 on other hosts
|
||||
export OTUNES_DESKTOP_ARCH=universal # macOS; x64 or arm64 elsewhere
|
||||
pnpm --filter @otunes/desktop build:ci
|
||||
```
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ function handleRequest(request, response) {
|
||||
}
|
||||
// Only data routes go to the remote server. All UI and auth routes stay local.
|
||||
const remote =
|
||||
config && /^\/api\/(song|album|artist|playlist)\//.test(url.pathname)
|
||||
config && /^\/api\/(song|album|artist|playlist|user)\//.test(url.pathname)
|
||||
const target = new URL(
|
||||
`${url.pathname}${url.search}`,
|
||||
remote ? config.serverUrl : `http://127.0.0.1:${nextPort}`
|
||||
|
||||
@@ -3,13 +3,12 @@ import path from "node:path"
|
||||
import { desktopRoot, electronVersion } from "./config.mjs"
|
||||
|
||||
const target = process.env.OTUNES_DESKTOP_ARCH
|
||||
// x64 and arm64 cross-compile from either host CPU. Universal needs a Mac.
|
||||
if (
|
||||
!(["x64", "arm64"].includes(target) && target === process.arch) &&
|
||||
!["x64", "arm64"].includes(target) &&
|
||||
!(process.platform === "darwin" && target === "universal")
|
||||
) {
|
||||
throw new Error(
|
||||
"Use a native x64/arm64 Node.js runner, or a Mac for universal builds"
|
||||
)
|
||||
throw new Error("Targets are x64 or arm64, or universal on macOS")
|
||||
}
|
||||
if (!process.env.OTUNES_ELECTRON_SOURCE)
|
||||
throw new Error(
|
||||
|
||||
Reference in new issue
Block a user