Repository navigation
ci: add community multi-platform daily packaging #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ac73afd
e083a69
0099449
3a5447f
009ea39
1b46ff7
c1f4f7c
9f624fa
77f7c61
a08fcdc
57a60d5
99ce171
717dbd4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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) | ||
|
|
@@ -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__/** | ||
| - 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 | ||
|
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 | ||
|
|
@@ -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 }} | ||
|
|
@@ -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' | ||
|
JohnWuY marked this conversation as resolved.
Resolved
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: | ||
|
|
@@ -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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 低 新增的
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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: | | ||
|
|
@@ -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 | ||
|
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 | ||
|
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 \ | ||
|
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 | ||
|
|
@@ -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 }} | ||
|
|
@@ -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}`) | ||
Uh oh!
There was an error while loading. Please reload this page.