From e77d640a1e9deac2627a942a2e47d4858221b46b Mon Sep 17 00:00:00 2001 From: David de Hilster Date: Wed, 14 Oct 2026 22:20:57 -0400 Subject: [PATCH] ci: persist the vcpkg cache across runs and warm it on main #44 stopped the per-wheel ICU rebuilds, but the cache still never saved: vcpkg-action@v6 saves through pat-s/always-upload-cache@v3, which calls the retired cache service ("Failed to save: Our services aren't available"). - Upgrade to vcpkg-action@v8, which saves with actions/cache@v5. - Pin the vcpkg revision so a new vcpkg release doesn't change the key. - Add vcpkg-cache.yml to build the cache on main. Tag builds can only restore caches from their own tag or the default branch, and publish.yml never runs on main, so without this every release would miss. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/publish.yml | 26 ++++++++-------- .github/workflows/vcpkg-cache.yml | 50 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/vcpkg-cache.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c431978..c20eef2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -70,17 +70,16 @@ jobs: - name: vcpkg build id: vcpkg - uses: johnwason/vcpkg-action@v6 + uses: johnwason/vcpkg-action@v8 with: manifest-dir: ${{ github.workspace }} triplet: arm64-osx-release token: ${{ github.token }} - # vcpkg removed its 'x-gha' backend, so github-binarycache: true - # caches nothing and ICU was rebuilt from source on every run -- once - # here and again inside each per-Python wheel build (~5x per job). - # false switches the action to its file cache (VCPKG_DEFAULT_BINARY_CACHE - # + actions/cache), which the wheel builds also hit. - github-binarycache: false + # Pinned so the cache key is stable; must match vcpkg-cache.yml, which + # warms the cache on main (tag builds can only restore main's caches). + # The action's file cache (VCPKG_DEFAULT_BINARY_CACHE) is also what + # the per-Python wheel builds restore ICU from instead of rebuilding. + revision: '2026.07.29' # Replaces the previous bare `pip wheel`, which only built a single wheel # for the runner's host Python (leaving cp310-cp312 macOS users with no @@ -121,17 +120,16 @@ jobs: - name: vcpkg build id: vcpkg - uses: johnwason/vcpkg-action@v6 + uses: johnwason/vcpkg-action@v8 with: manifest-dir: ${{ github.workspace }} triplet: x64-windows-release token: ${{ github.token }} - # vcpkg removed its 'x-gha' backend, so github-binarycache: true - # caches nothing and ICU was rebuilt from source on every run -- once - # here and again inside each per-Python wheel build (~5x per job). - # false switches the action to its file cache (VCPKG_DEFAULT_BINARY_CACHE - # + actions/cache), which the wheel builds also hit. - github-binarycache: false + # Pinned so the cache key is stable; must match vcpkg-cache.yml, which + # warms the cache on main (tag builds can only restore main's caches). + # The action's file cache (VCPKG_DEFAULT_BINARY_CACHE) is also what + # the per-Python wheel builds restore ICU from instead of rebuilding. + revision: '2026.07.29' - name: Build wheels # See the Linux job: v2.19.2 is too old to build cp313, so 3.13 diff --git a/.github/workflows/vcpkg-cache.yml b/.github/workflows/vcpkg-cache.yml new file mode 100644 index 0000000..1e2b18a --- /dev/null +++ b/.github/workflows/vcpkg-cache.yml @@ -0,0 +1,50 @@ +# Builds ICU through vcpkg on main so publish.yml can restore it. +# +# publish.yml only runs on pull requests and v* tags, and a tag build can only +# restore caches saved on its own tag or on the default branch. Without a cache +# on main, every release would build ICU from source (~14 min on Windows). This +# job saves one; the weekly run keeps it from being evicted after 7 idle days. +# +# The vcpkg step must match publish.yml exactly (action version, manifest-dir, +# triplet, revision), or the cache key differs and publish.yml misses it. + +name: Warm vcpkg cache + +on: + workflow_dispatch: + schedule: + - cron: '0 6 * * 1' + push: + branches: [main] + paths: + - vcpkg.json + - .github/workflows/vcpkg-cache.yml + +jobs: + vcpkg: + name: vcpkg (${{ matrix.triplet }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + triplet: x64-windows-release + - os: macOS-latest + triplet: arm64-osx-release + + steps: + - uses: actions/checkout@v4 + + # Autotools are needed for vcpkg to build ICU from source on a cache miss. + - name: Install packages + if: runner.os == 'macOS' + run: brew install autoconf-archive autoconf automake pkg-config + + - name: vcpkg build + uses: johnwason/vcpkg-action@v8 + with: + manifest-dir: ${{ github.workspace }} + triplet: ${{ matrix.triplet }} + token: ${{ github.token }} + revision: '2026.07.29'