Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 189 additions & 36 deletions .github/workflows/community-package.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: community-package
# Builds the unsigned Windows community installer: OpenTest plus the plugins from
# crysound/OpenTest-Plugins (the public business plugins and the SonoDAQ device plugin). It verifies a silent install and publishes to GitHub Releases.
# 构建 Windows、Linux、macOS 社区安装包,验证安装后统一发布。
# 三个平台共用版本;发布任务等待所有安装验证成功。
# push to main -> daily build A.B.C-dev.<yyyymmdd>[.N] (prerelease, tag created on publish)
# push tag vA.B.C-rc.N -> release candidate (prerelease)
# push tag vA.B.C -> release (latest)
Expand All @@ -20,21 +20,66 @@ on:
- tools/default-plugins.mjs
- tools/package.mjs
- tools/packaging.mjs
- tools/packaging-platforms.mjs
- tools/package-posix-native.mjs
- tools/package-java.mjs
- tools/macos-signing.mjs
- tools/__tests__/**
Comment thread
JohnWuY marked this conversation as resolved.
Resolved
- tools/publish-community-build.cjs
- tools/ci/**
workflow_dispatch:
inputs:
plugins_ref:
description: OpenTest-Plugins branch or tag (default main; tag builds use the same tag)
required: false
default: ''
# Manual runs use the same plugin revision rules as push runs; they cannot select arbitrary plugin code.
workflow_dispatch: {}
permissions:
contents: read
concurrency:
group: community-package-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
version:
runs-on: ubuntu-24.04
timeout-minutes: 10
outputs:
version: ${{ steps.version.outputs.version }}
plugins-source: ${{ steps.plugins.outputs.source }}
plugins-revision: ${{ steps.plugins.outputs.revision }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: 22
package-manager-cache: false
- name: Test version, plugin resolution, delivery manifest and publication rules
run: node --test tools/__tests__/build-version.test.mjs tools/__tests__/resolve-plugin-revision.test.mjs tools/__tests__/ensure-delivery-manifest.test.mjs tools/__tests__/publish-community-build.test.mjs
- name: Resolve package version
id: version
env:
GH_TOKEN: ${{ github.token }}
REF: ${{ github.ref }}
REF_TYPE: ${{ github.ref_type }}
shell: pwsh
run: |
if ($env:REF_TYPE -eq 'tag') {
node tools/build-version.mjs --tag $env:REF
} else {
$base = (Get-Content -LiteralPath package.json -Raw | ConvertFrom-Json).version
$existing = Join-Path $env:RUNNER_TEMP 'dev-tags.txt'
# Write the file even when no daily tag exists yet; an empty pipeline would not create it.
$tags = @(gh api "repos/$env:GITHUB_REPOSITORY/git/matching-refs/tags/v$base-dev." --paginate --jq '.[].ref')
if ($LASTEXITCODE -ne 0) { throw 'Could not list existing daily tags.' }
[System.IO.File]::WriteAllLines($existing, [string[]]$tags)
node tools/build-version.mjs --dev --existing-file $existing
}
if ($LASTEXITCODE -ne 0) { throw 'Version resolution failed.' }
- name: Resolve public plugin revision
Comment thread
JohnWuY marked this conversation as resolved.
Resolved
id: plugins
env:
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
run: node tools/ci/resolve-plugin-revision.mjs
build:
needs: version
name: build-community-installer
runs-on: windows-latest
timeout-minutes: 120
Expand All @@ -48,7 +93,6 @@ jobs:
PLUGIN_PACKAGES: ${{ github.workspace }}/.runtime/ci-plugin-packages
NATIVE_PLUGIN_BIN: ${{ github.workspace }}/.runtime/ci-native-plugins
outputs:
version: ${{ steps.version.outputs.version }}
installer-name: ${{ steps.verify.outputs.installer-name }}
installer-sha256: ${{ steps.verify.outputs.installer-sha256 }}
artifact-id: ${{ steps.upload.outputs.artifact-id }}
Expand All @@ -62,18 +106,26 @@ jobs:
uses: actions/checkout@v7
with:
repository: crysound/OpenTest-Plugins
ref: ${{ inputs.plugins_ref || (github.ref_type == 'tag' && github.ref_name) || 'main' }}
ref: ${{ needs.version.outputs.plugins-revision }}
path: .runtime/opentest-plugins
persist-credentials: false
- name: Verify public plugin revision
env:
EXPECTED_PLUGINS_REVISION: ${{ needs.version.outputs.plugins-revision }}
run: |
$actual = git -C $env:PLUGINS_ROOT rev-parse HEAD
if ($LASTEXITCODE -ne 0) { throw 'Could not read the checked-out plugin revision.' }
$actual = $actual.Trim()
if ($actual -ne $env:EXPECTED_PLUGINS_REVISION) { throw "OpenTest-Plugins revision mismatch: $actual" }
- uses: actions/setup-node@v7
with:
node-version: 22
package-manager-cache: false
# Do not persist Maven caches between runs.
- uses: actions/setup-java@v6
with:
distribution: zulu
java-version: '21'
Comment thread
JohnWuY marked this conversation as resolved.
Resolved
Comment thread
JohnWuY marked this conversation as resolved.
Resolved
cache: maven
# The host device-plugin packager runs `python` (standard library only).
- uses: actions/setup-python@v7
with:
Expand All @@ -83,27 +135,10 @@ jobs:
corepack enable
corepack prepare pnpm@10.6.5 --activate
pnpm --version
- name: Resolve package version
id: version
env:
GH_TOKEN: ${{ github.token }}
REF: ${{ github.ref }}
REF_TYPE: ${{ github.ref_type }}
run: |
if ($env:REF_TYPE -eq 'tag') {
node tools/build-version.mjs --tag $env:REF
} else {
$base = (Get-Content -LiteralPath package.json -Raw | ConvertFrom-Json).version
$existing = Join-Path $env:RUNNER_TEMP 'dev-tags.txt'
# Write the file even when no daily tag exists yet; an empty pipeline would not create it.
$tags = @(gh api "repos/$env:GITHUB_REPOSITORY/git/matching-refs/tags/v$base-dev." --paginate --jq '.[].ref')
if ($LASTEXITCODE -ne 0) { throw 'Could not list existing daily tags.' }
[System.IO.File]::WriteAllLines($existing, [string[]]$tags)
node tools/build-version.mjs --dev --existing-file $existing
}
if ($LASTEXITCODE -ne 0) { throw 'Version resolution failed.' }
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Test installer configuration and macOS license resources
run: node --test tools/__tests__/community-package.test.mjs tools/__tests__/mac-build-resources.test.mjs tools/__tests__/service-environment.test.mjs

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 低 新增的 tools/__tests__/ensure-delivery-manifest.test.mjs 不在本工作流任何 node --test 步骤中:version 任务只跑 3 个文件,这里又跑了另外 3 个。请确认它是否已被其他必需检查执行;如果没有,请加到这里或 version 任务的测试列表中,否则清单校验逻辑的回归不会被发现。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已处理:57a60d5 已将 ensure-delivery-manifest.test.mjs 加入 version 任务的 node --test 列表。

- name: Prepare Electron runtime
run: ./tools/ci/prepare-electron.ps1
- name: Install the host plugin SDK into Maven
Expand Down Expand Up @@ -165,7 +200,7 @@ jobs:
- name: Package community installer
env:
OPENTEST_ENV_FILE: .runtime/ci-installer/runtime.env
VERSION: ${{ steps.version.outputs.version }}
VERSION: ${{ needs.version.outputs.version }}
# CI has no Crowdin CLI or credentials; use the translations committed in the repository.
MAVEN_ARGS: -ntp -Dskip.crowdin.download=true
run: |
Expand All @@ -191,12 +226,117 @@ jobs:
dist/releases/windows-x64/test/unsigned/installer-verification.json
if-no-files-found: error
retention-days: 14
build-posix:
name: build-community-${{ matrix.platform }}
needs: version
strategy:
fail-fast: false
matrix:
include:
- platform: linux
runner: ubuntu-24.04
arch: x64
extension: deb
- platform: mac
runner: macos-26
arch: arm64
extension: dmg
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
defaults:
run:
shell: bash
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
NODE_OPTIONS: --max-old-space-size=6144
PLUGIN_PACKAGES: ${{ github.workspace }}/.runtime/ci-plugin-packages
NATIVE_PLUGIN_BIN: ${{ github.workspace }}/.runtime/ci-native-plugins
PACKAGE_PLATFORM: ${{ matrix.platform }}
VERSION: ${{ needs.version.outputs.version }}
OPENTEST_ENV_FILE: .runtime/ci-installer/runtime.env
MAVEN_ARGS: -ntp -Dskip.crowdin.download=true
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Check out public plugins
uses: actions/checkout@v7
with:
repository: crysound/OpenTest-Plugins
ref: ${{ needs.version.outputs.plugins-revision }}
path: .runtime/opentest-plugins
persist-credentials: false
- name: Verify public plugin revision
env:
EXPECTED_PLUGINS_REVISION: ${{ needs.version.outputs.plugins-revision }}
run: |
actual=$(git -C .runtime/opentest-plugins rev-parse HEAD)
test "$actual" = "$EXPECTED_PLUGINS_REVISION"
- uses: actions/setup-node@v7
with:
node-version: 22
package-manager-cache: false
# Do not persist Maven caches between runs.
- uses: actions/setup-java@v6
with:
distribution: zulu
java-version: '21'
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Prepare Linux dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential patchelf libasound2t64 libgtk-3-0t64 libnotify4 libnss3 libxss1 libxtst6 libatspi2.0-0t64 libpulse0 libudev1 libblkid1 libssl3t64 libhidapi-hidraw0 xdg-utils
- name: Prepare pnpm and dependencies
run: |
corepack enable
corepack prepare pnpm@10.6.5 --activate
pnpm install --frozen-lockfile
node tools/ci/prepare-electron.mjs
- name: Install the host plugin SDK into Maven
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
run: mvn -B --no-transfer-progress -DskipTests -f apps/backend/pom.xml -pl ':crydaq-dependencies,:opentest-plugin-api,:opentest-dashboard-standard-processors' -am install
- name: Build public plugins
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
run: |
names=$(node --input-type=module -e "import { editionPluginNames } from './tools/default-plugins.mjs'; console.log(editionPluginNames({ edition: 'community' }).join('\n'))")
test -n "$names"
plugins=()
while IFS= read -r name; do plugins+=("$name"); done <<< "$names"
mv .runtime/opentest-plugins "$RUNNER_TEMP/opentest-plugins"
export OPENTEST_PLUGIN_PACKAGE_OUTPUT="$PLUGIN_PACKAGES"
cd "$RUNNER_TEMP/opentest-plugins"
node tools/build.mjs "${plugins[@]}" --platform "$PACKAGE_PLATFORM" --skip-tests -Dskip.crowdin.download=true
- name: Build and stage SonoDAQ device plugin
run: node tools/ci/stage-posix-device-plugin.mjs
- name: Prepare installer settings
env:
OPENTEST_CI_NATIVE_PLUGIN_BIN_ROOT: ${{ env.NATIVE_PLUGIN_BIN }}
run: node tools/ci/prepare-installer.mjs
- name: Package community installer
run: |
node tools/package.mjs --platform "$PACKAGE_PLATFORM" --mode production --kind installer --edition community \
Comment thread
JohnWuY marked this conversation as resolved.
Resolved
--version "$VERSION" --plugins-dir "$PLUGIN_PACKAGES" --config .runtime/ci-installer/packaging.json
- name: Ensure delivery manifest
run: node tools/ci/ensure-delivery-manifest.mjs
- name: Verify silent install
run: node tools/ci/verify-posix-installer.mjs
- name: Upload installer
uses: actions/upload-artifact@v7
with:
name: opentest-community-${{ matrix.platform }}-${{ matrix.arch }}-${{ github.sha }}
path: |
dist/releases/${{ matrix.platform }}-${{ matrix.arch }}/production/unsigned/installer/*.${{ matrix.extension }}
dist/releases/${{ matrix.platform }}-${{ matrix.arch }}/production/unsigned/delivery.json
dist/releases/${{ matrix.platform }}-${{ matrix.arch }}/production/unsigned/installer-verification.json
if-no-files-found: error
retention-days: 14
publish:
name: publish-community-release
needs: build
needs: [version, build, build-posix]
if: github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 30
permissions:
contents: write
actions: read
Expand All @@ -209,11 +349,21 @@ jobs:
- uses: actions/download-artifact@v8
with:
name: opentest-community-windows-x64-${{ github.sha }}
path: release
path: release/windows
- uses: actions/download-artifact@v8
with:
name: opentest-community-linux-x64-${{ github.sha }}
path: release/linux
- uses: actions/download-artifact@v8
with:
name: opentest-community-mac-arm64-${{ github.sha }}
path: release/mac
- name: Publish GitHub release
uses: actions/github-script@v9
env:
VERSION: ${{ needs.build.outputs.version }}
VERSION: ${{ needs.version.outputs.version }}
PLUGINS_SOURCE: ${{ needs.version.outputs.plugins-source }}
PLUGINS_REVISION: ${{ needs.version.outputs.plugins-revision }}
ARTIFACT_ID: ${{ needs.build.outputs.artifact-id }}
ARTIFACT_DIGEST: ${{ needs.build.outputs.artifact-digest }}
INSTALLER_NAME: ${{ needs.build.outputs.installer-name }}
Expand All @@ -227,7 +377,10 @@ jobs:
version: process.env.VERSION,
artifactId: process.env.ARTIFACT_ID,
artifactDigest: process.env.ARTIFACT_DIGEST,
installerPath: path.join(process.env.GITHUB_WORKSPACE, 'release/installer', process.env.INSTALLER_NAME),
installerPath: path.join(process.env.GITHUB_WORKSPACE, 'release/windows/installer', process.env.INSTALLER_NAME),
installerDigest: process.env.INSTALLER_SHA256,
posixRoot: path.join(process.env.GITHUB_WORKSPACE, 'release'),
pluginsSource: process.env.PLUGINS_SOURCE,
pluginsRevision: process.env.PLUGINS_REVISION,
})
core.notice(`Published ${release.html_url}`)
2 changes: 1 addition & 1 deletion CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
宿主默认独立构建、打包和启动,不依赖插件仓库,不要求安装外置业务或设备插件。`default-plugins.json` 只列公开插件 `fft-tools`,仅供显式套件构建;只有提供预制 `--plugins-dir` 或启用 CI 的 `bundle_plugins` 时才随附业务插件。源码启动默认忽略套件缓存,只有显式 `OPENTEST_BUNDLED_PLUGINS_DIR` 才选择该材料。插件仓库消费公开 SDK 并独立生成自己的安装包。

`apps/native` 维护公开 Device Host、IPC、SDK、portable 加载器、校验器、管理器、`common_device_runtime` 共享插件运行时及其平台实现和测试。JNI(含 Host 客户端)、算法适配、系统音频、蓝牙、Sequence 和设备控制等原生组件以预编译二进制随附,例如 `apps/desktop/packages/native-modules/vendor/` 和后端 `resources/native/<platform>`;其源码不在本仓库。
SonoDAQ 源码在公开的 `OpenTest-Plugins/native/opentest_sonodaq_plugin` 维护;其他具体设备插件由各自独立源码和部署材料提供。公开 Host 构建不依赖具体设备插件源码或 JNI 源码。
SonoDAQ 源码在公开的 `OpenTest-Plugins/plugins/opentest_sonodaq_plugin` 维护;其他具体设备插件由各自独立源码和部署材料提供。公开 Host 构建不依赖具体设备插件源码或 JNI 源码。
构建输出位于源码外,与后端 `resources/native/<platform>` 运行材料分开管理;构建不自动替换已部署二进制。框架边界遵循 `apps/native/AGENTS.md`,当前入口见 [公开构建说明](apps/native/docs/public-build.md)。

## 开发工作区术语
Expand Down
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ node --test tools/__tests__/docs-policy.test.mjs

## Community packages

The `community-package` workflow builds the unsigned Windows community installer: OpenTest plus the plugins from `crysound/OpenTest-Plugins`: the business plugins listed in `default-plugins.json` (currently `fft-tools`) and the SonoDAQ device plugin, which is bundled under `resources/backend/native/plugins/devices`. Each push to `main` publishes a daily prerelease `A.B.C-dev.<yyyymmdd>` (later builds on the same Beijing day add `.2`, `.3` and so on). Pushing tag `vA.B.C-rc.N` or `vA.B.C` publishes a release candidate or a release; tag the same name in `OpenTest-Plugins` first. Pull requests that change packaging only build and verify the installer. `package.json` keeps the plain `A.B.C` used for plugin compatibility; the full version is passed to `node tools/package.mjs --version`. The workflow uses `--edition community`, which bundles only the plugins listed in `default-plugins.json`.
The `community-package` workflow builds three community installers: an EXE executable installer for Windows x64, a DEB Debian package for Linux x64, and a DMG disk image for macOS ARM64. They include OpenTest, the business plugins listed in `default-plugins.json` (currently `fft-tools`) from `crysound/OpenTest-Plugins`, and the SonoDAQ device plugin, but not the other plugins from the website package. Device plugins are bundled under `backend/native/plugins/devices` in the application resources. Windows retains `test` mode and uses the backend defaults without an explicit `cloud.license.url`; Linux and macOS use `production` license mode with the formal license service and separate generated configurations. There is no separate test server. Automatic updates are disabled. Windows is unsigned; macOS retains its multilingual license agreement and has only ad hoc signatures, without developer signing or Apple notarization. On first launch, choose Open Anyway in Privacy & Security. The SonoDAQ device plugin requires macOS 26 or later.

Each push to `main` publishes a daily prerelease `A.B.C-dev.<yyyymmdd>`; later builds on the same Beijing day add `.2`, `.3` and so on. Pushing `vA.B.C-rc.N` or `vA.B.C` publishes a release candidate or release. First create the same tag in `OpenTest-Plugins`: a missing tag fails the build instead of falling back to `main`. Daily builds, pull requests, and manual runs use the plugin repository's `main`; manual runs cannot select an arbitrary plugin revision. Tag runs require the matching plugin tag. All three platforms check out the same resolved commit directly and verify it again, so a moving branch cannot change the build inputs. After every build and installation check succeeds, one publishing job uploads three installers and their SHA-256 checksum files before making the release public.

Pull requests targeting `main` trigger all three builds and installation checks, without publishing, when they change `.github/workflows/community-package.yml`, `default-plugins.json`, `packaging.config.json`, the packaging scripts listed in the workflow, `tools/__tests__/**`, `tools/ci/**`, or `tools/publish-community-build.cjs`. The workflow uses `--edition community` and does not trigger for unrelated application, SDK, vendor, manifest, or lockfile changes. `package.json` keeps the plain `A.B.C` used for plugin compatibility; the full version is passed to `node tools/package.mjs --version`.

## GitHub enforcement

Expand Down
Loading
Loading