Skip to content

Commit

Permalink
expire rust caches both incrementally and fully once a month
Browse files Browse the repository at this point in the history
  • Loading branch information
graydon committed Jun 27, 2024
1 parent ebc830b commit 406eb09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ jobs:
- name: install rustup components
if: steps.cache.outputs.cache-hit != 'true'
run: rustup component add rustfmt
- name: install cargo-cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install --locked cargo-cache --version 0.8.3
- name: install cargo-sweep
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install --locked cargo-sweep --version 0.7.0
- name: install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt-get -y install postgresql git build-essential pkg-config autoconf automake libtool bison flex libpq-dev parallel libunwind-dev sed perl
Expand Down
9 changes: 6 additions & 3 deletions ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ export CCACHE_COMPRESSLEVEL=9
export CCACHE_MAXSIZE=500M
export CCACHE_CPP2=true

# purge cache if it's too old
# periodically check to see if caches are old and purge them if so
if [ -d "$CCACHE_DIR" ] ; then
if [ -n "$(find $CCACHE_DIR -mtime +$CACHE_MAX_DAYS -print -quit)" ] ; then
echo Purging old cache $CCACHE_DIR
rm -rf $CCACHE_DIR
echo Purging old cache dirs $CCACHE_DIR $HOME/.cargo ./target
rm -rf $CCACHE_DIR $HOME/.cargo ./target
fi
fi

Expand Down Expand Up @@ -163,6 +163,9 @@ date
time make -j$(($NPROCS + 1))

ccache -s
### incrementally purge old content from cargo source cache and target directory
cargo cache trim --limit 100M
cargo sweep --maxsize 500MB

if [ $WITH_TESTS -eq 0 ] ; then
echo "Build done, skipping tests"
Expand Down

0 comments on commit 406eb09

Please sign in to comment.