Przeglądaj źródła

Merge pull request #3120 from Alexander-Wilms/pr-specific-ccache

Improve ccache hit rate for PRs
Ivan Savenko 2 lat temu
rodzic
commit
6a77191693
1 zmienionych plików z 23 dodań i 5 usunięć
  1. 23 5
      .github/workflows/github.yml

+ 23 - 5
.github/workflows/github.yml

@@ -166,18 +166,36 @@ jobs:
       env:
         VCMI_BUILD_PLATFORM: x64
 
-    - name: ccache
+    # ensure the ccache for each PR is separate so they don't interfere with each other
+    # fall back to ccache of the vcmi/vcmi repo if no PR-specific ccache is found
+    - name: Ccache for PRs
       uses: hendrikmuhs/[email protected]
+      if: ${{ github.event.number != '' }}
       with:
-          key: ${{ matrix.preset }}
-          # actual cache takes up less space, at most ~1 GB
-          max-size: "5G"
-          verbose: 2
+        key: ${{ matrix.preset }}-PR-${{ github.event.number }}
+        restore-keys: |
+          ${{ matrix.preset }}-PR-${{ github.event.number }}
+          ${{ matrix.preset }}-no-PR
+        # actual cache takes up less space, at most ~1 GB
+        max-size: "5G"
+        verbose: 2
+
+    - name: Ccache for everything but PRs
+      uses: hendrikmuhs/[email protected]
+      if: ${{ github.event.number == '' }}
+      with:
+        key: ${{ matrix.preset }}-no-PR
+        restore-keys: |
+          ${{ matrix.preset }}-no-PR
+        # actual cache takes up less space, at most ~1 GB
+        max-size: "5G"
+        verbose: 2
 
     - uses: actions/setup-python@v4
       if: "${{ matrix.conan_profile != '' }}"
       with:
         python-version: '3.10'
+
     - name: Conan setup
       if: "${{ matrix.conan_profile != '' }}"
       run: |