From 688097d9f5658d1228a68c2184d1d1fa75bb3f49 Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 08:20:06 +0200 Subject: [PATCH 01/12] Cache vcpkg for macOS --- .github/workflows/main.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c2e00e548f2..49fa8cf4731 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -362,8 +362,6 @@ jobs: build-macos: name: build-macos-${{ matrix.arch }} runs-on: ${{ (matrix.arch == 'arm64' && 'macos-14') || 'macos-13' }} - env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" strategy: fail-fast: false @@ -386,12 +384,13 @@ jobs: run: | brew install automake autoconf-archive libtool ninja - - name: Export GitHub Actions cache environment variables - uses: actions/github-script@v7 + - name: Restore vcpkg cache + uses: actions/cache/restore@v4 with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + path: ~/.cache/vcpkg/archives + key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ github.run_id }} + restore-keys: | + vcpkg-vcpackage-${{ runner.os }}-${{ matrix.arch }} - name: Build run: | @@ -419,6 +418,12 @@ jobs: mkdir gen/artifacts mv gen/Release/*.pkg gen/artifacts + - name: Save vcpkg cache + uses: actions/cache/save@v4 + with: + path: ~/.cache/vcpkg/archives + key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ github.run_id }} + - name: Upload installer uses: actions/upload-artifact@v4 with: From f50bc3e3f31e2c1cf004e135f8628d68ca95892e Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 10:13:14 +0200 Subject: [PATCH 02/12] Don't specify key twice, and silence brew --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 49fa8cf4731..b17f3232472 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -382,10 +382,11 @@ jobs: - name: Prepare - Install tools run: | - brew install automake autoconf-archive libtool ninja + brew install --quiet automake autoconf-archive libtool ninja - name: Restore vcpkg cache uses: actions/cache/restore@v4 + id: restore-vcpkg-cache with: path: ~/.cache/vcpkg/archives key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ github.run_id }} @@ -422,7 +423,7 @@ jobs: uses: actions/cache/save@v4 with: path: ~/.cache/vcpkg/archives - key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ github.run_id }} + key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }} - name: Upload installer uses: actions/upload-artifact@v4 From 43fd745e49c0ba14772bfe90943f0abf6524dd2b Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 10:18:39 +0200 Subject: [PATCH 03/12] Fix wrong restore key --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b17f3232472..326a7cfcd87 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -391,7 +391,7 @@ jobs: path: ~/.cache/vcpkg/archives key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ github.run_id }} restore-keys: | - vcpkg-vcpackage-${{ runner.os }}-${{ matrix.arch }} + vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}- - name: Build run: | From 297fc169f38d1c1ac973d8a39226869e5ddf2045 Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 10:35:37 +0200 Subject: [PATCH 04/12] Cache based on files in vpkg-custom --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 326a7cfcd87..090da3ffabc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -389,7 +389,7 @@ jobs: id: restore-vcpkg-cache with: path: ~/.cache/vcpkg/archives - key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ github.run_id }} + key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('vcpkg-custom/**') }} restore-keys: | vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}- @@ -421,6 +421,7 @@ jobs: - name: Save vcpkg cache uses: actions/cache/save@v4 + if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true' with: path: ~/.cache/vcpkg/archives key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }} From e5f2ff392c4706d78a1e57b5fbe072aa616a4d03 Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 10:53:50 +0200 Subject: [PATCH 05/12] Empty commit to trigger actions From dbd1dc69b056244dbd88c2bcc55fbb261cad9a6c Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 15:18:59 +0200 Subject: [PATCH 06/12] Check what happens if we don't check for cache hit --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 090da3ffabc..d5ae7a32d74 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -421,7 +421,7 @@ jobs: - name: Save vcpkg cache uses: actions/cache/save@v4 - if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true' + # if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true' with: path: ~/.cache/vcpkg/archives key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }} From 6d1784e9f300f4e0d66aa152c5af738c554aa820 Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 15:39:22 +0200 Subject: [PATCH 07/12] Hash on cache itself --- .github/workflows/main.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5ae7a32d74..ea705b04af1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -389,9 +389,8 @@ jobs: id: restore-vcpkg-cache with: path: ~/.cache/vcpkg/archives - key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('vcpkg-custom/**') }} - restore-keys: | - vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}- + # We're always matching on a partial key here! + key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}- - name: Build run: | @@ -421,10 +420,10 @@ jobs: - name: Save vcpkg cache uses: actions/cache/save@v4 - # if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true' + if: steps.restore-vcpkg-cache.outputs.cache-matched-key != 'vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('~/.cache/vcpkg/archives/**') }}' with: path: ~/.cache/vcpkg/archives - key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }} + key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('~/.cache/vcpkg/archives/**') }} - name: Upload installer uses: actions/upload-artifact@v4 From 7366bad30e499295af8edcc727a7bf628781427d Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 15:56:59 +0200 Subject: [PATCH 08/12] Revert previous, and include vcpkg --- .github/workflows/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea705b04af1..13aaf540197 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -389,8 +389,9 @@ jobs: id: restore-vcpkg-cache with: path: ~/.cache/vcpkg/archives - # We're always matching on a partial key here! - key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}- + key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('vcpkg-custom/**', 'vcpkg/**') }} + restore-keys: | + vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}- - name: Build run: | @@ -420,10 +421,10 @@ jobs: - name: Save vcpkg cache uses: actions/cache/save@v4 - if: steps.restore-vcpkg-cache.outputs.cache-matched-key != 'vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('~/.cache/vcpkg/archives/**') }}' + if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true' with: path: ~/.cache/vcpkg/archives - key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('~/.cache/vcpkg/archives/**') }} + key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }} - name: Upload installer uses: actions/upload-artifact@v4 From 7a3439e4446a15c70825c736e91cb93745456285 Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 16:16:35 +0200 Subject: [PATCH 09/12] Add commet explaining condition --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 13aaf540197..aed70ca946b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -421,6 +421,7 @@ jobs: - name: Save vcpkg cache uses: actions/cache/save@v4 + # Saves if the key changed (with hash based on contents of vcpkg/ and vcpkg-custom/) if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true' with: path: ~/.cache/vcpkg/archives From da794a6d0d08e47f90022618a6ad27f93a2d4d11 Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 16:18:25 +0200 Subject: [PATCH 10/12] Add file to vcpkg-custom to change hash --- vcpkg-custom/DELETE-ME.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 vcpkg-custom/DELETE-ME.txt diff --git a/vcpkg-custom/DELETE-ME.txt b/vcpkg-custom/DELETE-ME.txt new file mode 100644 index 00000000000..8715e32b1d0 --- /dev/null +++ b/vcpkg-custom/DELETE-ME.txt @@ -0,0 +1 @@ +Test for https://github.com/FirebirdSQL/firebird/pull/8560, should not be merged From 990e737cd9dcc0be8c85ae795aa6f3c2b35920fd Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 16:38:40 +0200 Subject: [PATCH 11/12] Delete test file --- vcpkg-custom/DELETE-ME.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 vcpkg-custom/DELETE-ME.txt diff --git a/vcpkg-custom/DELETE-ME.txt b/vcpkg-custom/DELETE-ME.txt deleted file mode 100644 index 8715e32b1d0..00000000000 --- a/vcpkg-custom/DELETE-ME.txt +++ /dev/null @@ -1 +0,0 @@ -Test for https://github.com/FirebirdSQL/firebird/pull/8560, should not be merged From 211aa6ceb82a713033a06df46d1c6636318cbdff Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Sat, 10 May 2025 16:41:31 +0200 Subject: [PATCH 12/12] Hash on vcpkg config, not vcpkg/** --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aed70ca946b..99313f2fd61 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -389,7 +389,7 @@ jobs: id: restore-vcpkg-cache with: path: ~/.cache/vcpkg/archives - key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('vcpkg-custom/**', 'vcpkg/**') }} + key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('vcpkg-custom/**', 'vcpkg.json', 'vcpkg-configuration.json') }} restore-keys: | vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}- @@ -421,7 +421,7 @@ jobs: - name: Save vcpkg cache uses: actions/cache/save@v4 - # Saves if the key changed (with hash based on contents of vcpkg/ and vcpkg-custom/) + # Saves if the key changed (hashes on vcpkg/**, vcpkg.json, vcpkg-configuration.json) if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true' with: path: ~/.cache/vcpkg/archives