Browse Source

Enable bazel cache setup and adjust ccache conditions

jimsterino98 4 months ago
parent
commit
36e75826e9
1 changed files with 25 additions and 25 deletions
  1. 25 25
      .github/workflows/build.yml

+ 25 - 25
.github/workflows/build.yml

@@ -85,29 +85,29 @@ jobs:
         with:
          branch: ${{ inputs.branch }}
 
-#      - name: set up bazel cache dir
-#        if: inputs.build_type == 'Bazel' && inputs.cache == 'true'
-#        run: |
-#          BCACHE_DIR="${{ github.workspace }}/.cache/bazel-disk-kernel"
-#          mkdir -p "$BCACHE_DIR"
-#          echo "BCACHE_DIR=$BCACHE_DIR" >> $GITHUB_ENV
-
-#      - name: set up bazel cache
-#        if: inputs.build_type == 'Bazel' && inputs.cache == 'true'
-#        uses: actions/cache@v4
-#        with:
-#         path: ${{ env.BCACHE_DIR }}
-#         key: bcache-${{ runner.os }}-${{ inputs.build_type }}-${{ env.BASE_BRANCH }}
-#         restore-keys: |
-#            bcache-${{ runner.os }}-${{ inputs.build_type }}-${{ env.BASE_BRANCH }}
-#            bcache-${{ runner.os }}-${{ inputs.build_type }}-
+      - name: set up bazel cache dir
+        if: inputs.build_type == 'Bazel' && inputs.cache == 'true'
+        run: |
+          BCACHE_DIR="${{ github.workspace }}/.cache/bazel-disk-kernel"
+          mkdir -p "$BCACHE_DIR"
+          echo "BCACHE_DIR=$BCACHE_DIR" >> $GITHUB_ENV
+
+      - name: set up bazel cache
+        if: inputs.build_type == 'Bazel' && inputs.cache == 'true'
+        uses: actions/cache@v4
+        with:
+         path: ${{ env.BCACHE_DIR }}
+         key: bcache-${{ runner.os }}-${{ inputs.build_type }}-${{ env.BASE_BRANCH }}
+         restore-keys: |
+            bcache-${{ runner.os }}-${{ inputs.build_type }}-${{ env.BASE_BRANCH }}
+            bcache-${{ runner.os }}-${{ inputs.build_type }}-
 
       - name: Install ccache
-        if: inputs.cache == 'true'
+        if: inputs.cache == 'true' && inputs.build_type == 'make'
         run: sudo apt-get update && sudo apt-get install -y ccache
         
       - name: Export ccache + determinism
-        if: inputs.cache == 'true'
+        if: inputs.cache == 'true' && inputs.build_type == 'make'
         run: |
           CACHE_DIR="${{ github.workspace }}/.ccache"
           mkdir -p "$CACHE_DIR"
@@ -136,17 +136,17 @@ jobs:
           done
 
       - name: restore ccache
-        if: inputs.cache == 'true'
+        if: inputs.cache == 'true' && inputs.build_type == 'make'
         uses: actions/cache@v4
         with:
           path: ${{ env.CCACHE_DIR }}
-          key: ccache-${{ runner.os }}-${{ env.BASE_BRANCH }}
+          key: ccache-${{ runner.os }}-${{ inputs.build_type }}-${{ env.BASE_BRANCH }}
           restore-keys: |
-            ccache-${{ runner.os }}-${{ env.BASE_BRANCH }}
-            ccache-${{ runner.os }}-
+            ccache-${{ runner.os }}-${{ inputs.build_type }}-${{ env.BASE_BRANCH }}
+            ccache-${{ runner.os }}-${{ inputs.build_type }}-
             
       - name: Ensure ccache is used
-        if: inputs.cache == 'true'
+        if: inputs.cache == 'true' && inputs.build_type == 'make'
         run: |
           echo "/usr/lib/ccache" >> $GITHUB_PATH
           echo "CC='ccache clang'" >> $GITHUB_ENV
@@ -266,12 +266,12 @@ jobs:
          android_version: ${{ inputs.android_version }}
          kernel_version: ${{ inputs.kernel_version }}
 
-      - name: ensure ccache is used on bazel
+      - name: ensure bazel cache is set to be used
         if: inputs.build_type == 'Bazel' && inputs.cache == 'true'
         uses: ./.github/actions/use-bazcache
 
       - name: change variables to ccache
-        if: inputs.cache == 'true'
+        if: inputs.cache == 'true' && inputs.build_type == 'make'
         uses: ./.github/actions/use-ccache
 
       - name: Build