v1-0001-ci-namespace-ccache-by-PostgreSQL-major-version.patch
text/x-patch
Filename: v1-0001-ci-namespace-ccache-by-PostgreSQL-major-version.patch
Type: text/x-patch
Part: 0
Patch
Format: format-patch
Series: patch v1-0001
Subject: ci: namespace ccache by PostgreSQL major version
| File | + | − |
|---|---|---|
| .github/workflows/pg-ci.yml | 11 | 4 |
| src/tools/version_stamp.pl | 3 | 0 |
From d79d51ebf5fa30a20d76e2cb812abed5d684f571 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Fri, 3 Jul 2026 17:12:01 +0300
Subject: [PATCH v1] ci: namespace ccache by PostgreSQL major version
Add a PG_MAJOR_VERSION variable to the CI workflow and have
version_stamp.pl keep it in sync. The ccache cache keys include it, so
bumping the version starts from a fresh cache instead of reusing stale
objects from the previous major version.
Reported-by: Robert Haas <robertmhaas@gmail.com>
---
.github/workflows/pg-ci.yml | 15 +++++++++++----
src/tools/version_stamp.pl | 3 +++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/pg-ci.yml b/.github/workflows/pg-ci.yml
index 5bc5292d2a5..d1ef90ab3f6 100644
--- a/.github/workflows/pg-ci.yml
+++ b/.github/workflows/pg-ci.yml
@@ -136,6 +136,13 @@ env:
ON_DEFAULT_BRANCH: ${{github.event.repository.default_branch == github.ref_name }}
+ # Used to namespace the ccache caches, so that a new major version starts
+ # from a fresh cache rather than reusing stale objects built against the
+ # previous major version.
+ #
+ # Don't set manually, it is automatically set by 'version_stamp.pl' script.
+ PG_MAJOR_VERSION: "20"
+
# Note that we need to be careful to use a separator that can't be in branch
# names, otherwise e.g. caches for 'master' might be restored on the
# 'master-pending' branch.
@@ -306,8 +313,8 @@ jobs:
uses: actions/cache/restore@v5
with:
path: ${{ env.CCACHE_DIR }}
- key: ccache${{env.CACHE_PREFIX_DEFAULT}}${{env.CACHE_SUFFIX}}
- restore-keys: ccache${{env.CACHE_PREFIX_DEFAULT}}
+ key: ccache:v${{env.PG_MAJOR_VERSION}}${{env.CACHE_PREFIX_DEFAULT}}${{env.CACHE_SUFFIX}}
+ restore-keys: ccache:v${{env.PG_MAJOR_VERSION}}${{env.CACHE_PREFIX_DEFAULT}}
- &ccache_restore_branch_step
name: "ccache: Restore for branch ${{ github.ref_name }}"
@@ -315,8 +322,8 @@ jobs:
uses: actions/cache/restore@v5
with:
path: ${{ env.CCACHE_DIR }}
- key: ccache${{env.CACHE_PREFIX_BRANCH}}${{env.CACHE_SUFFIX}}
- restore-keys: ccache${{env.CACHE_PREFIX_BRANCH}}
+ key: ccache:v${{env.PG_MAJOR_VERSION}}${{env.CACHE_PREFIX_BRANCH}}${{env.CACHE_SUFFIX}}
+ restore-keys: ccache:v${{env.PG_MAJOR_VERSION}}${{env.CACHE_PREFIX_BRANCH}}
- &linux_prepare_workspace_step
name: Prepare workspace
diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl
index 8f94e9e2886..c1891e34092 100755
--- a/src/tools/version_stamp.pl
+++ b/src/tools/version_stamp.pl
@@ -98,6 +98,9 @@ sed_file("configure.ac",
sed_file("meson.build",
qq{-e "/^project(/,/^)/ s/ version: '[0-9a-z.]*',/ version: '$fullversion',/"}
);
+sed_file(".github/workflows/pg-ci.yml",
+ "-e 's/^\\( *PG_MAJOR_VERSION: *\"\\)[0-9]*\"/\\1$majorversion\"/'"
+);
print "Stamped these files with version number $fullversion:\n$fixedfiles";
print "Don't forget to run autoconf $aconfver before committing.\n";
--
2.47.3