4747 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4848 with :
4949 persist-credentials : false
50+ - name : Make space for cache + models
51+ # Ubuntu runner have less space free which is problematic since the model
52+ # cache + dependencies fill up the disk, leaving no space for execution.
53+ # So we remove some of the stuff we don't need (Java, .NET, etc.)
54+ #
55+ # Idea: https://dev.to/mathio/squeezing-disk-space-from-github-actions-runners-an-engineers-guide-3pjg
56+ if : matrix.os != 'windows-latest'
57+ run : |
58+ df -h
59+
60+ # Remove Java (JDKs)
61+ sudo rm -rf /usr/lib/jvm
62+
63+ # Remove .NET SDKs
64+ sudo rm -rf /usr/share/dotnet
65+
66+ # Remove Swift toolchain
67+ sudo rm -rf /usr/share/swift
68+
69+ # Remove Haskell (GHC)
70+ sudo rm -rf /usr/local/.ghcup
71+
72+ # Remove Julia
73+ sudo rm -rf /usr/local/julia*
74+
75+ # Remove Android SDKs
76+ sudo rm -rf /usr/local/lib/android
77+
78+ # Remove Chromium (optional if not using for browser tests)
79+ sudo rm -rf /usr/local/share/chromium
80+
81+ # Remove Microsoft/Edge and Google Chrome builds
82+ sudo rm -rf /opt/microsoft /opt/google
83+
84+ # Remove Azure CLI
85+ sudo rm -rf /opt/az
86+
87+ # Remove PowerShell
88+ sudo rm -rf /usr/local/share/powershell
89+
90+ # Remove CodeQL and other toolcaches
91+ sudo rm -rf /opt/hostedtoolcache
92+
93+ df -h
5094 - name : Model cache
5195 uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
5296 with :
59103 key : model-cache-${{ github.run_id }}
60104 restore-keys : model-cache-
61105 enableCrossOsArchive : true
106+
62107 - name : Dump cache content
63108 # TODO: remove this step after 2025-02-15
64109 if : matrix.os != 'windows-latest'
@@ -83,8 +128,13 @@ jobs:
83128 env :
84129 HF_TOKEN : ${{ secrets.HF_TOKEN }}
85130 TRANSFORMERS_IS_CI : 1
131+ CI : 1
86132 run : |
87133 make test
134+ # clean up all pytest temporary directories that are kept due to retention since space
135+ # is a scarce resource on the runners and tasks like model cache creation (further below)
136+ # fail if there's not enough space available.
137+ (rm -r "/tmp/pytest-of-$(id -u -n)" || true)
88138 - name : Dump cache content and diff
89139 # This is just debug info so that we can monitor if the model cache diverges substantially
90140 # over time and what the diverging model is.
0 commit comments