Skip to content

Commit 5f23b04

Browse files
committed
perf: keep non-Windows compiler caches fresh
1 parent 8e526f1 commit 5f23b04

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

.github/actions/ccache/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ runs:
2121
major=$(cat ${{ inputs.php_directory }}/main/php_version.h | sed -En 's/^#define PHP_MAJOR_VERSION ([0-9]+)/\1/p')
2222
minor=$(cat ${{ inputs.php_directory }}/main/php_version.h | sed -En 's/^#define PHP_MINOR_VERSION ([0-9]+)/\1/p')
2323
release=$(cat ${{ inputs.php_directory }}/main/php_version.h | sed -En 's/^#define PHP_RELEASE_VERSION ([0-9]+)/\1/p')
24-
week=$(date +"%Y-%W")
2524
prefix="${{ inputs.name }}-$major.$minor.$release"
26-
echo "key=$prefix-$week" >> $GITHUB_OUTPUT
25+
# GitHub cache entries are immutable, so each commit needs a new key.
26+
echo "key=$prefix-$GITHUB_SHA" >> $GITHUB_OUTPUT
2727
echo "prefix=$prefix-" >> $GITHUB_OUTPUT
2828
- name: ccache
29-
uses: hendrikmuhs/ccache-action@v1.2
29+
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
3030
with:
3131
key: "${{ steps.cache_key.outputs.key }}"
3232
append-timestamp: false

.github/matrix.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
['name' => 'PHP-8.2', 'ref' => 'PHP-8.2', 'version' => [8, 2]],
99
];
1010

11+
// Temporary while profiling non-Windows CI builds. Remove after this work is complete.
12+
const SKIP_WINDOWS_CI = true;
13+
1114
function get_branch_commit_cache_file_path(): string {
1215
return dirname(__DIR__) . '/branch-commit-cache.json';
1316
}
@@ -187,6 +190,9 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re
187190
foreach ($branches as &$branch) {
188191
$php_version = $branch['version'][0] . '.' . $branch['version'][1];
189192
$branch['jobs'] = select_jobs($repository, $trigger, $nightly, $labels, $php_version, $branch['ref'], $all_variations);
193+
if (SKIP_WINDOWS_CI) {
194+
unset($branch['jobs']['WINDOWS']);
195+
}
190196
$branch['config']['ubuntu_version'] = version_compare($php_version, '8.5', '>=') ? '24.04' : '22.04';
191197
}
192198

.github/workflows/unit-tests.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- 'main/io/**'
77
- 'main/php_io.h'
88
- 'tests/unit/**'
9+
- '.github/actions/ccache/action.yml'
910
- '.github/workflows/unit-tests.yml'
1011
branches:
1112
- master
@@ -15,6 +16,7 @@ on:
1516
- 'main/io/**'
1617
- 'main/php_io.h'
1718
- 'tests/unit/**'
19+
- '.github/actions/ccache/action.yml'
1820
- '.github/workflows/unit-tests.yml'
1921
branches:
2022
- '**'
@@ -57,11 +59,9 @@ jobs:
5759
ccache
5860
5961
- name: ccache
60-
uses: hendrikmuhs/ccache-action@v1.2
62+
uses: ./.github/actions/ccache
6163
with:
62-
key: "unit-tests-${{hashFiles('main/php_version.h')}}"
63-
append-timestamp: false
64-
save: ${{ github.event_name != 'pull_request' }}
64+
name: UNIT_TESTS_LINUX_X64
6565

6666
- name: ./configure (minimal build)
6767
uses: ./.github/actions/configure-unit-tests
@@ -76,4 +76,3 @@ jobs:
7676
set -x
7777
cd tests/unit
7878
make test
79-

0 commit comments

Comments
 (0)