Browse Source

ci: fix LTS patch level build date calculation

Add --config=stamp flag to kernel build bazel commands
Remove disabled if: false condition from apply-kernel-branding action
Comment out unused Bazel cache eviction loop
trae 3 months ago
parent
commit
103f4f7877

+ 0 - 1
.github/actions/apply-kernel-branding/action.yml

@@ -22,7 +22,6 @@ runs:
   steps:
     - name: Apply Kernel Name Branding
       shell: bash
-      if: false
       working-directory: ${{ github.workspace }}/kernel/common
       run: |
         CONFIG_FRAGMENT="${{ github.workspace }}/wild_gki.fragment"

+ 9 - 7
.github/actions/build-kernel/action.yml

@@ -79,6 +79,7 @@ runs:
         if [[ ${{ inputs.version }} == "android16-6.12" ]]; then
           tools/bazel run \
               --config=fast \
+              --config=stamp \
               --lto=default \
               --defconfig_fragment=//common:arch/arm64/configs/wild_gki.fragment \
               --disk_cache=/home/runner/.cache/bazel \
@@ -87,21 +88,22 @@ runs:
           else
             tools/bazel run \
               --config=fast \
+              --config=stamp \
               --lto=default \
               --defconfig_fragment=//common:arch/arm64/configs/wild_gki.fragment \
               --disk_cache=/home/runner/.cache/bazel \
               //common:kernel_aarch64_dist \
               -- --dist_dir=/home/runner/out
           fi
-        CACHE=/home/runner/.cache/bazel
-        MAX_BYTES=$((12*1024*1024*1024))
+        #CACHE=/home/runner/.cache/bazel
+        #MAX_BYTES=$((12*1024*1024*1024))
 
         tools/bazel shutdown || true
-        while [ "$(du -sb "$CACHE" | cut -f1 || echo 0)" -gt "$MAX_BYTES" ]; do
-          OLDEST=$(find "$CACHE" -type f -printf '%T@ %p\n' | sort -n | head -n1 | cut -d' ' -f2-)
-          [ -z "$OLDEST" ] && break
-          rm -f "$OLDEST"
-        done
+        #while [ "$(du -sb "$CACHE" | cut -f1 || echo 0)" -gt "$MAX_BYTES" ]; do
+        #  OLDEST=$(find "$CACHE" -type f -printf '%T@ %p\n' | sort -n | head -n1 | cut -d' ' -f2-)
+        #  [ -z "$OLDEST" ] && break
+        #  rm -f "$OLDEST"
+        #done
       fi
 
       echo "Contents of /home/runner/out"

+ 11 - 1
.github/workflows/build.yml

@@ -86,7 +86,17 @@ jobs:
         set -x
         # Hardcode the build timestamp to the 5th day of the patch level
         # at 04:20 UTC, using the existing timestamp formats expected by the build.
-        FIXED_BUILD_DATE="${{ inputs.os_patch_level }}-05 04:20:00 UTC"
+        OS_PATCH_LEVEL_INPUT="${{ inputs.os_patch_level }}"
+        if [[ "$OS_PATCH_LEVEL_INPUT" == lts* ]]; then
+          if [[ "$OS_PATCH_LEVEL_INPUT" =~ ^lts-([0-9]{2})$ ]]; then
+            OS_PATCH_LEVEL_YM="$(date -u +%Y)-${BASH_REMATCH[1]}"
+          else
+            OS_PATCH_LEVEL_YM="$(date -u +%Y-%m)"
+          fi
+        else
+          OS_PATCH_LEVEL_YM="$OS_PATCH_LEVEL_INPUT"
+        fi
+        FIXED_BUILD_DATE="${OS_PATCH_LEVEL_YM}-05 04:20:00 UTC"
         SOURCE_DATE_EPOCH=$(date -u -d "$FIXED_BUILD_DATE" +%s)
         echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" >> $GITHUB_ENV
         KBUILD_TS=$(date -u -d @${SOURCE_DATE_EPOCH} '+%a %b %d %H:%M:%S UTC %Y')