Переглянути джерело

feat(workflows): add support for using latest commits in KernelSU and SUSFS actions

TheWildJames 3 місяців тому
батько
коміт
da4c841f6e

+ 1 - 1
.github/actions/build-kernel/patches/bypass.patch

@@ -30,7 +30,7 @@ index 719de4c..3f71202 100755
 +    : > "$events"
 +    getevent -lc 1 2>&1 > "$raw_events" &
 +    pid=$!
-+    sleep 1
++    sleep 20
 +    kill -0 $pid 2>/dev/null && kill $pid 2>/dev/null
 +    grep VOLUME "$raw_events" | grep " DOWN" > "$events" 2>/dev/null || true
 +

+ 19 - 4
.github/actions/kernelsu/action.yml

@@ -1,5 +1,10 @@
 name: Setup Wild KSU
 description: Download and configure Wild KSU with version tracking
+inputs:
+  use_latest_commits:
+    description: 'Use the latest commit on the branch instead of the pinned commit'
+    required: false
+    default: true
 
 runs:
   using: composite
@@ -10,11 +15,21 @@ runs:
       run: |
         set -euo pipefail
 
-        COMMITS_JSON="${{ github.workspace }}/.github/config/commits.json"
-        KSU_SETUP_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON")
+        KSU_REPO="https://github.com/KernelSU-Next/KernelSU-Next.git"
+        KSU_BRANCH="dev"
+
+        if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
+          echo "Using latest KernelSU-Next from branch: $KSU_BRANCH"
+          curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/dev-susfs/kernel/setup.sh" | bash -s dev-susfs
+        else
+          COMMITS_JSON="${{ github.workspace }}/.github/config/commits.json"
+          KSU_SETUP_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON")
+          echo "Using pinned KernelSU commit: $KSU_SETUP_COMMIT"
+          curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/dev-susfs/kernel/setup.sh" | bash -s dev-susfs
+          git -C KernelSU-Next/kernel fetch --depth=50 origin "$KSU_SETUP_COMMIT"
+          git -C KernelSU-Next/kernel checkout "$KSU_SETUP_COMMIT"
+        fi
 
-        curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/dev/kernel/setup.sh" | bash -s "$KSU_SETUP_COMMIT"
-        
         cd KernelSU-Next/kernel
         
         COMMITS_COUNT=$(/usr/bin/git rev-list --count HEAD)

+ 12 - 5
.github/actions/susfs/action.yml

@@ -1,6 +1,10 @@
 name: Setup SUSFS
 description: Clone and apply SUSFS patches with version-specific fixes
 inputs:
+  use_latest_commits:
+    description: 'Use the latest commit on the branch instead of the pinned commit'
+    required: false
+    default: true
   version:
     description: 'Kernel config version (e.g., android15-6.6)'
     required: true
@@ -27,15 +31,17 @@ runs:
 
         SUSFS_BRANCH="gki-${{ inputs.version }}"
         SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"        
-        COMMITS_JSON="${{ github.workspace }}/.github/config/commits.json"
 
         echo "Preparing SUSFS for branch: $SUSFS_BRANCH"
         echo "Cloning latest from $SUSFS_BRANCH..."
         git clone "$SUSFS_REPO" -b "$SUSFS_BRANCH" susfs4ksu
 
-        SUSFS_COMMIT=$(jq -er --arg key "$SUSFS_BRANCH" '.susfs[$key]' "$COMMITS_JSON")
-        cd ${{ github.workspace }}/susfs4ksu
-        git checkout "$SUSFS_COMMIT"
+        if [ "${{ inputs.use_latest_commits }}" != "true" ]; then
+          COMMITS_JSON="${{ github.workspace }}/.github/config/commits.json"
+          SUSFS_COMMIT=$(jq -er --arg key "$SUSFS_BRANCH" '.susfs[$key]' "$COMMITS_JSON")
+          cd ${{ github.workspace }}/susfs4ksu
+          git checkout "$SUSFS_COMMIT"
+        fi
 
     - name: Enable KernelSU SUSFS Config
       shell: bash
@@ -56,6 +62,7 @@ runs:
         EOF
 
     - name: Apply KSU SUSFS Patches
+      if: false
       shell: bash
       working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
       run: |
@@ -179,7 +186,7 @@ runs:
       shell: bash
       working-directory: ${{ github.workspace }}/kernel/common
       run: |
-        patch -p1 < 50_add_susfs_in_gki-${{ inputs.version }}.patch || true
+        patch -p1 < 50_add_susfs_in_gki-${{ inputs.version }}.patch
 
     - name: Revert Android 12 5.10 Fake Patches
       shell: bash

+ 9 - 2
.github/workflows/build.yml

@@ -30,6 +30,10 @@ on:
       use_repo:
         required: false
         type: boolean
+      use_latest_commits:
+        required: false
+        type: boolean
+        default: true
 
 jobs:
   build-gki:
@@ -129,11 +133,14 @@ jobs:
     - name: Setup KernelSU-Next
       if: contains(inputs.feature_set, 'KSUN') || inputs.feature_set == 'FULL'
       uses: ./.github/actions/kernelsu
+      with:
+        use_latest_commits: ${{ inputs.use_latest_commits }}
 
     - name: SUSFS
       if: contains(inputs.feature_set, 'SUSFS') || inputs.feature_set == 'FULL'
       uses: ./.github/actions/susfs
       with:
+        use_latest_commits: ${{ inputs.use_latest_commits }}
         version: ${{ inputs.version }}
         android_version: ${{ inputs.android_version }}
         kernel_version: ${{ inputs.kernel_version }}
@@ -210,11 +217,11 @@ jobs:
 
     - name: Scan and collect patch rejects
       id: scan
-      if: ${{ always() && inputs.variant == 'Normal' }}
+      if: ${{ always() }}
       uses: ./.github/actions/scan-patch-rejects
         
     - name: Upload Rejects
-      if: ${{ always() && inputs.variant == 'Normal' }}
+      if: ${{ always() }}
       uses: actions/upload-artifact@v7
       with:
         name: ${{ steps.extract.outputs.file_name }}-Rejects

+ 62 - 28
.github/workflows/main.yml

@@ -48,6 +48,10 @@ on:
         description: "Use repo for downloading kernel source"
         type: boolean
         default: true
+      use_latest_commits:
+        description: "Use branch tip for KernelSU and SUSFS instead of pinned commits"
+        type: boolean
+        default: true
       test_release_notes:
         description: "Test release notes only"
         type: boolean
@@ -61,6 +65,7 @@ jobs:
       config_file: .github/config/android12-5.10.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       use_repo: ${{ inputs.use_repo }}
+      use_latest_commits: ${{ inputs.use_latest_commits }}
     secrets: inherit
 
   build-android13-5-10:
@@ -70,6 +75,7 @@ jobs:
       config_file: .github/config/android13-5.10.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       use_repo: ${{ inputs.use_repo }}
+      use_latest_commits: ${{ inputs.use_latest_commits }}
     secrets: inherit
 
   build-android13-5-15:
@@ -79,6 +85,7 @@ jobs:
       config_file: .github/config/android13-5.15.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       use_repo: ${{ inputs.use_repo }}
+      use_latest_commits: ${{ inputs.use_latest_commits }}
     secrets: inherit
 
   build-android14-5-15:
@@ -88,6 +95,7 @@ jobs:
       config_file: .github/config/android14-5.15.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       use_repo: ${{ inputs.use_repo }}
+      use_latest_commits: ${{ inputs.use_latest_commits }}
     secrets: inherit
 
   build-android14-6-1:
@@ -97,6 +105,7 @@ jobs:
       config_file: .github/config/android14-6.1.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       use_repo: ${{ inputs.use_repo }}
+      use_latest_commits: ${{ inputs.use_latest_commits }}
     secrets: inherit
 
   build-android15-6-6:
@@ -106,6 +115,7 @@ jobs:
       config_file: .github/config/android15-6.6.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       use_repo: ${{ inputs.use_repo }}
+      use_latest_commits: ${{ inputs.use_latest_commits }}
     secrets: inherit
 
   build-android16-6-12:
@@ -115,6 +125,7 @@ jobs:
       config_file: .github/config/android16-6.12.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       use_repo: ${{ inputs.use_repo }}
+      use_latest_commits: ${{ inputs.use_latest_commits }}
     secrets: inherit
 
   rej:
@@ -137,7 +148,7 @@ jobs:
       uses: actions/download-artifact@v7
       with:
         path: ./downloaded-artifacts
-        pattern: '*-Normal-Rejects'
+        pattern: '*-Rejects'
         merge-multiple: false
 
     - name: Process Reject Artifacts
@@ -168,18 +179,28 @@ jobs:
         done
         
         # Zip and upload if we found anything
-        if [ "$(ls -A aio-rejects)" ]; then
+          KSUN_BRANCH="dev"
             # Create a single zip of all rejects
-            cd aio-rejects
-            zip -r -q -9 ../AIO-REJ.zip .
-            cd ..
+          if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
+            echo "Cloning KernelSU-Next from full branch tip: $KSUN_BRANCH"
+            git clone --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
+          else
+            echo "Cloning KernelSU-Next from branch: $KSUN_BRANCH"
+            git clone --depth=1 --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
+          fi
         else
             echo "No rejects found to upload."
         fi
-
-    - name: Rejects Summary
-      run: |
-        echo "Reject artifacts were collected locally only and are not uploaded." >> "$GITHUB_STEP_SUMMARY"
+          if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
+            KSUN_COMMIT=$(git rev-parse HEAD)
+          else
+            KSUN_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON_PATH")
+
+            # Checkout the specific commit
+            echo "Checking out commit: $KSUN_COMMIT"
+            git fetch --depth=50 origin "$KSUN_COMMIT"
+            git checkout "$KSUN_COMMIT"
+          fi
 
     - name: Upload AIO-REJ Artifact
       uses: actions/upload-artifact@v7
@@ -198,7 +219,6 @@ jobs:
       GH_TOKEN: ${{ github.token }}
       RELEASE_NOTES: .github/config/RELEASE_NOTES.md
       COMMITS_JSON: .github/config/commits.json
-
     steps:
     - name: Checkout code
       uses: actions/checkout@v5
@@ -210,20 +230,27 @@ jobs:
       run: |
         set -euo pipefail
 
-        # Extract KernelSU commit and branch from commits config
-        KSUN_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON_PATH")
         KSUN_BRANCH="dev"
 
-        # Clone KernelSU-Next on the specified branch
-        echo "Cloning KernelSU-Next from branch: $KSUN_BRANCH"
-        git clone --depth=1 --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
+        if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
+          echo "Cloning KernelSU-Next from full branch tip: $KSUN_BRANCH"
+          git clone --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
+        else
+          echo "Cloning KernelSU-Next from branch: $KSUN_BRANCH"
+          git clone --depth=1 --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
+        fi
 
         cd /tmp/kernelsu-next
 
-        # Checkout the specific commit
-        echo "Checking out commit: $KSUN_COMMIT"
-        git fetch --depth=50 origin "$KSUN_COMMIT"
-        git checkout "$KSUN_COMMIT"
+        if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
+          KSUN_COMMIT=$(git rev-parse HEAD)
+        else
+          # Extract KernelSU commit and branch from commits config
+          KSUN_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON_PATH")
+          echo "Checking out commit: $KSUN_COMMIT"
+          git fetch --depth=50 origin "$KSUN_COMMIT"
+          git checkout "$KSUN_COMMIT"
+        fi
 
         # Extract version info
         COMMITS_COUNT=$(git rev-list --count HEAD)
@@ -393,20 +420,27 @@ jobs:
       run: |
         set -euo pipefail
 
-        # Extract KernelSU commit and branch from commits config
-        KSUN_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON_PATH")
         KSUN_BRANCH="dev"
 
-        # Clone KernelSU-Next on the specified branch
-        echo "Cloning KernelSU-Next from branch: $KSUN_BRANCH"
-        git clone --depth=1 --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
+        if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
+          echo "Cloning KernelSU-Next from full branch tip: $KSUN_BRANCH"
+          git clone --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
+        else
+          echo "Cloning KernelSU-Next from branch: $KSUN_BRANCH"
+          git clone --depth=1 --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
+        fi
 
         cd /tmp/kernelsu-next
 
-        # Checkout the specific commit
-        echo "Checking out commit: $KSUN_COMMIT"
-        git fetch --depth=50 origin "$KSUN_COMMIT"
-        git checkout "$KSUN_COMMIT"
+        if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
+          KSUN_COMMIT=$(git rev-parse HEAD)
+        else
+          # Extract KernelSU commit and branch from commits config
+          KSUN_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON_PATH")
+          echo "Checking out commit: $KSUN_COMMIT"
+          git fetch --depth=50 origin "$KSUN_COMMIT"
+          git checkout "$KSUN_COMMIT"
+        fi
 
         # Extract version info
         COMMITS_COUNT=$(git rev-list --count HEAD)

+ 6 - 0
.github/workflows/prepare.yml

@@ -16,6 +16,11 @@ on:
         required: false
         type: boolean
         default: false
+      use_latest_commits:
+        description: "Use branch tip for KernelSU and SUSFS instead of pinned commits"
+        required: false
+        type: boolean
+        default: true
 
 jobs:
   generate-matrix:
@@ -88,4 +93,5 @@ jobs:
       variant: ${{ matrix.variant }}
       feature_set: ${{ inputs.feature_set }}
       use_repo: ${{ inputs.use_repo }}
+      use_latest_commits: ${{ inputs.use_latest_commits }}
     secrets: inherit