Skip to content

Commit

Permalink
Refresh ccache once per day (#17)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #17

The repo gets several commits per day, causing an unnecessary number of cache evictions if we use the merge-base. This PR changes the cache key to the _date_ of the merge base, so we only evict the cache once per day.

Pull Request resolved: facebookexternal/f4d#1340

Reviewed By: christycylee

Differential Revision: D30123092

Pulled By: funrollloops

fbshipit-source-id: 3952bceea53fe70affe1ac934eec4319c0db921e
  • Loading branch information
funrollloops authored and facebook-github-bot committed Aug 10, 2021
1 parent 39e8d54 commit d1cedd9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ jobs:
paths:
- ~/deps
- run:
name: "Calculate merge-base for CCache"
command: git merge-base origin/main HEAD > merge-base
name: "Calculate merge-base date for CCache"
command: git show -s --format=%cd --date="format:%Y%m%d" $(git merge-base origin/main HEAD) | tee merge-base-date
- restore_cache:
name: "Restore CCache cache"
keys:
- velox-ccache-{{ arch }}-{{ checksum "merge-base" }}
- velox-ccache-{{ arch }}-{{ checksum "merge-base-date" }}
- run:
name: "Build on MacOS"
command: |
Expand All @@ -75,7 +75,7 @@ jobs:
no_output_timeout: 1h
- save_cache:
name: "Save CCache cache"
key: velox-ccache-{{ arch }}-{{ checksum "merge-base" }}
key: velox-ccache-{{ arch }}-{{ checksum "merge-base-date" }}
paths:
- .ccache/

Expand All @@ -84,12 +84,12 @@ jobs:
steps:
- checkout
- run:
name: "Calculate merge-base for CCache"
command: git merge-base origin/main HEAD > merge-base
name: "Calculate merge-base date for CCache"
command: git show -s --format=%cd --date="format:%Y%m%d" $(git merge-base origin/main HEAD) | tee merge-base-date
- restore_cache:
name: "Restore CCache cache"
keys:
- velox-ccache-{{ arch }}-{{ checksum "merge-base" }}
- velox-ccache-{{ arch }}-{{ checksum "merge-base-date" }}
- run:
name: Build
command: |
Expand All @@ -102,16 +102,16 @@ jobs:
no_output_timeout: 1h
- store_artifacts:
path: '_build/debug/.ninja_log'
- save_cache:
name: "Save CCache cache"
key: velox-ccache-{{ arch }}-{{ checksum "merge-base-date" }}
paths:
- .ccache/
- run:
name: Run Unit Tests
command: |
make unittest NUM_THREADS=8
no_output_timeout: 1h
- save_cache:
name: "Save CCache cache"
key: velox-ccache-{{ arch }}-{{ checksum "merge-base" }}
paths:
- .ccache/

format-check:
executor: check
Expand Down

0 comments on commit d1cedd9

Please sign in to comment.