daml/ci/clean-up.yml
Gary Verhaegen 45c4ba2230
macos cache cleaning (#9245)
This is adapting the same approach as #9137 to the macOS machines. The
setup is very similar, except macOS apparently doesn't require any kind
of `sudo` access in the process.

The main reason for the change here is that while `~/.bazel-cache` is
reasonably fast to clean, cleaning just that has finally caught up to us
with a recent cleanup step that proudly claimed:

```
before: 638Mi free
after: 1.2Gi free
```

So we do need to start cleaning the other one after all.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-30 02:46:05 +02:00

25 lines
885 B
YAML

# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
steps:
- bash: |
set -euo pipefail
eval "$(dev-env/bin/dade-assist)"
exec 1> >(while IFS= read -r line; do echo "$(date -Is) [out]: $line"; done)
exec 2> >(while IFS= read -r line; do echo "$(date -Is) [err]: $line"; done >&2)
# Location of the disk cache for CI servers set in their init files:
# infra/macos/2-common-box/init.sh:echo "build:darwin --disk_cache=~/.bazel-cache" > ~/.bazelrc
# infra/vsts_agent_linux_startup.sh:echo "build:linux --disk_cache=~/.bazel-cache" > ~/.bazelrc
df -h .
if [ $(df -m . | sed 1d | awk '{print $4}') -lt 50000 ]; then
echo "Disk full, cleaning up..."
$HOME/reset_caches.sh
echo "Done."
df -h .
fi
displayName: clean-up disk cache