Skip to content

Commit 848b0ec

Browse files
Fix GitHub actions cache handling
Fix the CCache cache path. The default in modern CCache is ~/.cache/ccache. Use `github.run_id` for cache key timestamp. Previous timestamp generation emitted a warning about `set-output` being deprecated.
1 parent 2dc8339 commit 848b0ec

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,11 @@ jobs:
9999
- name: Install build dependencies
100100
run: sudo apt-get install -y libboost-filesystem-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev ccache
101101

102-
# See https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/
103-
- name: Prepare ccache timestamp
104-
id: ccache_cache_timestamp
105-
shell: cmake -P {0}
106-
run: |
107-
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
108-
message("::set-output name=timestamp::${current_date}")
109-
110102
- name: Configure ccache
111103
uses: actions/cache@v4
112104
with:
113-
path: ~/.ccache
114-
key: ${{ matrix.config.os }}-${{ matrix.config.CC }}-${{ matrix.config.version }}-${{ matrix.config.type }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
105+
path: ~/.cache/ccache
106+
key: ${{ matrix.config.os }}-${{ matrix.config.CC }}-${{ matrix.config.version }}-${{ matrix.config.type }}-ccache-${{ github.run_id }}
115107
restore-keys: ${{ matrix.config.os }}-${{ matrix.config.CC }}-${{ matrix.config.version }}-${{ matrix.config.type }}-ccache-
116108

117109
- name: Create Build Environment
@@ -157,7 +149,10 @@ jobs:
157149
shell: bash
158150
run: |
159151
make -j3 VERBOSE=1
160-
ccache -s
152+
153+
- name: Show ccache statistics
154+
run: |
155+
ccache --show-stats --verbose
161156
162157
- name: Test
163158
working-directory: ${{runner.workspace}}/build

0 commit comments

Comments
 (0)