daml/ci/clean-up.yml
Gary Verhaegen e40aad897f
move to subdir 3.0 (#18520)
* move most files

* update CI configuration
2024-03-22 02:27:46 +01:00

61 lines
1.4 KiB
YAML

# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
steps:
- bash: |
set -euo pipefail
if [ -d sdk ]; then
cd sdk
fi
eval "$(dev-env/bin/dade-assist)"
exec 1> >(while IFS= read -r line; do echo "$(date -uIs) [out]: $line"; done)
exec 2> >(while IFS= read -r line; do echo "$(date -uIs) [err]: $line"; done >&2)
## START temp debug
UNAME=$(uname)
case "$UNAME" in
Darwin)
MPS="/var/tmp/_bazel_vsts /Users/vsts/.bazel-cache"
CMD="hdiutil info"
;;
Linux)
MPS="/home/vsts/.cache/bazel /home/vsts/.bazel-cache"
CMD="mount"
;;
*)
echo "Unexpected uname: $UNAME"
MPS=
;;
esac
for path in $MPS; do
if ! ($CMD | grep -F "$path"); then
echo "$path is not a mount point, forcing cache reset"
$HOME/reset_caches.sh
echo "Done."
fi
done
## END temp debug
df -h .
if [ $(df -m . | sed 1d | awk '{print $4}') -lt 80000 ]; then
echo "Disk full, cleaning up..."
$HOME/reset_caches.sh
echo "Done."
df -h .
fi
## More temp debugging
for path in $MPS; do
if ! ($CMD | grep -F "$path"); then
echo "$path is not a mount point, forcing cache reset"
$HOME/reset_caches.sh
echo "Done."
fi
done
## End more debugging
displayName: clean-up disk cache