我有一个虚拟 C++ 项目,我有以下 github 操作配置:
name: CI
on: [push, pull_request] # on all pushes and PRs
jobs:
dummy:
runs-on: ubuntu-latest
strategy:
matrix:
distro: ["ros:foxy-ros-base-focal"]
container:
image: ${{ matrix.distro }}
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache"
steps:
- uses: actions/checkout@v2
- name: install ccache
run: |
sudo apt-get update -y
sudo apt-get -qq install ccache
- name: ccache cache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.distro }}-${{github.run_id}}
restore-keys: |
ccache-${{ matrix.distro }}
- name: ccache stats
run: ccache -s
- name: Build workspace
run: |
bash ./build_bridge.sh
我正在ccache
通过添加/删除库进行测试CMakeLists.txt
,但每次ccache
命中率为 0%
cache directory /__w/action_test/action_test/.ccache
primary config /__w/action_test/action_test/.ccache/ccache.conf
secondary config (readonly) /etc/ccache.conf
cache hit (direct) 0
cache hit (preprocessed) 0
cache miss 0
cache hit rate 0.00 %
cleanups performed 0
files in cache 0
cache size 0.0 kB
max cache size 5.0 GB
从中恢复缓存的上一个作业有一个输出:
Post job cleanup.
/usr/bin/docker exec b170bb77ebaac32aed0561984bb959d515d8a025b9329b6309b986f6b676c6c4 sh -c "cat /etc/*release | grep ^ID"
/usr/bin/tar --posix -z -cf cache.tgz -P -C /__w/action_test/action_test --files-from manifest.txt
Cache saved successfully
我需要做任何特定的事情来保存特定于 cmake 的缓存吗?