Browse Source

feat(action): enhance build process with variant input for flexible kernel builds; add NET feature option

Co-authored-by: Copilot <copilot@github.com>
TheWildJames 4 months ago
parent
commit
f5b805344e
3 changed files with 49 additions and 10 deletions
  1. 13 6
      .github/workflows/build.yml
  2. 21 3
      .github/workflows/main.yml
  3. 15 1
      .github/workflows/prepare.yml

+ 13 - 6
.github/workflows/build.yml

@@ -34,7 +34,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        variant: ['Normal', 'Bypass', 'Wild']
+        variant: ["${{ inputs.variant }}"]
     runs-on: ubuntu-latest
     timeout-minutes: 60
 
@@ -100,13 +100,13 @@ jobs:
         os_patch_level: ${{ steps.parse.outputs.os_patch_level }}
 
     - name: Setup KernelSU-Next
-      if: contains(inputs.feature_set, 'KSUN')
+      if: contains(inputs.feature_set, 'KSUN') || inputs.feature_set == 'All'
       uses: ./.github/actions/kernelsu
       with:
         ksu_commit: ${{ inputs.ksu_commit }}
 
-    - name: Setup SUSFS
-      if: contains(inputs.feature_set, 'SUSFS')
+    - name: Feature: KSUN+SUSFS
+      if: contains(inputs.feature_set, 'SUSFS') || inputs.feature_set == 'All'
       uses: ./.github/actions/susfs
       with:
         android_version: ${{ steps.parse.outputs.android_version }}
@@ -115,10 +115,17 @@ jobs:
         sublevel: ${{ steps.extract.outputs.sublevel }}
         susfs_commit: ${{ inputs.susfs_commit }}
 
-    - name: Setup Baseband Guard
-      if: contains(inputs.feature_set, 'BBG')
+    - name: Baseband Guard
+      if: contains(inputs.feature_set, 'BBG') || inputs.feature_set == 'All'
       uses: ./.github/actions/bbg
 
+    - name: Setup Networking
+      if: contains(inputs.feature_set, 'NET') || inputs.feature_set == 'All'
+      uses: ./.github/actions/networking
+      with:
+        kernel_version: ${{ steps.parse.outputs.kernel_version }}
+        android_version: ${{ steps.parse.outputs.android_version }}
+
     - name: Apply Module Check Bypass
       if: ${{ matrix.variant == 'Bypass' }}
       uses: ./.github/actions/module-check-bypass

+ 21 - 3
.github/workflows/main.yml

@@ -29,17 +29,28 @@ on:
         description: "Feature Set"
         type: choice
         options:
-          - KSUN+SUSFS+BBG
+          - KSUN+SUSFS+BBG+NET
+          - KSUN+SUSFS
           - KSUN+BBG
-          - KSUN
+          - KSUN+NET
           - BBG
           - None
-        default: KSUN+SUSFS+BBG
+          - All
+        default: All
       ksu_commit:
         description: "KSU Commit (optional)"
         type: string
         default: ""
         required: false
+      variant:
+        description: "Build Variant (All, Normal, Bypass, Wild)"
+        type: choice
+        options:
+          - All
+          - Normal
+          - Bypass
+          - Wild
+        default: Normal
 
 jobs:
   fetch-commits:
@@ -69,6 +80,7 @@ jobs:
       patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
       susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
       feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
+        variant: ${{ inputs.variant || 'Normal' }}
     secrets: inherit
 
   build-a13-5-10:
@@ -82,6 +94,7 @@ jobs:
       patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
       susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
       feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
+        variant: ${{ inputs.variant || 'Normal' }}
     secrets: inherit
 
   build-a13-5-15:
@@ -95,6 +108,7 @@ jobs:
       patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
       susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
       feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
+        variant: ${{ inputs.variant || 'Normal' }}
     secrets: inherit
 
   build-a14-5-15:
@@ -108,6 +122,7 @@ jobs:
       patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
       susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
       feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
+        variant: ${{ inputs.variant || 'Normal' }}
     secrets: inherit
 
   build-a14-6-1:
@@ -121,6 +136,7 @@ jobs:
       patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
       susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
       feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
+        variant: ${{ inputs.variant || 'Normal' }}
     secrets: inherit
 
   build-a15-6-6:
@@ -134,6 +150,7 @@ jobs:
       patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
       susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
       feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
+        variant: ${{ inputs.variant || 'Normal' }}
     secrets: inherit
 
   build-a16-6-12:
@@ -147,6 +164,7 @@ jobs:
       patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
       susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
       feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
+        variant: ${{ inputs.variant || 'Normal' }}
     secrets: inherit
 
   rej:

+ 15 - 1
.github/workflows/prepare.yml

@@ -27,6 +27,10 @@ on:
         description: "Feature Set"
         required: false
         type: string
+      variant:
+        description: "Build Variant (ALL, Normal, Bypass, Wild)"
+        required: false
+        type: string
 
 jobs:
   generate-matrix:
@@ -59,7 +63,17 @@ jobs:
           fi
           
           echo "Matrix content: $MATRIX_JSON"
-          echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
+
+            # Filter the matrix by variant input if not ALL
+            if [ "${{ inputs.variant }}" != "" ] && [ "${{ inputs.variant }}" != "ALL" ]; then
+              if command -v jq &> /dev/null; then
+                MATRIX_JSON=$(echo "$MATRIX_JSON" | jq -c --arg v "${{ inputs.variant }}" '[.[] | select(.variant == $v)]')
+              else
+                echo "Warning: jq not found, cannot filter variants."
+              fi
+            fi
+            echo "Matrix content: $MATRIX_JSON"
+            echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
 
   build:
     needs: generate-matrix