Skip to content

Commit 4ac6407

Browse files
author
Aliaksandr Adziareika
committed
Return ccache directory via outputs
1 parent eb02fb8 commit 4ac6407

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.github/actions/ccache-setup/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Cross-platform ccache setup action with automatic caching.
2828
|--------|-------------|
2929
| `cache-hit` | `true` if cache was restored |
3030
| `cache-key` | Generated cache key |
31+
| `cache-dir` | Path to ccache directory |
3132

3233
## Cache key format
3334

.github/actions/ccache-setup/action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ outputs:
2626
cache-key:
2727
description: 'The cache key used'
2828
value: ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.arch }}-${{ steps.ccache-key.outputs.compiler }}-${{ steps.ccache-key.outputs.build-type }}-${{ steps.ccache-key.outputs.short-sha }}
29+
cache-dir:
30+
description: 'Path to ccache directory'
31+
value: ${{ steps.ccache-key.outputs.dir }}
2932

3033
runs:
3134
using: composite
@@ -56,6 +59,10 @@ runs:
5659
CMAKE_BUILD_TYPE: ${{ inputs.cmake-build-type }}
5760
run: |
5861
CCACHE_DIR="${{ github.workspace }}/.ccache"
62+
# Convert to Windows path if on Windows (native ccache doesn't understand Unix paths)
63+
if command -v cygpath &> /dev/null; then
64+
CCACHE_DIR=$(cygpath -w "$CCACHE_DIR")
65+
fi
5966
echo "dir=$CCACHE_DIR" >> "$GITHUB_OUTPUT"
6067
echo "CCACHE_DIR=$CCACHE_DIR" >> "$GITHUB_ENV"
6168
@@ -130,9 +137,6 @@ runs:
130137
key: ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.arch }}-${{ steps.ccache-key.outputs.compiler }}-${{ steps.ccache-key.outputs.build-type }}-${{ steps.ccache-key.outputs.short-sha }}
131138
restore-keys: |
132139
ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.arch }}-${{ steps.ccache-key.outputs.compiler }}-${{ steps.ccache-key.outputs.build-type }}-
133-
ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.arch }}-${{ steps.ccache-key.outputs.compiler }}-
134-
ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.compiler }}-${{ steps.ccache-key.outputs.build-type }}-
135-
ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.compiler }}-
136140
137141
- name: Configure ccache
138142
shell: bash

0 commit comments

Comments
 (0)