-
Notifications
You must be signed in to change notification settings - Fork 3.1k
142 lines (123 loc) · 4.2 KB
/
cleanup_caches.yml
File metadata and controls
142 lines (123 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Cleanup caches
on:
workflow_dispatch:
schedule:
# at 00:00 on the 1st day of every month
- cron: '0 0 1 * *'
permissions: read-all
jobs:
Cleanup_PIP:
name: Cleanup PIP cache
runs-on: aks-linux-medium
if: ${{ github.repository_owner == 'openvinotoolkit' }}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:24.04
volumes:
- /mount:/mount
env:
PIP_CACHE_PATH: /mount/caches/pip
steps:
- name: Pre-Collecting Cache Info
run: |
echo "Cache info: "
du -h -d2 ${PIP_CACHE_PATH}
- name: Cleanup cache
run: |
echo "Delete cache files if they have not been used in over 30 days"
[ ! -z "${PIP_CACHE_PATH}" ] && find ${PIP_CACHE_PATH} ! -type d -atime +30 -delete
- name: Post-Collecting Cache Info
run: |
echo "Cache info: "
du -h -d2 ${PIP_CACHE_PATH}
Cleanup_HF_Cache_Linux:
name: Cleanup HuggingFace cache
runs-on: aks-linux-medium
if: ${{ github.repository_owner == 'openvinotoolkit' }}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:24.04
volumes:
- /mount:/mount
env:
HF_CACHE_PATH: /mount/caches/huggingface
steps:
steps:
- name: Pre-Collecting Cache Info
run: |
echo "Cache info: "
du -h -d2 ${HF_CACHE_PATH}
- name: Cleanup cache
run: |
echo "Delete cache files if they have not been used in over 30 days"
[ ! -z "${HF_CACHE_PATH}" ] && find ${HF_CACHE_PATH} ! -type d -atime +30 -delete
- name: Post-Collecting Cache Info
run: |
echo "Cache info: "
du -h -d2 ${HF_CACHE_PATH}
Cleanup_HF_Cache_Windows:
name: Cleanup Windows HuggingFace cache
if: ${{ github.repository_owner == 'openvinotoolkit' }}
runs-on: 'aks-win-4-cores-8gb-test'
defaults:
run:
shell: pwsh
env:
HF_CACHE_PATH: "C:\\mount\\caches\\huggingface"
steps:
- name: Pre-Collecting Cache Info
run: |
Write-Host "Cache info: "
"{0:N2}" -f ((Get-ChildItem -path "$env:HF_CACHE_PATH" -recurse | Measure-Object -property length -sum ).sum /1MB) + " MB"
- name: Cleanup cache
run: |
Write-Host "Delete cache files if they have not been used in over 30 days"
$cutoff = (Get-Date).AddDays(-30)
Get-ChildItem -Path "$env:HF_CACHE_PATH" -Recurse -File -ErrorAction SilentlyContinue |
Where-Object { $_.LastAccessTime -lt $cutoff } |
Remove-Item -Force -ErrorAction SilentlyContinue
- name: Post-Collecting Cache Info
run: |
Write-Host "Cache info: "
"{0:N2}" -f ((Get-ChildItem -path "$env:HF_CACHE_PATH" -recurse | Measure-Object -property length -sum ).sum /1MB) + " MB"
Cleanup_ccache_lin:
name: Cleanup Linux ccache
runs-on: aks-linux-medium
if: ${{ github.repository_owner == 'openvinotoolkit' }}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:24.04
volumes:
- /mount:/mount
env:
CCACHE_PATH: /mount/caches/ccache
steps:
- name: Checkout cache action
uses: ababushk/checkout@dd591a6a2ac25618db4eda86e7e0d938f88cf01b # cherry_pick_retries
timeout-minutes: 15
with:
sparse-checkout: .github/actions/cache
- name: Cleanup ccache
uses: ./.github/actions/cache/cleanup
with:
cache-size: 300
max-cache-size: 750
cache-path: ${{ env.CCACHE_PATH }}
recursive: true
key: '.'
Cleanup_ccache_win:
name: Cleanup Windows ccache
runs-on: 'aks-win-4-cores-8gb-test'
env:
CCACHE_PATH: C:\\mount\\caches\\ccache
steps:
- name: Checkout cache action
uses: ababushk/checkout@dd591a6a2ac25618db4eda86e7e0d938f88cf01b # cherry_pick_retries
timeout-minutes: 15
with:
sparse-checkout: .github/actions/cache
- name: Cleanup ccache
uses: ./.github/actions/cache/cleanup
with:
cache-size: 300
max-cache-size: 750
cache-path: C:\\mount\\caches\\ccache
recursive: true
key: '.'