ci(win7): enable safe Rust compile caching

This commit is contained in:
luo jiyin
2026-09-20 12:18:04 +08:00
committed by GitHub
parent 8074971399
commit 01bd07bb97
4 changed files with 45 additions and 15 deletions
+7 -2
View File
@@ -122,7 +122,7 @@ test("DuckDB Windows builds persist Rust and C++ compiler results", () => {
assert.ok(content.includes('version: "v0.16.0"'));
});
test("standard Windows compatibility checks run separately with sccache", () => {
test("Windows compatibility jobs cache Rust compilation without wrapping C or C++", () => {
assert.ok(job("changes").includes("'vendor/webview2-com-sys/**'"));
const standard = job("windows-standard-check");
assert.ok(standard.includes("needs.changes.outputs.windows_win7_bundle == 'true'"));
@@ -135,7 +135,12 @@ test("standard Windows compatibility checks run separately with sccache", () =>
assert.ok(standard.includes("sccache --show-stats"));
const win7 = job("windows-win7-bundle");
assert.doesNotMatch(win7, /x86_64-pc-windows-msvc|Setup Rust for standard Windows|RUSTC_WRAPPER: sccache/);
assert.doesNotMatch(win7, /x86_64-pc-windows-msvc|Setup Rust for standard Windows/);
for (const setting of ["RUSTC_WRAPPER: sccache", 'SCCACHE_GHA_ENABLED: "true"',
"SCCACHE_GHA_VERSION: win7-webview2-1.0.902.49-v1", 'SCCACHE_IDLE_TIMEOUT: "0"']) assert.ok(win7.includes(setting));
assert.ok(win7.includes("fc920bf0ec8de6ee65d409111f7ec508035751ba"));
assert.ok(win7.includes('version: "v0.16.0"'));
assert.doesNotMatch(win7, /^\s+(?:CC|CXX):/m);
});
test("the planner uses the exact event base and preserves a single workflow cancellation scope", () => {
+13
View File
@@ -311,6 +311,10 @@ jobs:
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: -C debuginfo=line-tables-only -C target-feature=+crt-static
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
SCCACHE_GHA_VERSION: win7-webview2-1.0.902.49-v1
SCCACHE_IDLE_TIMEOUT: "0"
steps:
- uses: actions/checkout@v5
@@ -334,6 +338,10 @@ jobs:
toolchain: nightly-2026-07-22
components: rust-src
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
with:
version: "v0.16.0"
- name: Prepare Win7-compatible WebView2 loader
shell: pwsh
run: ./.github/scripts/prepare-webview2-win7-loader.ps1
@@ -385,6 +393,11 @@ jobs:
Select-Object -First 1
./.github/scripts/assert-win7-installer-content.ps1 -InstallerPath $installer.FullName
- name: Show sccache stats
if: always()
continue-on-error: true
run: ${SCCACHE_PATH} --show-stats
- name: Upload Windows 7 test installer
uses: actions/upload-artifact@v4
with:
+14 -6
View File
@@ -564,15 +564,14 @@ jobs:
needs: release-ready
runs-on: windows-2022
environment: release-signing
# No sccache here: the loader patch rewrites a file inside the cargo
# registry, which is invisible to any compile cache. v0.6.0 shipped a
# binary linked against the wrong (>= 1.0.1054.31) WebView2 loader even
# though the patched 1.0.902.49 loader was verified on disk, so caching is
# disabled for this target until the patch is vendored into the source
# tree.
# The vendored loader is a tracked Cargo input, so Rust compile caching is safe.
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: -C debuginfo=line-tables-only -C target-feature=+crt-static
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
SCCACHE_GHA_VERSION: win7-webview2-1.0.902.49-v1
SCCACHE_IDLE_TIMEOUT: "0"
VSIGN_CERT_HASH: ${{ vars.VSIGN_CERT_HASH }}
VSIGN_OPERATOR_SHA1: ${{ vars.VSIGN_OPERATOR_SHA1 }}
VSIGN_SERVER: ${{ vars.VSIGN_SERVER }}
@@ -597,6 +596,10 @@ jobs:
toolchain: nightly-2026-07-22
components: rust-src
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
with:
version: "v0.16.0"
- name: Prepare Win7-compatible WebView2 loader
shell: pwsh
run: ./.github/scripts/prepare-webview2-win7-loader.ps1
@@ -682,6 +685,11 @@ jobs:
gh release upload "${env:GITHUB_REF_NAME}" $offlineName $checksumName `
--repo "${env:GITHUB_REPOSITORY}" --clobber
- name: Show sccache stats
if: always()
continue-on-error: true
run: ${SCCACHE_PATH} --show-stats
- name: Remove temporary VSign files
if: always()
shell: pwsh
@@ -140,16 +140,20 @@ describe("Windows 7 fixed WebView2 runtime bundle", () => {
expect(releaseWorkflow).toContain("./.github/scripts/assert-webview2-win7-loader.ps1");
});
it("keeps the existing Win7 compile-cache policy unchanged", () => {
it("caches Win7 Rust compilation without wrapping C or C++ compilers", () => {
const releaseWin7Job = releaseWorkflow.slice(releaseWorkflow.indexOf(" build-windows-7-offline:"), releaseWorkflow.indexOf(" static-browser:"));
const ciWin7Job = ciWorkflow.slice(ciWorkflow.indexOf(" windows-win7-bundle:"), ciWorkflow.indexOf(" duckdb-windows-driver:"));
// The vendored loader makes compile caching safe. This change does not alter
// cache policy. A separate CI change can enable caching for these jobs.
expect(releaseWin7Job).not.toContain("RUSTC_WRAPPER");
expect(releaseWin7Job).not.toContain("sccache-action");
expect(ciWin7Job).not.toContain("RUSTC_WRAPPER");
expect(ciWin7Job).not.toContain("sccache-action");
for (const job of [releaseWin7Job, ciWin7Job]) {
expect(job).toContain("RUSTC_WRAPPER: sccache");
expect(job).toContain('SCCACHE_GHA_ENABLED: "true"');
expect(job).toContain("SCCACHE_GHA_VERSION: win7-webview2-1.0.902.49-v1");
expect(job).toContain('SCCACHE_IDLE_TIMEOUT: "0"');
expect(job).toContain("mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba");
expect(job).toContain('version: "v0.16.0"');
expect(job).not.toMatch(/^\s+(?:CC|CXX):/m);
expect(job).not.toContain("CARGO_PROFILE_RELEASE_");
}
});
it("probes the fixed runtime through the Win7-compatible loader", () => {