From 941796d5b364aaedda7ac800a1a16b030d7c52bb Mon Sep 17 00:00:00 2001 From: luo jiyin Date: Fri, 2 Oct 2026 09:04:40 +0800 Subject: [PATCH] ci: stabilize Win7 sccache cache keys with /Brepro --- .github/fixtures/win7-host-repro-config.toml | 5 +++++ .github/scripts/ci-workflow.test.mjs | 6 ++++++ .github/workflows/ci.yml | 5 ++++- .../src/lib/__tests__/windowsInstallerTemplate.spec.ts | 3 ++- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .github/fixtures/win7-host-repro-config.toml diff --git a/.github/fixtures/win7-host-repro-config.toml b/.github/fixtures/win7-host-repro-config.toml new file mode 100644 index 0000000000..ddbdc6f77b --- /dev/null +++ b/.github/fixtures/win7-host-repro-config.toml @@ -0,0 +1,5 @@ +# sccache hashes proc-macro DLLs as downstream compiler inputs. +target-applies-to-host = false + +[host.x86_64-pc-windows-msvc] +rustflags = ["-Clink-arg=/Brepro"] diff --git a/.github/scripts/ci-workflow.test.mjs b/.github/scripts/ci-workflow.test.mjs index 873e51388b..b9a8203170 100644 --- a/.github/scripts/ci-workflow.test.mjs +++ b/.github/scripts/ci-workflow.test.mjs @@ -147,6 +147,12 @@ test("Windows compatibility jobs cache Rust compilation without wrapping C or C+ assert.ok(win7.includes("fc920bf0ec8de6ee65d409111f7ec508035751ba")); assert.ok(win7.includes('version: "v0.16.0"')); assert.ok(win7.includes("sccache --show-stats")); + for (const flag of ["-Z host-config", "-Z target-applies-to-host", "-Z build-std=std,panic_abort"]) assert.ok(win7.includes(flag)); + assert.ok(win7.includes("--config .github/fixtures/win7-host-repro-config.toml")); + const hostConfig = readFileSync(new URL("../fixtures/win7-host-repro-config.toml", import.meta.url), "utf8"); + assert.ok(hostConfig.includes("target-applies-to-host = false")); + assert.ok(hostConfig.includes('[host.x86_64-pc-windows-msvc]')); + assert.ok(hostConfig.includes('rustflags = ["-Clink-arg=/Brepro"]')); assert.ok(win7.includes("--timings")); assert.ok(win7.includes("name: DBX-win7-cargo-timings")); assert.ok(win7.includes("path: target/cargo-timings/")); diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7ec6f3aac..0d3e1e40f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -519,7 +519,10 @@ jobs: shell: pwsh run: | $env:TAURI_CONFIG = Get-Content src-tauri/tauri.webview2-win7-fixed.conf.json -Raw - cargo build --locked --package dbx --release --features custom-protocol --target x86_64-win7-windows-msvc -Z build-std=std,panic_abort --timings + cargo -Z host-config -Z target-applies-to-host -Z build-std=std,panic_abort ` + --config .github/fixtures/win7-host-repro-config.toml ` + build --locked --package dbx --release --features custom-protocol ` + --target x86_64-win7-windows-msvc --timings - name: Upload Windows 7 Cargo timings if: always() diff --git a/apps/desktop/src/lib/__tests__/windowsInstallerTemplate.spec.ts b/apps/desktop/src/lib/__tests__/windowsInstallerTemplate.spec.ts index 719ea72892..55c22a5f7d 100644 --- a/apps/desktop/src/lib/__tests__/windowsInstallerTemplate.spec.ts +++ b/apps/desktop/src/lib/__tests__/windowsInstallerTemplate.spec.ts @@ -187,7 +187,8 @@ describe("Windows 7 fixed WebView2 runtime bundle", () => { expect(appCargoToml).toContain('custom-protocol = ["tauri/custom-protocol"]'); expect(appBuildScript).toContain("CARGO_FEATURE_CUSTOM_PROTOCOL"); expect(appBuildScript).toContain("CARGO_CFG_TARGET_VENDOR"); - expect(ciWorkflow).toContain("--release --features custom-protocol --target x86_64-win7-windows-msvc"); + expect(ciWorkflow).toContain("build --locked --package dbx --release --features custom-protocol"); + expect(ciWorkflow).toContain("--target x86_64-win7-windows-msvc --timings"); expect(releaseWorkflow).toContain("--release --features custom-protocol --target x86_64-win7-windows-msvc"); expect(ciWorkflow).toContain("TAURI_CONFIG = Get-Content src-tauri/tauri.webview2-win7-fixed.conf.json -Raw"); expect(releaseWorkflow).toContain("TAURI_CONFIG = Get-Content src-tauri/tauri.webview2-win7-fixed.conf.json -Raw");