]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
ci: Free up disk space asynchronously
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 13 Mar 2024 22:10:51 +0000 (23:10 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 13 Mar 2024 22:46:55 +0000 (23:46 +0100)
Free-ing up disk space can take up to 8 minutes so let's make sure
we do it asynchronously since we don't need the free space immediately.

.github/workflows/ci.yml

index f688d445bf2b91cc3525015b62f0531a45facfba..a929cf1ab509411147fc0fcb0d35fdeece613eff 100644 (file)
@@ -125,10 +125,14 @@ jobs:
     - uses: actions/checkout@v3
     - uses: ./
 
+    # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
+    # immediately, we remove the files in the background. However, we first move them to a different location so that
+    # nothing tries to use anything in these directories anymore while we're busy deleting them.
     - name: Free disk space
       run: |
-        sudo rm -rf /usr/local
-        sudo rm -rf /opt/hostedtoolcache
+        sudo mv /usr/local /usr/local.trash
+        sudo mv /opt/hostedtoolcache /opt/hostedtoolcache.trash
+        sudo systemd-run rm -rf /usr/local.trash /opt/hostedtoolcache.trash
 
     - name: Install
       run: |