diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index ec00295afd57eada3553610487c86c0083e447c9..d2de40b8fb6385c94d1f2ce33b7fea91ba9d7280 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -65,16 +65,15 @@ jobs:
           pip --version
 
       - uses: actions/checkout@v2
-        with:
-          fetch-depth: 1
 
       - name: Cache Yarn packages
+        id: yarn_cache_packages
         uses: actions/cache@v1
         with:
           path: ${{ steps.init.outputs.yarn_cache }}
-          key: ${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}
+          key: v1-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}
           restore-keys: |
-            ${{ runner.os }}-yarn_cache-
+            v1-${{ runner.os }}-yarn_cache-
 
       - name: Cache node_modules
         uses: actions/cache@v1
@@ -85,6 +84,7 @@ jobs:
             ${{ runner.os }}-${{ matrix.node-version }}-yarn-
 
       - name: Cache pip packages
+        id: pip_cache_packages
         uses: actions/cache@v1
         with:
           path: ${{ steps.init.outputs.pip_cache }}
@@ -92,6 +92,15 @@ jobs:
           restore-keys: |
             ${{ runner.os }}-${{ matrix.python-version }}-pip-
 
+      # Clear caches on cache miss, otherwise they will grow indefinitely
+      - name: Clear yarn cache
+        if: steps.yarn_cache_packages.outputs.cache-hit != 'true'
+        run: yarn cache clean
+
+      - name: Clear pip cache
+        if: steps.pip_cache_packages.outputs.cache-hit != 'true'
+        run: rm -rf ${{ steps.init.outputs.pip_cache }}
+
       - name: Installing dependencies
         shell: bash
         run: |