Browse Source

ci: add use_make input and build options to workflows

Add use_make boolean input to all kernel build workflows to allow switching between make and bazel builds
Update main workflow to conditionally run release job based on release_type input
Modify build workflow to handle both make and bazel build paths
TheWildJames 1 year ago
parent
commit
fd5c6d1152

+ 54 - 5
.github/workflows/build.yml

@@ -21,6 +21,11 @@ on:
       revision:
         required: false
         type: string
+      use_make:
+        description: 'Build with MAKE?'
+        required: true
+        type: boolean
+        default: true
 
 jobs:
   build-gki:
@@ -49,8 +54,6 @@ jobs:
           # Set CONFIG as an environment variable for future steps
           echo "CONFIG=$CONFIG" >> $GITHUB_ENV
 
-
-
       - name: Setup Build Environment
         run: |
           sudo apt update && sudo apt install -y libelf-dev libssl-dev build-essential
@@ -314,14 +317,15 @@ jobs:
           echo "CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=n" >> "$defconfig"
           
           # Remove check_defconfig
-          #sed -i 's/check_defconfig//' ./common/build.config.gki
+          sed -i 's/check_defconfig//' ./common/build.config.gki
 
       - name: Change Kernel Name
         run: |
           cd "$CONFIG"
           
           perl -pi -e 's/-dirty//' ./common/scripts/setlocalversion
-          
+          perl -pi -e 's/-maybe-dirty//g' ./build/kernel/kleaf/impl/stamp.bzl
+
           #Set Kernel Timestamp
           perl -pi -e 's{UTS_VERSION="\$\(echo \$UTS_VERSION \$CONFIG_FLAGS \$TIMESTAMP \| cut -b -\$UTS_LEN\)"}{UTS_VERSION="#1 SMP PREEMPT Sun Apr 20 04:20:00 UTC 2025"}' ./common/scripts/mkcompile_h
           
@@ -337,9 +341,51 @@ jobs:
               
           #Remove Abi Exports and Error
           rm -rf ./common/android/abi_gki_protected_exports_*
-          #perl -pi -e 's/^\s*"protected_exports_list"\s*:\s*"android\/abi_gki_protected_exports_aarch64",\s*$//;' ./common/BUILD.bazel
+          perl -pi -e 's/^\s*"protected_exports_list"\s*:\s*"android\/abi_gki_protected_exports_aarch64",\s*$//;' ./common/BUILD.bazel
+
+      - name: Build
+        if: ${{ inputs.use_make == false }}
+        run : |
+          set -e
+          set -x
+          cd "$CONFIG"
+          echo "Building the kernel..."
+          if [ -f "build/build.sh" ]; then
+            LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh CC="/usr/bin/ccache clang" || exit 1
+          else
+            tools/bazel build --disk_cache=/home/runner/.cache/bazel --config=fast --lto=thin //common:kernel_aarch64_dist || exit 1
+          fi
+
+      - name: Create Bootimgs Folder and Copy Images for Android 12/13
+        if: (${{ inputs.android_version == 'android12' || inputs.android_version == 'android13' }}) && ${{ inputs.use_make == false }}
+        run: |
+          mkdir bootimgs
+
+          echo "Creating bootimgs folder and copying images..."
+          cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./bootimgs
+          cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./bootimgs
+          cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./
+          cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./
+
+          # Create gzip of the Image file
+          gzip -n -k -f -9 ./Image > ./Image.gz
+
+      - name: Create Bootimgs Folder and Copy Images for Android 14/15
+        if: (${{ inputs.android_version == 'android14' || inputs.android_version == 'android15' }}) && ${{ inputs.use_make == false }}
+        run: |
+          mkdir bootimgs
+
+          echo "Creating bootimgs folder and copying images..."
+          cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./bootimgs
+          cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./bootimgs
+          cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./
+          cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./
+
+          # Create gzip of the Image file
+          gzip -n -k -f -9 ./Image > ./Image.gz
 
       - name: Detect Clang Version from Configs
+        if: ${{ inputs.use_make == true }}
         run: |
           KERNEL_PATH="$GITHUB_WORKSPACE/$CONFIG"
           DEFCONFIG="$KERNEL_PATH/common/arch/arm64/configs/gki_defconfig"
@@ -380,6 +426,7 @@ jobs:
 
 
       - name: Build Kernel
+        if: ${{ inputs.use_make == true }}
         run: |
           KERNEL_PATH="$GITHUB_WORKSPACE/$CONFIG"
           CLANG_BIN_PATH="${{ env.CLANG_BIN_PATH }}"
@@ -433,6 +480,7 @@ jobs:
           make -j$(nproc --all) O=out $MAKE_ARGS KCFLAGS+="-Wno-error -O2 -flto=thin -fno-stack-protector" || exit 1
 
       - name: Create Kernel ZIP
+        if: ${{ inputs.use_make == true }}
         run: |
           cp $CONFIG/common/out/arch/arm64/boot/Image AnyKernel3/Image
 
@@ -448,6 +496,7 @@ jobs:
           zip -r "../$ZIP_NAME" ./*
 
       - name: Create Bootimgs Folder and Copy Images
+        if: ${{ inputs.use_make == true }}
         run: |
           mkdir bootimgs
 

+ 7 - 0
.github/workflows/kernel-a12-5-10.yml

@@ -6,6 +6,12 @@ permissions:
 
 on:
   workflow_call:
+    inputs:
+      use_make:
+        description: 'Build with MAKE?'
+        required: true
+        type: boolean
+        default: true
 
 jobs:
   build-kernels-a12:
@@ -51,4 +57,5 @@ jobs:
       sub_level: ${{ matrix.sub_level }}
       os_patch_level: ${{ matrix.os_patch_level }}
       revision: ${{ matrix.revision }}
+      use_make: ${{ inputs.use_make }}
 

+ 8 - 1
.github/workflows/kernel-a13-5-10.yml

@@ -6,6 +6,12 @@ permissions:
 
 on:
   workflow_call:
+    inputs:
+      use_make:
+        description: 'Build with MAKE?'
+        required: true
+        type: boolean
+        default: true
 
 jobs:
   build-kernels-a13-5-10:
@@ -43,4 +49,5 @@ jobs:
       android_version: "android13"
       kernel_version: "5.10"
       sub_level: ${{ matrix.sub_level }}
-      os_patch_level: ${{ matrix.os_patch_level }}
+      os_patch_level: ${{ matrix.os_patch_level }}
+      use_make: ${{ inputs.use_make }}

+ 8 - 1
.github/workflows/kernel-a13-5-15.yml

@@ -6,6 +6,12 @@ permissions:
 
 on:
   workflow_call:
+    inputs:
+      use_make:
+        description: 'Build with MAKE?'
+        required: true
+        type: boolean
+        default: true
 
 jobs:
   build-kernels-a13-5-15:
@@ -45,4 +51,5 @@ jobs:
       android_version: "android13"
       kernel_version: "5.15"
       sub_level: ${{ matrix.sub_level }}
-      os_patch_level: ${{ matrix.os_patch_level }}
+      os_patch_level: ${{ matrix.os_patch_level }}
+      use_make: ${{ inputs.use_make }}

+ 8 - 1
.github/workflows/kernel-a14-5-15.yml

@@ -6,6 +6,12 @@ permissions:
 
 on:
   workflow_call:
+    inputs:
+      use_make:
+        description: 'Build with MAKE?'
+        required: true
+        type: boolean
+        default: true
 
 jobs:
   build-kernels-a14-5-15:
@@ -43,4 +49,5 @@ jobs:
       android_version: "android14"
       kernel_version: "5.15"
       sub_level: ${{ matrix.sub_level }}
-      os_patch_level: ${{ matrix.os_patch_level }}
+      os_patch_level: ${{ matrix.os_patch_level }}
+      use_make: ${{ inputs.use_make }}

+ 8 - 1
.github/workflows/kernel-a14-6-1.yml

@@ -6,6 +6,12 @@ permissions:
 
 on:
   workflow_call:
+    inputs:
+      use_make:
+        description: 'Build with MAKE?'
+        required: true
+        type: boolean
+        default: true
 
 jobs:
   build-kernels-a14-6-1:
@@ -61,4 +67,5 @@ jobs:
       android_version: "android14"
       kernel_version: "6.1"
       sub_level: ${{ matrix.sub_level }}
-      os_patch_level: ${{ matrix.os_patch_level }}
+      os_patch_level: ${{ matrix.os_patch_level }}
+      use_make: ${{ inputs.use_make }}

+ 7 - 0
.github/workflows/kernel-a15-6-6.yml

@@ -6,6 +6,12 @@ permissions:
 
 on:
   workflow_call:
+    inputs:
+      use_make:
+        description: 'Build with MAKE?'
+        required: true
+        type: boolean
+        default: true
 
 jobs:
   build-kernels-a15:
@@ -48,3 +54,4 @@ jobs:
       kernel_version: "6.6"
       sub_level: ${{ matrix.sub_level }}
       os_patch_level: ${{ matrix.os_patch_level }}
+      use_make: ${{ inputs.use_make }}

+ 27 - 0
.github/workflows/main.yml

@@ -6,34 +6,61 @@ permissions:
 
 on:
   workflow_dispatch:
+    inputs:
+      use_make:
+        description: 'Build with MAKE?'
+        required: true
+        type: boolean
+        default: true
+      release_type:
+        description: "Choose Release Type"
+        required: true
+        type: choice
+        options:
+          - Actions
+          - Release
+        default: Release
 
 jobs:
   build-a12-5-10:
     uses: ./.github/workflows/kernel-a12-5-10.yml
     secrets: inherit
+    with:
+      use_make: ${{ inputs.use_make }}
 
   build-a13-5-10:
     uses: ./.github/workflows/kernel-a13-5-10.yml
     secrets: inherit
+    with:
+      use_make: ${{ inputs.use_make }}
 
   build-a13-5-15:
     uses: ./.github/workflows/kernel-a13-5-15.yml
     secrets: inherit
+    with:
+      use_make: ${{ inputs.use_make }}
 
   build-a14-5-15:
     uses: ./.github/workflows/kernel-a14-5-15.yml
     secrets: inherit
+    with:
+      use_make: ${{ inputs.use_make }}
 
   build-a14-6-1:
     uses: ./.github/workflows/kernel-a14-6-1.yml
     secrets: inherit
+    with:
+      use_make: ${{ inputs.use_make }}
 
   build-a15-6-6:
     uses: ./.github/workflows/kernel-a15-6-6.yml
     secrets: inherit
+    with:
+      use_make: ${{ inputs.use_make }}
 
   release:
     runs-on: ubuntu-latest
+    if: ${{ inputs.release_type == 'Release' }}
     needs:
       - build-a12-5-10
       - build-a13-5-10