Bumps the actions group with 3 updates: [pnpm/action-setup](https://github.com/pnpm/action-setup), [actions/setup-go](https://github.com/actions/setup-go) and [actions/dependency-review-action](https://github.com/actions/dependency-review-action). Updates `pnpm/action-setup` from 6.0.10 to 6.1.0 - [Release notes](https://github.com/pnpm/action-setup/releases) - [Commits](https://github.com/pnpm/action-setup/compare/0977fd99725f1db4007ccb2928dbb4e90d06cc86...ea17c68df8912ef543352723c149a84f56e3d413) Updates `actions/setup-go` from 6.5.0 to 7.0.0 - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/924ae3a1cded613372ab5595356fb5720e22ba16...b7ad1dad31e06c5925ef5d2fc7ad053ef454303e) Updates `actions/dependency-review-action` from 4.9.0 to 5.0.0 - [Release notes](https://github.com/actions/dependency-review-action/releases) - [Commits](https://github.com/actions/dependency-review-action/compare/2031cfc080254a8a887f58cffee85186f0e49e48...a1d282b36b6f3519aa1f3fc636f609c47dddb294) --- updated-dependencies: - dependency-name: pnpm/action-setup dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: actions/setup-go dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/dependency-review-action dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com>
285 lines
12 KiB
YAML
285 lines
12 KiB
YAML
name: CI
|
||
|
||
on:
|
||
push:
|
||
branches: [develop, main]
|
||
pull_request:
|
||
workflow_dispatch:
|
||
|
||
merge_group:
|
||
|
||
permissions:
|
||
contents: read
|
||
|
||
concurrency:
|
||
group: ci-${{ github.event_name }}-${{ github.ref }}
|
||
cancel-in-progress: true
|
||
|
||
jobs:
|
||
quality:
|
||
uses: ./.github/workflows/quality.yml
|
||
|
||
lock:
|
||
name: Product inputs
|
||
runs-on: ubuntu-24.04
|
||
timeout-minutes: 60
|
||
steps:
|
||
# The engine is vendored in-tree, so a plain checkout already carries the contracts this job
|
||
# compares against. opencc and cpp-pinyin are still submodules but nothing here builds.
|
||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
- name: Check the shared dictionary validator
|
||
run: python3 scripts/check-dictionary-contract.py
|
||
- name: Check product-lock contract
|
||
run: python3 scripts/check-product-lock-contract.py
|
||
# The voice activity detector is committed rather than downloaded, and it is executed inside
|
||
# the IME process. The engine's own voice.yml used to re-check its digest; that workflow left
|
||
# with the submodule, so the check moves here rather than disappearing.
|
||
- name: Check the committed voice model against its recorded digest
|
||
run: |
|
||
echo '1a153a22f4509e292a94e67d6f9b85e8deb25b4988682b7e174c65279d8788e3 engine/voice/assets/models/silero_vad.onnx' | sha256sum --check --strict
|
||
- name: Test rejection of changed or mismatched inputs
|
||
run: python3 -m unittest discover -s tests -p 'test_product_lock.py'
|
||
- name: Test local environment setup in a moved checkout
|
||
run: python3 -m unittest discover -s tests -p 'test_prepare_env.py'
|
||
- name: Test the automatic release CI gate
|
||
run: python3 -m unittest discover -s tests -p 'test_release_pr_ci.py'
|
||
- name: Read the reviewed lock
|
||
id: lock
|
||
run: python3 scripts/product_lock.py outputs --github-output "$GITHUB_OUTPUT"
|
||
|
||
windows:
|
||
name: Windows ${{ matrix.name }}
|
||
runs-on: windows-2025
|
||
timeout-minutes: 60
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
include:
|
||
- name: x64
|
||
architecture: x64
|
||
triplet: x64-windows-static
|
||
- name: Win32
|
||
architecture: Win32
|
||
triplet: x86-windows-static
|
||
steps:
|
||
- name: Check out source
|
||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
with:
|
||
submodules: recursive
|
||
- name: Restore dependency binaries
|
||
id: vcpkg-cache
|
||
uses: ./.github/actions/vcpkg-cache
|
||
with:
|
||
scope: tip-${{ matrix.triplet }}
|
||
- name: Install dependencies
|
||
shell: pwsh
|
||
working-directory: windows
|
||
run: vcpkg install --triplet ${{ matrix.triplet }}
|
||
- name: Save dependency binaries before compiling
|
||
if: steps.vcpkg-cache.outputs.matched-key != format('{0}-complete', steps.vcpkg-cache.outputs.key)
|
||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||
with:
|
||
path: ${{ steps.vcpkg-cache.outputs.path }}
|
||
key: ${{ steps.vcpkg-cache.outputs.key }}-complete
|
||
- name: Configure
|
||
shell: pwsh
|
||
run: >
|
||
cmake -S windows -B windows/build -A ${{ matrix.architecture }}
|
||
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
|
||
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }}
|
||
- name: Build
|
||
shell: pwsh
|
||
run: cmake --build windows/build --config Release --parallel
|
||
- name: Check the Release binary and symbols
|
||
shell: pwsh
|
||
run: ./scripts/ci/check-tsf-dll.ps1 -BuildDir 'windows/build'
|
||
- name: Test the wire contract on this architecture
|
||
run: ctest --no-tests=error --test-dir windows/build -C Release --output-on-failure
|
||
|
||
# Architecture-independent, so it runs once rather than on both matrix legs.
|
||
- name: Check the installer language file lands where ISCC looks
|
||
if: ${{ matrix.name == 'x64' }}
|
||
shell: pwsh
|
||
run: ./scripts/ci/check-inno-language.ps1
|
||
|
||
# MSIME-Linux's ci.yml already reasons about this: "the frontend layer had none -- and that is the
|
||
# layer that parses untrusted input", after an audit of the Windows frontend turned up a batch of
|
||
# races and null dereferences that the Debug build did not catch. Linux acted on that; this
|
||
# repository had no sanitizer coverage at all.
|
||
#
|
||
# Sanitizing the whole server would mean a sanitized Boost, curl, sqlite and WebView2 on a Windows
|
||
# runner. Instead the host-independent parsing and policy code builds as its own tiny target with
|
||
# no dependencies, which runs under ASan and UBSan on Linux in seconds. It covers less than a full
|
||
# sanitized build would; it covers it on every pull request.
|
||
sanitizers:
|
||
name: Sanitizers
|
||
runs-on: ubuntu-24.04
|
||
timeout-minutes: 10
|
||
steps:
|
||
- name: Check out source
|
||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
with:
|
||
persist-credentials: false
|
||
- name: Configure with AddressSanitizer and UndefinedBehaviorSanitizer
|
||
run: >
|
||
cmake -S server/tests/portable -B server/tests/portable/build
|
||
-DCMAKE_BUILD_TYPE=Debug -DMSIME_PORTABLE_TESTS_SANITIZE=ON
|
||
- name: Build
|
||
run: cmake --build server/tests/portable/build --parallel
|
||
- name: Test
|
||
working-directory: server/tests/portable/build
|
||
run: ctest --output-on-failure
|
||
|
||
server:
|
||
name: Server
|
||
needs: lock
|
||
runs-on: windows-2025
|
||
timeout-minutes: 90
|
||
# sccache caches individual MSVC compiles across runs so an incremental change recompiles only
|
||
# what it touched instead of the whole server + engine tree. It needs SCCACHE_GHA_ENABLED for
|
||
# every step that shells out to the compiler (configure probes it too, not just build).
|
||
env:
|
||
SCCACHE_GHA_ENABLED: "true"
|
||
steps:
|
||
- name: Check out source
|
||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
with:
|
||
submodules: recursive
|
||
- name: Restore dependency binaries
|
||
id: vcpkg-cache
|
||
uses: ./.github/actions/vcpkg-cache
|
||
with:
|
||
scope: server-x64-windows-and-static-md
|
||
# The Visual Studio generator finds MSVC on its own; Ninja does not, so put cl.exe on PATH
|
||
# before configuring. Defaults to the x64 host/target, matching the build below.
|
||
- name: Set up MSVC environment
|
||
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
|
||
- name: Set up sccache
|
||
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
|
||
- name: Install Boost
|
||
shell: pwsh
|
||
run: ./scripts/ci/install-boost.ps1
|
||
- name: Save Boost binaries before configuring
|
||
if: steps.vcpkg-cache.outputs.matched-key != format('{0}-complete', steps.vcpkg-cache.outputs.key) && steps.vcpkg-cache.outputs.matched-key != format('{0}-boost', steps.vcpkg-cache.outputs.key)
|
||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||
with:
|
||
path: ${{ steps.vcpkg-cache.outputs.path }}
|
||
key: ${{ steps.vcpkg-cache.outputs.key }}-boost
|
||
# 刻意不叫 build:CMakeLists.txt 曾经写死 ${CMAKE_SOURCE_DIR}/build/vcpkg_installed,换任何别的名字都会链接失败。构建到别处才能保证这条不会悄悄退回去。
|
||
#
|
||
# Ninja Multi-Config instead of the Visual Studio generator: sccache plugs in through
|
||
# CMAKE_<LANG>_COMPILER_LAUNCHER, which CMake honours only for the Ninja and Makefile
|
||
# generators. "Multi-Config" keeps the --config Release / bin/Release layout the later steps
|
||
# (check-server-binaries.ps1, ctest -C Release) already depend on.
|
||
- name: Configure
|
||
shell: pwsh
|
||
run: >
|
||
cmake -S server -B server/build-release -G "Ninja Multi-Config"
|
||
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
|
||
-DVCPKG_TARGET_TRIPLET=x64-windows
|
||
-DCMAKE_C_COMPILER_LAUNCHER=sccache
|
||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||
- name: Save dependency binaries before compiling
|
||
if: steps.vcpkg-cache.outputs.matched-key != format('{0}-complete', steps.vcpkg-cache.outputs.key)
|
||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||
with:
|
||
path: ${{ steps.vcpkg-cache.outputs.path }}
|
||
key: ${{ steps.vcpkg-cache.outputs.key }}-complete
|
||
- name: Build
|
||
shell: pwsh
|
||
run: cmake --build server/build-release --config Release --parallel
|
||
- name: Report sccache hit rate
|
||
if: always()
|
||
shell: pwsh
|
||
run: sccache --show-stats
|
||
- name: Check the Release binaries and symbols
|
||
shell: pwsh
|
||
run: ./scripts/ci/check-server-binaries.ps1 -BuildDir server/build-release/bin/Release
|
||
- name: Test with the product's exact data
|
||
shell: pwsh
|
||
env:
|
||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
run: ./scripts/ci/test-server.ps1 -ServerRoot server -StagingRoot "$env:RUNNER_TEMP/product-data" -BuildDir build-release
|
||
|
||
gui:
|
||
name: GUI framework
|
||
runs-on: windows-2025
|
||
timeout-minutes: 30
|
||
steps:
|
||
- name: Check out source
|
||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
- name: Check library ownership
|
||
run: python ui/scripts/check-boundary.py
|
||
- name: Configure
|
||
shell: pwsh
|
||
run: cmake -S ui -B ui/build -A x64
|
||
- name: Build
|
||
shell: pwsh
|
||
run: cmake --build ui/build --config Release --parallel
|
||
- name: Test
|
||
shell: pwsh
|
||
run: ctest --no-tests=error --test-dir ui/build -C Release --verbose --timeout 60
|
||
|
||
pages:
|
||
name: Settings page
|
||
runs-on: ubuntu-24.04
|
||
timeout-minutes: 20
|
||
steps:
|
||
- name: Check out source
|
||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
with:
|
||
persist-credentials: false
|
||
|
||
# The pages ship a copy of the engine's web contract. Before the consolidation the product
|
||
# lock kept that copy honest by pinning UiHtml and the engine together; now that the engine is
|
||
# a directory of this repository, the copy is checked against engine/contracts/webview
|
||
# directly and a plain checkout is enough to do it.
|
||
- name: Check the bundled contract against the engine
|
||
run: python3 ui-html/scripts/sync-contracts.py --check
|
||
|
||
- name: Set up pnpm
|
||
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
||
with:
|
||
version: 10
|
||
|
||
- name: Set up Node
|
||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||
with:
|
||
node-version: 22
|
||
cache: pnpm
|
||
cache-dependency-path: ui-html/webview2/settings/ime-settings/pnpm-lock.yaml
|
||
|
||
- name: Install
|
||
working-directory: ui-html/webview2/settings/ime-settings
|
||
run: pnpm install --frozen-lockfile
|
||
|
||
- name: Test
|
||
working-directory: ui-html/webview2/settings/ime-settings
|
||
run: pnpm test
|
||
|
||
# Same command the release workflow runs. Until it was added here it was only ever exercised
|
||
# during a release, so a break surfaced while cutting a version.
|
||
- name: Build
|
||
working-directory: ui-html/webview2/settings/ime-settings
|
||
run: pnpm build
|
||
|
||
- name: Check the output the installer collects
|
||
working-directory: ui-html/webview2/settings/ime-settings
|
||
run: |
|
||
test -f dist/index.html
|
||
echo "dist contents:"
|
||
ls -la dist
|
||
|
||
packaging:
|
||
name: Package contents
|
||
runs-on: windows-2025
|
||
timeout-minutes: 15
|
||
steps:
|
||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
- name: Test full and light package contents without registering or installing
|
||
run: ./installer/tests/package-files.ps1
|
||
- name: Stop local packaging after failed component builds
|
||
run: ./installer/tests/build-failures.ps1
|
||
- name: Test local Server test entrypoints in a moved checkout
|
||
run: ./tests/server-test-entrypoints.ps1
|