Skip to content

perf(git): 使用游标流式分页加载提交历史 #672

perf(git): 使用游标流式分页加载提交历史

perf(git): 使用游标流式分页加载提交历史 #672

Workflow file for this run

name: Windows CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: windows-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Classify changes
runs-on: ubuntu-latest
outputs:
windows: ${{ steps.classify.outputs.windows }}
rust_core: ${{ steps.classify.outputs.rust_core }}
windows_rust: ${{ steps.classify.outputs.windows_rust }}
steps:
- name: Check out source
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Test dependency cache verification
shell: bash
run: node scripts/test-verify-download-cache.mjs
- name: Resolve comparison base
id: base
env:
EVENT_NAME: ${{ github.event_name }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BASE_SHA: ${{ github.event.before }}
shell: bash
run: |
if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
echo "manual=true" >> "$GITHUB_OUTPUT"
exit 0
fi
base_sha="$PUSH_BASE_SHA"
if [[ "$EVENT_NAME" == "pull_request" ]]; then
base_sha="$PR_BASE_SHA"
fi
{
echo "manual=false"
echo "base_sha=$base_sha"
} >> "$GITHUB_OUTPUT"
- name: Classify changed paths
id: classify
env:
MANUAL: ${{ steps.base.outputs.manual }}
BASE_SHA: ${{ steps.base.outputs.base_sha }}
shell: bash
run: |
if [[ "$MANUAL" == "true" ]]; then
{
echo "rust_core=true"
echo "windows=true"
echo "windows_rust=true"
} >> "$GITHUB_OUTPUT"
exit 0
fi
./scripts/classify-ci-changes.sh "$BASE_SHA" "$GITHUB_SHA" >> "$GITHUB_OUTPUT"
- name: Reject newly added Windows blocking test patterns
if: steps.base.outputs.manual == 'false'
env:
BASE_SHA: ${{ steps.base.outputs.base_sha }}
shell: bash
run: ./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --platform windows --base "$BASE_SHA" --head "$GITHUB_SHA"
- name: Summarize selected lanes
shell: bash
env:
WINDOWS: ${{ steps.classify.outputs.windows }}
RUST_CORE: ${{ steps.classify.outputs.rust_core }}
WINDOWS_RUST: ${{ steps.classify.outputs.windows_rust }}
run: |
{
echo "### Windows CI lanes"
echo "| Lane | Run |"
echo "| --- | --- |"
echo "| Windows build | $WINDOWS |"
echo "| Shared Rust Core tests | $RUST_CORE |"
echo "| Windows Rust tests | $WINDOWS_RUST |"
} >> "$GITHUB_STEP_SUMMARY"
validate:
name: Build and test Windows implementation
needs: changes
if: needs.changes.outputs.windows == 'true' || needs.changes.outputs.rust_core == 'true' || needs.changes.outputs.windows_rust == 'true'
runs-on: windows-latest
timeout-minutes: 45
steps:
- name: Check out source
uses: actions/checkout@v7
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Set up Bun
id: bun
if: needs.changes.outputs.windows == 'true'
uses: oven-sh/setup-bun@v2
with:
bun-version-file: windows/tauri/package.json
- name: Configure isolated dependency caches
shell: pwsh
run: |
"CARGO_HOME=$(Join-Path $env:GITHUB_WORKSPACE '.artifacts/cargo-home')" >> $env:GITHUB_ENV
# Bun's cache and temp directory must share a Windows volume so
# lifecycle shims such as node-gyp.cmd are added to the correct PATH.
"BUN_INSTALL_CACHE_DIR=$(Join-Path $env:GITHUB_WORKSPACE '.artifacts/bun-cache')" >> $env:GITHUB_ENV
"BUN_TMPDIR=$(Join-Path $env:GITHUB_WORKSPACE '.artifacts/bun-tmp')" >> $env:GITHUB_ENV
# The verified cache rejects links, so omit Bun's junction-only index.
"BUN_FEATURE_FLAG_DISABLE_INSTALL_INDEX=1" >> $env:GITHUB_ENV
- name: Resolve Rust cache identity
id: rust-cache
shell: pwsh
run: |
$commit = rustc -Vv |
Select-String '^commit-hash:' |
ForEach-Object { ($_.Line -split ':', 2)[1].Trim() } |
Select-Object -First 1
if ([string]::IsNullOrWhiteSpace($commit)) {
throw "Could not resolve the Rust compiler commit hash."
}
"commit=$commit" >> $env:GITHUB_OUTPUT
- name: Restore Cargo downloads
id: cargo-download-cache
continue-on-error: true
uses: actions/cache@v6
with:
path: |
.artifacts/cargo-home/registry/cache
key: lithe-${{ runner.os }}-${{ runner.arch }}-cargo-downloads-v1-${{ hashFiles('rust/Cargo.lock', 'windows/tauri/src-tauri/Cargo.lock') }}
restore-keys: |
lithe-${{ runner.os }}-${{ runner.arch }}-cargo-downloads-v1-
- name: Restore Cargo build outputs
id: cargo-build-cache
continue-on-error: true
uses: actions/cache@v6
with:
path: |
windows/tauri/src-tauri/target/**/.fingerprint
windows/tauri/src-tauri/target/**/build
windows/tauri/src-tauri/target/**/deps
windows/tauri/src-tauri/target/**/incremental
rust/target/**/.fingerprint
rust/target/**/build
rust/target/**/deps
rust/target/**/incremental
key: lithe-${{ runner.os }}-${{ runner.arch }}-cargo-build-v1-x86_64-pc-windows-msvc-${{ steps.rust-cache.outputs.commit }}-${{ hashFiles('rust/Cargo.lock', 'rust/**/Cargo.toml', 'windows/tauri/src-tauri/Cargo.lock', 'windows/tauri/src-tauri/Cargo.toml', 'windows/tauri/crates/**/Cargo.toml', 'windows/tauri/rust-toolchain.toml') }}
restore-keys: |
lithe-${{ runner.os }}-${{ runner.arch }}-cargo-build-v1-x86_64-pc-windows-msvc-${{ steps.rust-cache.outputs.commit }}-
- name: Restore Bun downloads
if: needs.changes.outputs.windows == 'true'
id: bun-download-cache
continue-on-error: true
uses: actions/cache@v6
with:
path: .artifacts/bun-cache
key: lithe-${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.bun.outputs.bun-version }}-v2-${{ hashFiles('windows/tauri/bun.lock') }}
restore-keys: |
lithe-${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.bun.outputs.bun-version }}-v2-
- name: Restore JDTLS downloads
if: needs.changes.outputs.windows == 'true'
id: jdtls-download-cache
continue-on-error: true
uses: actions/cache@v6
with:
path: .artifacts/jdtls-downloads
key: lithe-${{ runner.os }}-${{ runner.arch }}-jdtls-v1-${{ hashFiles('third_party/jdtls/manifest.json') }}
- name: Restore JDK downloads
if: needs.changes.outputs.windows == 'true'
id: jdk-download-cache
continue-on-error: true
uses: actions/cache@v6
with:
path: .artifacts/jdk-downloads
key: lithe-${{ runner.os }}-${{ runner.arch }}-jdk-v1-${{ hashFiles('third_party/jdk/manifest.json') }}
- name: Validate restored caches or fall back
if: always()
shell: pwsh
run: |
$validation = @{
CargoDownloadsOutcome = "${{ steps.cargo-download-cache.outcome }}"
CargoBuildOutcome = "${{ steps.cargo-build-cache.outcome }}"
CargoBuildHit = "${{ steps.cargo-build-cache.outputs.cache-hit }}"
BunOutcome = "${{ steps.bun-download-cache.outcome }}"
JdtlsOutcome = "${{ steps.jdtls-download-cache.outcome }}"
JdkOutcome = "${{ steps.jdk-download-cache.outcome }}"
}
if ("${{ needs.changes.outputs.windows }}" -eq "true") {
$validation.IncludeWindowsAssets = $true
}
./scripts/validate-windows-build-caches.ps1 @validation
- name: Build Windows Tauri application
if: needs.changes.outputs.windows == 'true'
shell: pwsh
run: ./scripts/build-windows.ps1 -Configuration Release
- name: Verify Windows boundaries
if: needs.changes.outputs.windows == 'true'
shell: pwsh
run: ./scripts/verify-windows-boundaries.ps1
- name: Run Windows frontend tests
if: needs.changes.outputs.windows == 'true'
shell: pwsh
run: |
bun test src/platform
bun test src/features/editor/stores/editor-app.store.test.ts src/features/editor/services/document-external-change-workflow.test.ts src/features/editor/services/document-save-lifecycle.test.ts
bun test src/features/editor/lsp/language-server-navigation.test.ts src/features/editor/lsp/java-navigation-marker-loader.test.ts src/features/editor/engines/monaco/definition-link-scheduler.test.ts src/features/editor/engines/monaco/java-implementation-markers.test.ts
bun test src/features/editor/lsp/java-workspace-language-server.test.ts src/features/editor/lsp/java-workspace-change-scheduler.test.ts
bun test src/features/run
bun test src/features/file-explorer/lib/java-clipboard-class.test.ts src/features/file-explorer/lib/paste-java-class-from-clipboard.test.ts
- name: Test shared Rust Core
if: needs.changes.outputs.rust_core == 'true'
shell: pwsh
timeout-minutes: 20
run: ./.agents/skills/write-stable-tests/scripts/test-stability-windows.ps1 -Scope SharedRust -SuiteTimeoutSeconds 1080
- name: Test Windows Rust host
if: needs.changes.outputs.windows_rust == 'true'
shell: pwsh
timeout-minutes: 20
run: ./.agents/skills/write-stable-tests/scripts/test-stability-windows.ps1 -Scope WindowsRust -SuiteTimeoutSeconds 1080
- name: Generate combined Windows test report
if: always()
shell: pwsh
run: node .agents/skills/write-stable-tests/scripts/generate-test-report.mjs
- name: Upload Windows test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-stability-windows
path: .artifacts/test-stability/
if-no-files-found: ignore
retention-days: 14
gate:
name: Windows CI gate
needs:
- changes
- validate
if: always()
runs-on: ubuntu-latest
steps:
- name: Verify required jobs
env:
CHANGES_RESULT: ${{ needs.changes.result }}
WINDOWS_SELECTED: ${{ needs.changes.outputs.windows }}
RUST_CORE_SELECTED: ${{ needs.changes.outputs.rust_core }}
WINDOWS_RUST_SELECTED: ${{ needs.changes.outputs.windows_rust }}
VALIDATE_RESULT: ${{ needs.validate.result }}
shell: bash
run: |
[[ "$CHANGES_RESULT" == "success" ]]
if [[ "$WINDOWS_SELECTED" == "true" || "$RUST_CORE_SELECTED" == "true" || "$WINDOWS_RUST_SELECTED" == "true" ]]; then
[[ "$VALIDATE_RESULT" == "success" ]]
else
[[ "$VALIDATE_RESULT" == "skipped" ]]
fi