Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #809 from ppalaga/master
Browse files Browse the repository at this point in the history
Clean the directories cached by Travis once their size exceeds the space left on
  • Loading branch information
jpkrohling committed Jan 27, 2016
2 parents e7ff5dd + 8e49428 commit 2771d80
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ addons:
packages:
- g++-4.8
before_cache:
# keep the cached local repo small by removing files older than 10 days
- find $HOME/.m2/repository -type d -ctime +10 -exec rm -rf {} \;
- df -h
- du -sh $HOME/.m2/repository
# Clean the cached directories once their size exceeds the space left on the partition.
# This is important because Travis zips the chached directories to a temporary file on the same partition.
- availBytes=$(df -P . | tail -1 | awk '{print $4}')
- cachedBytes=$(du -cs "$HOME/.m2/repository" | tail -1 | awk '{print $1}')
- if [ "${cachedBytes}" -gt "${availBytes}" ] ; then
echo "Cleaning the cached dirs (${cachedBytes} Bytes) because their size exceeds the free space (${availBytes} Bytes) left on the current partition"
rm -Rf "$HOME/.m2"
fi
after_success:
- PROJECT_VERSION=`mvn --batch-mode org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['`
- if [[ "${PROJECT_VERSION}" =~ .*SNAPSHOT ]] && [[ "${TRAVIS_BRANCH}" = "master" ]] && [[ "${TRAVIS_PULL_REQUEST}" = "false" ]];
Expand Down

0 comments on commit 2771d80

Please sign in to comment.