From 8cd052613a5f0b15c827e25196b4aa0bfc46c321 Mon Sep 17 00:00:00 2001 From: Mick Grove Date: Sun, 9 Nov 2025 17:34:14 -0800 Subject: [PATCH] Fixing CI builds for Windows on GitHub Actions --- .github/workflows/ci.yml | 30 +++++++++++++++++++++++++----- pcre-8.45.zip | 1 + 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 pcre-8.45.zip diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4a9568..25ea2ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,9 +8,6 @@ on: env: RUST_TOOLCHAIN: "1.90" -# This workflow runs on pull requests to the main branch -# It builds the project for 2 platforms, Linux arm64 and macOS arm64, -# and runs tests for each platform. All platforms tested on merge to main jobs: linux-arm64: name: Linux arm64 @@ -49,6 +46,14 @@ jobs: windows: name: Windows x64 runs-on: windows-latest + + # Windows-only env to keep vcpkg consistent and enable caching + env: + VCPKG_ROOT: C:\vcpkg + VCPKG_DOWNLOADS: C:\vcpkg\downloads + VCPKG_FEATURE_FLAGS: binarycaching + VCPKG_BINARY_SOURCES: clear;x-gha,readwrite + steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 @@ -57,8 +62,9 @@ jobs: profile: minimal override: true + # Cache vcpkg artifacts & downloads (so we only fetch PCRE once) - name: Cache vcpkg artifacts - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | C:\vcpkg\buildtrees @@ -71,7 +77,21 @@ jobs: restore-keys: | ${{ runner.os }}-vcpkg- - - uses: Swatinem/rust-cache@v2 + # Ensure downloads dir exists and seed PCRE 8.45 zip from a working mirror + - name: Pre-seed PCRE 8.45 for vcpkg (bypass SourceForge redirect) + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path "$env:VCPKG_DOWNLOADS" | Out-Null + $dst = Join-Path $env:VCPKG_DOWNLOADS "pcre-8.45.zip" + if (-not (Test-Path $dst)) { + Invoke-WebRequest ` + -Uri "https://versaweb.dl.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.zip" ` + -OutFile $dst -UseBasicParsing + } + Get-ChildItem $env:VCPKG_DOWNLOADS + + - uses: swatinem/rust-cache@v2 + - name: Build run: .\buildwin.bat shell: cmd diff --git a/pcre-8.45.zip b/pcre-8.45.zip new file mode 100644 index 0000000..54299a4 --- /dev/null +++ b/pcre-8.45.zip @@ -0,0 +1 @@ +no \ No newline at end of file