From 244047dfc3015a75cb70845c83b6072f5d9167f3 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Thu, 19 Feb 2026 17:04:34 +0100 Subject: [PATCH 1/7] [CI] Fix ineffective ccache Cache on GHA is immutable. For this reason, hendrikmuhs/ccache-action creates a new cache entry for each push, each with an appended timestamp, which fills the cache very quickly. In an attempt to fix this, we've disabled the append-timestamp option and appended a hash of php_version.h. Hence, we'll only get a new cache file once this file is touched. However, since this file rarely ever updates for master, we're relying on an extremely outdated cache. To fix this, append the current year+week to rebuild the cache each week instead, as suggested by Tim. Also use major.minor version instead of the has of php_version.h for readability. Fixes GH-14154 --- .github/actions/ccache/action.yml | 13 ++++++++++++- .github/workflows/test-suite.yml | 3 +++ .github/workflows/test.yml | 3 --- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/actions/ccache/action.yml b/.github/actions/ccache/action.yml index fbd8691c927e2..b4ea44759c97c 100644 --- a/.github/actions/ccache/action.yml +++ b/.github/actions/ccache/action.yml @@ -5,9 +5,20 @@ inputs: runs: using: composite steps: + - name: Get cache key + shell: bash + id: cache_key + run: | + major=$(cat main/php_version.h | sed -En 's/^#define PHP_MAJOR_VERSION ([0-9]+)/\1/p') + minor=$(cat main/php_version.h | sed -En 's/^#define PHP_MINOR_VERSION ([0-9]+)/\1/p') + week=$(date +"%Y-%W") + prefix="${{ inputs.name }}-$major.$minor" + echo "key=$prefix-$week" >> $GITHUB_OUTPUT + echo "prefix=$prefix-" >> $GITHUB_OUTPUT - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: - key: "${{ inputs.name }}-${{ hashFiles('main/php_version.h') }}" + key: "${{ steps.cache_key.outputs.key }}" append-timestamp: false + restore-keys: "${{ steps.cache_key.outputs.prefix }}" save: ${{ github.event_name != 'pull_request' }} diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 97d28253f546f..842ad6dd99dd4 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -10,6 +10,9 @@ on: type: string permissions: contents: read +env: + CC: ccache gcc + CXX: ccache g++ jobs: LINUX_PPC64: if: ${{ fromJson(inputs.branch).jobs.LINUX_PPC64 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0970975df194f..b08d0031aa111 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,9 +29,6 @@ permissions: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.url || github.run_id }} cancel-in-progress: true -env: - CC: ccache gcc - CXX: ccache g++ jobs: GENERATE_MATRIX: name: Generate Matrix From d5caa577d0b114fdcac02435eb94d8f4e79820f9 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Thu, 19 Feb 2026 17:12:35 +0100 Subject: [PATCH 2/7] Enable save for pull requests for testing --- .github/actions/ccache/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/ccache/action.yml b/.github/actions/ccache/action.yml index b4ea44759c97c..6ce3ca3524549 100644 --- a/.github/actions/ccache/action.yml +++ b/.github/actions/ccache/action.yml @@ -21,4 +21,4 @@ runs: key: "${{ steps.cache_key.outputs.key }}" append-timestamp: false restore-keys: "${{ steps.cache_key.outputs.prefix }}" - save: ${{ github.event_name != 'pull_request' }} + #save: ${{ github.event_name != 'pull_request' }} From 45c9d85cec3903510f0431b4d7f8d43caab2b8ef Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Thu, 19 Feb 2026 19:53:56 +0100 Subject: [PATCH 3/7] Fix missing ccache for various jobs --- .github/actions/ccache/action.yml | 5 +++++ .github/workflows/test-suite.yml | 26 ++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/actions/ccache/action.yml b/.github/actions/ccache/action.yml index 6ce3ca3524549..3d68a24c12be1 100644 --- a/.github/actions/ccache/action.yml +++ b/.github/actions/ccache/action.yml @@ -22,3 +22,8 @@ runs: append-timestamp: false restore-keys: "${{ steps.cache_key.outputs.prefix }}" #save: ${{ github.event_name != 'pull_request' }} + - name: Export CC/CXX + shell: bash + run: | + export CC=ccache gcc + export CXX=ccache g++ diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 842ad6dd99dd4..ca41a1a906c23 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -10,9 +10,6 @@ on: type: string permissions: contents: read -env: - CC: ccache gcc - CXX: ccache g++ jobs: LINUX_PPC64: if: ${{ fromJson(inputs.branch).jobs.LINUX_PPC64 }} @@ -75,6 +72,10 @@ jobs: echo "::group::Show installed package versions" apk list echo "::endgroup::" + - name: ccache + uses: ./.github/actions/ccache + with: + name: "${{ github.job }}" - name: ./configure uses: ./.github/actions/configure-alpine with: @@ -395,6 +396,10 @@ jobs: uses: ./.github/actions/apt-x64 - name: Install gcovr run: sudo -H pip install gcovr + - name: ccache + uses: ./.github/actions/ccache + with: + name: "${{ github.job }}" - name: ./configure uses: ./.github/actions/configure-x64 with: @@ -436,6 +441,10 @@ jobs: ref: ${{ fromJson(inputs.branch).ref }} - name: apt uses: ./.github/actions/apt-x64 + - name: ccache + uses: ./.github/actions/ccache + with: + name: "COMMUNITY_${{ matrix.type }}" - name: ./configure uses: ./.github/actions/configure-x64 with: @@ -638,6 +647,10 @@ jobs: uses: ./.github/actions/setup-mssql - name: apt uses: ./.github/actions/apt-x64 + - name: ccache + uses: ./.github/actions/ccache + with: + name: "${{ matrix.job }}" - name: ./configure uses: ./.github/actions/configure-x64 with: @@ -695,6 +708,10 @@ jobs: ref: ${{ fromJson(inputs.branch).ref }} - name: apt uses: ./.github/actions/apt-x64 + - name: ccache + uses: ./.github/actions/ccache + with: + name: "${{ matrix.job }}" - name: ./configure run: | export CC=clang @@ -809,9 +826,6 @@ jobs: PECL: if: ${{ fromJson(inputs.branch).jobs.PECL }} runs-on: ubuntu-24.04 - env: - CC: ccache gcc - CXX: ccache g++ steps: - name: git checkout PHP uses: actions/checkout@v6 From 7a6f623a35425aee3aa384518b9a18f5339f750f Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Thu, 19 Feb 2026 19:54:38 +0100 Subject: [PATCH 4/7] Include release in cache key --- .github/actions/ccache/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/ccache/action.yml b/.github/actions/ccache/action.yml index 3d68a24c12be1..df0a9bdbdd3b7 100644 --- a/.github/actions/ccache/action.yml +++ b/.github/actions/ccache/action.yml @@ -11,8 +11,9 @@ runs: run: | major=$(cat main/php_version.h | sed -En 's/^#define PHP_MAJOR_VERSION ([0-9]+)/\1/p') minor=$(cat main/php_version.h | sed -En 's/^#define PHP_MINOR_VERSION ([0-9]+)/\1/p') + release=$(cat main/php_version.h | sed -En 's/^#define PHP_RELEASE_VERSION ([0-9]+)/\1/p') week=$(date +"%Y-%W") - prefix="${{ inputs.name }}-$major.$minor" + prefix="${{ inputs.name }}-$major.$minor.$release" echo "key=$prefix-$week" >> $GITHUB_OUTPUT echo "prefix=$prefix-" >> $GITHUB_OUTPUT - name: ccache From e075bb09eac0460a68cbeefff27e7748397a8932 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Thu, 19 Feb 2026 21:50:38 +0100 Subject: [PATCH 5/7] Fix setting of env var --- .github/actions/ccache/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/ccache/action.yml b/.github/actions/ccache/action.yml index df0a9bdbdd3b7..7f1e5891f52c0 100644 --- a/.github/actions/ccache/action.yml +++ b/.github/actions/ccache/action.yml @@ -26,5 +26,5 @@ runs: - name: Export CC/CXX shell: bash run: | - export CC=ccache gcc - export CXX=ccache g++ + echo "CC=ccache gcc" >> $GITHUB_ENV + echo "CXX=ccache g++" >> $GITHUB_ENV From a8cfd61ac9f0644bae7f66c2e047753ec61529a2 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Fri, 20 Feb 2026 10:51:18 +0100 Subject: [PATCH 6/7] Fix ccache job names --- .github/workflows/test-suite.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index ca41a1a906c23..c206ba4220b41 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -650,7 +650,7 @@ jobs: - name: ccache uses: ./.github/actions/ccache with: - name: "${{ matrix.job }}" + name: "${{ github.job }}" - name: ./configure uses: ./.github/actions/configure-x64 with: @@ -711,7 +711,7 @@ jobs: - name: ccache uses: ./.github/actions/ccache with: - name: "${{ matrix.job }}" + name: "${{ github.job }}" - name: ./configure run: | export CC=clang From 26e1ccf78c6c6750eb19a5a13782a985f3ad292e Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Fri, 20 Feb 2026 10:52:56 +0100 Subject: [PATCH 7/7] Attempt to fix trailing - in ccache cache file --- .github/actions/ccache/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/ccache/action.yml b/.github/actions/ccache/action.yml index 7f1e5891f52c0..7718675818122 100644 --- a/.github/actions/ccache/action.yml +++ b/.github/actions/ccache/action.yml @@ -20,7 +20,7 @@ runs: uses: hendrikmuhs/ccache-action@v1.2 with: key: "${{ steps.cache_key.outputs.key }}" - append-timestamp: false + append-timestamp: 0 restore-keys: "${{ steps.cache_key.outputs.prefix }}" #save: ${{ github.event_name != 'pull_request' }} - name: Export CC/CXX