Skip to content

Commit 82b6fa5

Browse files
authored
GH-50208: [CI][C++][Python] Disable ccache hash_dir (#50209)
### Rationale for this change By default, ccache hashes the path to the current directory in its cache key. However, some builds put their source files in a temporary directory (such as Python builds), which makes caching inefficient as the current directory is different everytime. ### What changes are included in this PR? Disable the ccache `hash_dir` option on CI, using an environment variable. ### Are these changes tested? Yes, by existing CI jobs. I also checked locally using `ccache -s` that this improves the caching of compiled C++ artifacts (from the source files in `python/pyarrow/src`) when building PyArrow. ### Are there any user-facing changes? No. * GitHub Issue: #50208 Authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 9cb051b commit 82b6fa5

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

ci/scripts/ccache_setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919

2020
set -eux
2121

22+
# See similar definitions in compose.yaml under the `x-ccache` key
2223
{
2324
echo "ARROW_USE_CCACHE=ON"
2425
echo "CCACHE_COMPILERCHECK=content"
2526
echo "CCACHE_COMPRESS=1"
2627
echo "CCACHE_COMPRESSLEVEL=6"
2728
echo "CCACHE_MAXSIZE=1G"
29+
echo "CCACHE_NOHASHDIR=1"
2830
} >> "$GITHUB_ENV"

compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ x-ccache: &ccache
5959
CCACHE_COMPRESSLEVEL: 6
6060
CCACHE_MAXSIZE: 1G
6161
CCACHE_DIR: /ccache
62+
# Some builds (such as PyArrow) copy their source files in a temporary directory,
63+
# avoid hashing the current directory to make ccache useful on those builds.
64+
CCACHE_NOHASHDIR: 1
6265

6366
x-common: &common
6467
GITHUB_ACTIONS:

0 commit comments

Comments
 (0)