ci: use prebuilt Win7 AWS-LC cache in bundle job

This commit is contained in:
luo jiyin authored and GitHub committed 2026-09-22 02:26:18 +08:00
1 parent 34d8811cd3
commit 9653971def
4 files changed
+228 -1

No files matched your search

+113
View File
@@ -0,0 +1,113 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "aws-lc-sys"
version = "0.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43103168cc76fe62678a375e722fc9cb3a0146159ac5828bc4f0dfd755c2224c"
dependencies = [
"cc",
"cmake",
"dunce",
"fs_extra",
"pkg-config",
]
[[package]]
name = "cc"
version = "1.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54413ede23c2daf518f35156dfde027feb2374004d63bd497f983c8db9c0e313"
dependencies = [
"find-msvc-tools",
"jobserver",
"libc",
"shlex",
]
[[package]]
name = "cfg-if"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
[[package]]
name = "cmake"
version = "0.1.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"
dependencies = [
"cc",
]
[[package]]
name = "dunce"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
[[package]]
name = "find-msvc-tools"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef25905e51abafe4dcea6c15fec58c57b601cdbd0ee53d22ea1d3016c587d39b"
[[package]]
name = "fs_extra"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]]
name = "getrandom"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
dependencies = [
"cfg-if",
"libc",
"r-efi",
]
[[package]]
name = "jobserver"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"
dependencies = [
"getrandom",
"libc",
]
[[package]]
name = "libc"
version = "0.2.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
[[package]]
name = "pkg-config"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
[[package]]
name = "r-efi"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "win7-aws-lc-cache"
version = "0.0.0"
dependencies = [
"aws-lc-sys",
]
@@ -0,0 +1,10 @@
[package]
name = "win7-aws-lc-cache"
version = "0.0.0"
edition = "2021"
publish = false
[dependencies]
aws-lc-sys = { version = "=0.43.0", features = ["prebuilt-nasm"] }
[workspace]
@@ -0,0 +1,3 @@
fn main() {
unsafe { aws_lc_sys::CRYPTO_library_init() };
}
+102 -1
View File
@@ -316,6 +316,9 @@ jobs:
SCCACHE_GHA_ENABLED: "true" SCCACHE_GHA_ENABLED: "true"
SCCACHE_GHA_VERSION: win7-webview2-1.0.902.49-v1 SCCACHE_GHA_VERSION: win7-webview2-1.0.902.49-v1
SCCACHE_IDLE_TIMEOUT: "0" SCCACHE_IDLE_TIMEOUT: "0"
# Single source for the job's nightly pin: the toolchain step and the
# prebuilt AWS-LC cache key must move together.
WIN7_NIGHTLY_TOOLCHAIN: nightly-2026-07-22
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
@@ -336,13 +339,111 @@ jobs:
- name: Setup Rust for Windows 7 - name: Setup Rust for Windows 7
uses: dtolnay/rust-toolchain@nightly uses: dtolnay/rust-toolchain@nightly
with: with:
toolchain: nightly-2026-07-22 toolchain: ${{ env.WIN7_NIGHTLY_TOOLCHAIN }}
components: rust-src components: rust-src
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11 - uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
with: with:
version: "v0.16.0" version: "v0.16.0"
- name: Restore prebuilt Win7 AWS-LC
id: aws-lc-cache
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/win7-aws-lc-install
# Key covers the workspace Cargo.lock too: a main-workspace aws-lc-sys
# bump must rebuild the prebuilt artifacts instead of reusing the
# cached headers/lib for a stale version.
key: win7-aws-lc-v3-${{ runner.os }}-${{ env.WIN7_NIGHTLY_TOOLCHAIN }}-${{ hashFiles('Cargo.lock', '.github/fixtures/win7-aws-lc-cache/Cargo.lock') }}
- name: Build Win7 AWS-LC cache
if: steps.aws-lc-cache.outputs.cache-hit != 'true'
shell: pwsh
run: |
$timer = [System.Diagnostics.Stopwatch]::StartNew()
$targetRoot = Join-Path $env:RUNNER_TEMP "win7-aws-lc-build"
$installRoot = Join-Path $env:RUNNER_TEMP "win7-aws-lc-install"
cargo build --locked --release `
--manifest-path .github/fixtures/win7-aws-lc-cache/Cargo.toml `
--target x86_64-win7-windows-msvc `
-Z build-std=std,panic_abort
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$include = Get-ChildItem $targetRoot -Directory -Recurse -Filter include |
Where-Object { Test-Path (Join-Path $_.FullName "openssl/base.h") } |
Select-Object -First 1
$library = Get-ChildItem $targetRoot -File -Recurse -Filter "*crypto.lib" |
Where-Object { $_.Name -like "*aws_lc_0_43_0_crypto.lib" } |
Select-Object -First 1
if (!$include -or !$library) {
Write-Error "AWS-LC did not create the required headers and static library."
exit 1
}
$metadata = cargo metadata --locked --format-version 1 `
--manifest-path .github/fixtures/win7-aws-lc-cache/Cargo.toml |
ConvertFrom-Json
$awsLcPackage = $metadata.packages |
Where-Object { $_.name -eq "aws-lc-sys" } |
Select-Object -First 1
$crateRoot = Split-Path $awsLcPackage.manifest_path -Parent
$bindings = Join-Path $crateRoot "src/x86_64_pc_windows_msvc_crypto.rs"
if (!(Test-Path $bindings)) {
Write-Error "AWS-LC did not provide the Windows MSVC bindings."
exit 1
}
New-Item -ItemType Directory -Path (Join-Path $installRoot "include") -Force | Out-Null
New-Item -ItemType Directory -Path (Join-Path $installRoot "lib") -Force | Out-Null
New-Item -ItemType Directory -Path (Join-Path $installRoot "share/rust") -Force | Out-Null
Copy-Item -Path (Join-Path $include.FullName "*") `
-Destination (Join-Path $installRoot "include") -Recurse -Force
Copy-Item -LiteralPath $library.FullName `
-Destination (Join-Path $installRoot "lib/crypto.lib") -Force
$bindingOutput = Join-Path $installRoot "share/rust/aws_lc_bindings.rs"
$insideInnerAttribute = $false
$bindingLines = foreach ($line in Get-Content -LiteralPath $bindings) {
if (!$insideInnerAttribute -and $line -eq "#![allow(") {
$insideInnerAttribute = $true
continue
}
if ($insideInnerAttribute) {
if ($line -eq ")]") {
$insideInnerAttribute = $false
}
continue
}
$line
}
$bindingLines | Set-Content -LiteralPath $bindingOutput -Encoding utf8NoBOM
$timer.Stop()
"AWS-LC cache build: $([math]::Round($timer.Elapsed.TotalSeconds, 1)) seconds" >> $env:GITHUB_STEP_SUMMARY
env:
CARGO_TARGET_DIR: ${{ runner.temp }}/win7-aws-lc-build
- name: Configure prebuilt Win7 AWS-LC
shell: pwsh
run: |
$installRoot = Join-Path $env:RUNNER_TEMP "win7-aws-lc-install"
$requiredFiles = @(
"include/openssl/base.h",
"include/openssl/boringssl_prefix_symbols.h",
"lib/crypto.lib",
"share/rust/aws_lc_bindings.rs"
)
foreach ($relativePath in $requiredFiles) {
if (!(Test-Path (Join-Path $installRoot $relativePath))) {
Write-Error "The AWS-LC cache does not contain $relativePath."
exit 1
}
}
"AWS_LC_SYS_SYSTEM_DIR=$installRoot" >> $env:GITHUB_ENV
"AWS_LC_SYS_USE_SYSTEM=1" >> $env:GITHUB_ENV
"AWS_LC_SYS_STATIC=1" >> $env:GITHUB_ENV
"AWS-LC cache hit: ${{ steps.aws-lc-cache.outputs.cache-hit }}" >> $env:GITHUB_STEP_SUMMARY
- name: Prepare Win7-compatible WebView2 loader - name: Prepare Win7-compatible WebView2 loader
shell: pwsh shell: pwsh
run: ./.github/scripts/prepare-webview2-win7-loader.ps1 run: ./.github/scripts/prepare-webview2-win7-loader.ps1