| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
- name: Kernel Build Process
- permissions:
- contents: write
- actions: write
- on:
- workflow_call:
- inputs:
- kernel_version:
- required: true
- type: string
- variant:
- required: false
- type: string
- ksu_commit:
- required: false
- type: string
- anykernel_commit:
- required: false
- type: string
- patches_commit:
- required: false
- type: string
- susfs_commit:
- required: false
- type: string
- feature_set:
- required: true
- type: string
- jobs:
- build-gki:
- name: "${{ inputs.kernel_version }} (${{ matrix.variant }})"
- strategy:
- fail-fast: false
- matrix:
- variant: ['Normal', 'Bypass']
- runs-on: ubuntu-latest
- timeout-minutes: 60
- steps:
- - name: Checkout Repository
- uses: actions/checkout@v5
- - name: Parse kernel version
- id: parse
- run: |
- # Parse version string.
- # Format: [KERNEL_VERSION].[SUBLEVEL]-[ANDROID_VERSION]-[PATCH_LEVEL]
- # Example 1: 5.10.198-android12-2024-01 -> K=5.10, S=198, A=android12, P=2024-01
- # Example 2: 5.10.X-android12-lts -> K=5.10, S=X, A=android12, P=lts
-
- INPUT_VERSION="${{ inputs.kernel_version }}"
-
- # Split by hyphens
- IFS='-' read -r KERNEL_PART ANDROID_PART REST <<< "$INPUT_VERSION"
-
- # Extract Kernel Version and Sublevel
- KERNEL_VERSION="${KERNEL_PART%.*}"
- SUB_LEVEL="${KERNEL_PART##*.}"
-
- # Extract Android Version
- ANDROID_VERSION="$ANDROID_PART"
-
- # Everything after the android version is the patch level
- OS_PATCH_LEVEL="$REST"
-
- echo "Parsed: KERNEL=$KERNEL_VERSION, SUB=$SUB_LEVEL, ANDROID=$ANDROID_VERSION, PATCH=$OS_PATCH_LEVEL"
-
- # Set environment variables for subsequent steps and shell scripts
- echo "ANDROID_VERSION=$ANDROID_VERSION" >> "$GITHUB_ENV"
- echo "KERNEL_VERSION=$KERNEL_VERSION" >> "$GITHUB_ENV"
- echo "SUB_LEVEL=$SUB_LEVEL" >> "$GITHUB_ENV"
- echo "OS_PATCH_LEVEL=$OS_PATCH_LEVEL" >> "$GITHUB_ENV"
- # Set step outputs for immediate YAML context access (avoids validation warnings)
- echo "android_version=$ANDROID_VERSION" >> $GITHUB_OUTPUT
- echo "kernel_version=$KERNEL_VERSION" >> $GITHUB_OUTPUT
- echo "sub_level=$SUB_LEVEL" >> $GITHUB_OUTPUT
- echo "os_patch_level=$OS_PATCH_LEVEL" >> $GITHUB_OUTPUT
- - name: Free Disk Space
- if: true
- uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
- with:
- remove_android: true
- remove_dotnet: true
- remove_haskell: true
- remove_tool_cache: true
- remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
- remove_packages_one_command: true
- remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle"
- rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
- rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
- testing: false
- - name: Setup more Swap (for LTO)
- uses: thejerrybao/setup-swap-space@v1 # or pierotofy/set-swap-space
- with:
- swap-size-gb: 25 # 10-24 GB is common for heavy LTO
- # swap-space-path: /mnt/swapfile # optional
- - name: Setup Build Environment
- run: |
- mkdir -p "$GITHUB_WORKSPACE/kernel"
- mkdir -p "$GITHUB_WORKSPACE/git-repo"
- curl -L https://storage.googleapis.com/git-repo-downloads/repo -o "$GITHUB_WORKSPACE/git-repo/repo"
- chmod +x "$GITHUB_WORKSPACE/git-repo/repo"
- echo "$GITHUB_WORKSPACE/git-repo" >> "$GITHUB_PATH"
-
- # Clone patches if commit is provided
- if [ -n "${{ inputs.patches_commit }}" ]; then
- echo "Cloning Kernel Patches at commit ${{ inputs.patches_commit }}"
- if [ -d "$GITHUB_WORKSPACE/kernel_patches" ]; then rm -rf "$GITHUB_WORKSPACE/kernel_patches"; fi
- git clone https://github.com/WildKernels/kernel_patches.git "$GITHUB_WORKSPACE/kernel_patches"
- cd "$GITHUB_WORKSPACE/kernel_patches"
- git checkout "${{ inputs.patches_commit }}"
- cd "$GITHUB_WORKSPACE"
- else
- git clone https://github.com/WildKernels/kernel_patches.git "$GITHUB_WORKSPACE/kernel_patches"
- fi
- # Use specific commit if provided
- if [ -n "${{ inputs.anykernel_commit }}" ]; then
- echo "Cloning AnyKernel3 at commit ${{ inputs.anykernel_commit }}"
- if [ -d "$GITHUB_WORKSPACE/AnyKernel3" ]; then rm -rf "$GITHUB_WORKSPACE/AnyKernel3"; fi
- git clone https://github.com/WildKernels/AnyKernel3.git "$GITHUB_WORKSPACE/AnyKernel3"
- cd "$GITHUB_WORKSPACE/AnyKernel3"
- git checkout "${{ inputs.anykernel_commit }}"
- cd "$GITHUB_WORKSPACE"
- elif [ ! -d "$GITHUB_WORKSPACE/AnyKernel3" ]; then
- # Fallback if not downloaded
- git clone https://github.com/WildKernels/AnyKernel3.git -b gki-2.0 "$GITHUB_WORKSPACE/AnyKernel3"
- fi
- AOSP_MIRROR=https://android.googlesource.com
- BRANCH=main-kernel-2025
- git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools
- git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 mkbootimg
-
- echo "AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool" >> $GITHUB_ENV
- echo "MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py" >> $GITHUB_ENV
- echo "UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py" >> $GITHUB_ENV
- echo "BOOT_SIGN_KEY_PATH=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem" >> $GITHUB_ENV
- mkdir -p "$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb"
- openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out "$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem"
- chmod 600 "$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem"
-
- - name: Download Kernel Repository
- uses: ./.github/actions/download-kernel
- with:
- android_version: ${{ steps.parse.outputs.android_version }}
- kernel_version: ${{ steps.parse.outputs.kernel_version }}
- os_patch_level: ${{ steps.parse.outputs.os_patch_level }}
- - name: Extract Sublevel and Set File Name
- id: extract
- run: |
- SUBLEVEL="$SUB_LEVEL"
- if [[ -f "$GITHUB_WORKSPACE/kernel/common/Makefile" ]]; then
- EXTRACTED=$(grep '^SUBLEVEL = ' "$GITHUB_WORKSPACE/kernel/common/Makefile" | awk '{print $3}')
- [[ -n "$EXTRACTED" ]] && SUBLEVEL="$EXTRACTED"
- fi
- VARIANT="${{ matrix.variant }}"
- FILE_NAME="$KERNEL_VERSION.$SUBLEVEL-$ANDROID_VERSION-$OS_PATCH_LEVEL-$VARIANT"
- echo "SUBLEVEL=$SUBLEVEL" >> $GITHUB_ENV
- echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
-
- # Set step outputs for parse-time YAML context access
- echo "file_name=$FILE_NAME" >> $GITHUB_OUTPUT
- echo "sublevel=$SUBLEVEL" >> $GITHUB_OUTPUT
- - name: Apply glibc 2.38 Compatibility Fix
- if: true
- run: |
- # Use SUBLEVEL for LTS builds, otherwise use the input sub_level
- if [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.10" && $SUBLEVEL -le 186 ]] ||
- [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.15" && $SUBLEVEL -le 119 ]] ||
- [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "5.15" && $SUBLEVEL -le 110 ]] ||
- [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "6.1" && $SUBLEVEL -le 43 ]]; then
- GLIBC_VERSION=$(ldd --version 2>/dev/null | head -n 1 | awk '{print $NF}')
- if [ "$(printf '%s\n' "2.38" "$GLIBC_VERSION" | sort -V | head -n1)" = "2.38" ]; then
- cd "$GITHUB_WORKSPACE/kernel/common"
- sed -i '/\$(Q)\$(MAKE) -C \$(SUBCMD_SRC) OUTPUT=\$(abspath \$(dir \$@))\/ \$(abspath \$@)/s//$(Q)$(MAKE) -C $(SUBCMD_SRC) EXTRA_CFLAGS="$(CFLAGS)" OUTPUT=$(abspath $(dir $@))\/ $(abspath $@)/' tools/bpf/resolve_btfids/Makefile 2>/dev/null || true
- if [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.10" && $SUBLEVEL -le 186 ]] ||
- [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.15" && $SUBLEVEL -le 119 ]] ||
- [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "5.15" && $SUBLEVEL -le 110 ]]; then
- sed -i '/char \*buf = NULL;/a int i;' tools/lib/subcmd/parse-options.c 2>/dev/null || true
- sed -i 's/for (int i = 0; subcommands\[i\]; i++) {/for (i = 0; subcommands[i]; i++) {/' tools/lib/subcmd/parse-options.c 2>/dev/null || true
- sed -i '/if (subcommands) {/a int i;' tools/lib/subcmd/parse-options.c 2>/dev/null || true
- sed -i 's/for (int i = 0; subcommands\[i\]; i++)/for (i = 0; subcommands[i]; i++)/' tools/lib/subcmd/parse-options.c 2>/dev/null || true
- fi
- fi
- fi
- - name: Fix Less Than 6.6.50 Builds
- if: ${{ steps.parse.outputs.android_version == 'android15' && steps.parse.outputs.kernel_version == '6.6'}}
- working-directory: ${{ github.workspace }}/kernel/common
- run: |
- if ! grep -qxF '#include <trace/hooks/fs.h>' ./fs/namespace.c; then
- sed -i '/#include <trace\/hooks\/blk.h>/a #include <trace\/hooks\/fs.h>' ./fs/namespace.c
- fi
- - name: Setup KernelSU-Next
- if: contains(inputs.feature_set, 'KSUN')
- uses: ./.github/actions/kernelsu
- with:
- ksu_commit: ${{ inputs.ksu_commit }}
- - name: Setup SUSFS
- if: contains(inputs.feature_set, 'SUSFS')
- uses: ./.github/actions/susfs
- with:
- android_version: ${{ steps.parse.outputs.android_version }}
- kernel_version: ${{ steps.parse.outputs.kernel_version }}
- os_patch_level: ${{ steps.parse.outputs.os_patch_level }}
- sublevel: ${{ steps.extract.outputs.sublevel }}
- susfs_commit: ${{ inputs.susfs_commit }}
- - name: Setup SUSFS Patches
- if: contains(inputs.feature_set, 'SUSFS')
- uses: ./.github/actions/susfs-patches
- with:
- android_version: ${{ steps.parse.outputs.android_version }}
- kernel_version: ${{ steps.parse.outputs.kernel_version }}
- os_patch_level: ${{ steps.parse.outputs.os_patch_level }}
- sublevel: ${{ steps.extract.outputs.sublevel }}
- - name: Setup Baseband Guard
- if: contains(inputs.feature_set, 'BBG')
- uses: ./.github/actions/bbg
- - name: Apply Module Check Bypass
- if: ${{ matrix.variant == 'Bypass' }}
- run: |
- if [[ "$KERNEL_VERSION" == "6.1" || "$KERNEL_VERSION" == "6.6" || "$KERNEL_VERSION" == "6.12" ]]; then
- TARGET_FILE="$GITHUB_WORKSPACE/kernel/common/kernel/module/version.c"
- else
- TARGET_FILE="$GITHUB_WORKSPACE/kernel/common/kernel/module.c"
- fi
- # Apply bypass patch to the target file
- sed -i '/bad_version:/{:a;n;/return 0;/{s/return 0;/return 1;/;b};ba}' "$TARGET_FILE"
- # Verify the bypass
- if grep -A 5 "bad_version:" "$TARGET_FILE" | grep -q "return 1;"; then
- echo "SUCCESS: Module check bypass verified in $TARGET_FILE"
- else
- echo "FAILED: Module check bypass not found in $TARGET_FILE"
- grep -A 5 "bad_version:" "$TARGET_FILE" || true
- exit 1
- fi
- - name: Apply Device-Specific Patches
- uses: ./.github/actions/apply-device-patches
- with:
- kernel_version: ${{ steps.parse.outputs.kernel_version }}
- - name: Setup netfilter/ipset options
- uses: ./.github/actions/netfilter-ipset
- with:
- kernel_version: ${{ steps.parse.outputs.kernel_version }}
- - name: Setup BBRv3
- uses: ./.github/actions/bbr
- with:
- kernel_version: ${{ steps.parse.outputs.kernel_version }}
- - name: Apply ABI Compare Bypass
- if: false
- working-directory: ${{ github.workspace }}/kernel
- run: |
- # ABI compare bypass per kernel/android version
- # Edit each block as needed per version
- if [[ "$ANDROID_VERSION" == "android12" && "$KERNEL_VERSION" == "5.10" ]]; then
- sed -i 's/^\s*exit 1$/ echo "Who Cares? Bypassing Now!"/' build/abi/compare_to_symbol_list
- elif [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.10" ]]; then
- sed -i 's/^\s*exit 1$/ echo "Who Cares? Bypassing Now!"/' build/kernel/abi/compare_to_symbol_list
- elif [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.15" ]]; then
- sed -i 's/^\s*exit 1$/ echo "Who Cares? Bypassing Now!"/' build/kernel/abi/compare_to_symbol_list
- elif [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "5.15" ]]; then
- perl -i -pe 's/^(\s*)return 1$/$1print("Who Cares? Bypassing Now!")\n$1return 0/g if /if missing_symbols:/../return 1/' build/kernel/abi/check_buildtime_symbol_protection.py
- elif [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "6.1" ]]; then
- perl -i -pe 's/^(\s*)return 1$/$1print("Who Cares? Bypassing Now!")\n$1return 0/g if /if missing_symbols:/../return 1/' build/kernel/abi/check_buildtime_symbol_protection.py
- elif [[ "$ANDROID_VERSION" == "android15" && "$KERNEL_VERSION" == "6.6" ]]; then
- perl -i -pe 's/^(\s*)return 1$/$1print("Who Cares? Bypassing Now!")\n$1return 0/g if /if missing_symbols:/../return 1/' build/kernel/abi/check_buildtime_symbol_protection.py
- fi
- - name: Apply Kernel Branding
- uses: ./.github/actions/apply-kernel-branding
- with:
- build_type: ${{ matrix.variant }}
- kernel_version: ${{ steps.parse.outputs.kernel_version }}
- - name: Remove Protected Exports
- working-directory: ${{ github.workspace }}/kernel
- run: |
- set -ex
- if [ ! -f "build/build.sh" ]; then
- # Bazel build system (newer kernels)
- # Remove ABI protected exports to prevent build errors
- 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
- sed -i 's/protected_modules = \[.*\]/protected_modules = []/' common/modules.bzl || true
- fi
- - name: Clean Kernel Flags
- uses: ./.github/actions/clean-kernel-flags
- - name: Build Kernel
- working-directory: ${{ github.workspace }}/kernel
- env:
- SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}
- KBUILD_BUILD_TIMESTAMP: ${{ env.KBUILD_BUILD_TIMESTAMP }}
- run: |
- set -ex
- if [ -f "build/build.sh" ]; then
- #SKIP_MRPROPER=1
- GKI_DEFCONFIG_FRAGMENT="$GITHUB_WORKSPACE/wild_gki.fragment" BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh || exit 1
- else
- # Copy fragment to kernel tree for bazel
- cp "$GITHUB_WORKSPACE/wild_gki.fragment" common/arch/arm64/configs/wild_gki.fragment
- tools/bazel build --config=release --stamp --defconfig_fragment=//common:arch/arm64/configs/wild_gki.fragment //common:kernel_aarch64_dist || exit 1
- fi
- fi
- - name: Create Bootimgs Folder and Build Boot Images
- working-directory: ${{ github.workspace }}
- run: |
- set -e
- mkdir -p bootimgs
- mkdir -p boot-artifacts
- echo "Creating bootimgs folder and copying images..."
- if [ -f "$GITHUB_WORKSPACE/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" ]; then
- cp "$GITHUB_WORKSPACE/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" "$GITHUB_WORKSPACE/bootimgs/Image"
- cp "$GITHUB_WORKSPACE/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image.lz4" "$GITHUB_WORKSPACE/bootimgs/Image.lz4"
- else
- cp "$GITHUB_WORKSPACE/kernel/bazel-bin/common/kernel_aarch64/Image" "$GITHUB_WORKSPACE/bootimgs/Image"
- cp "$GITHUB_WORKSPACE/kernel/bazel-bin/common/kernel_aarch64/Image.lz4" "$GITHUB_WORKSPACE/bootimgs/Image.lz4"
- fi
- gzip -n -k -f -9 "$GITHUB_WORKSPACE/bootimgs/Image" > "$GITHUB_WORKSPACE/bootimgs/Image.gz"
- cd "$GITHUB_WORKSPACE/bootimgs"
- case "$ANDROID_VERSION" in
- android12)
- echo "Android 12: downloading certified boot image to extract ramdisk..."
- GKI_URL="https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-${OS_PATCH_LEVEL}_r1.zip"
- FALLBACK_URL="https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-2023-01_r1.zip"
- echo "Checking if GKI kernel URL is reachable: $GKI_URL"
- status="$(curl -sL -w "%{http_code}" "$GKI_URL" -o /dev/null || true)"
- if [ "$status" = "200" ]; then
- echo "Downloading from GKI_URL"
- curl -L -o gki-kernel.zip "$GKI_URL"
- else
- echo "$GKI_URL not found (HTTP $status), using $FALLBACK_URL"
- curl -L -o gki-kernel.zip "$FALLBACK_URL"
- fi
- echo "Unzipping the downloaded kernel..."
- unzip -q gki-kernel.zip
- rm -f gki-kernel.zip
- echo "Unpacking boot image to extract ramdisk..."
- if [ -f "./boot-5.10.img" ]; then
- BOOT_IMG="./boot-5.10.img"
- else
- BOOT_IMG="$(ls -1 ./boot-*.img 2>/dev/null | head -n 1 || true)"
- fi
- if [ -z "${BOOT_IMG:-}" ]; then
- echo "Error: could not find extracted boot-*.img in $PWD"
- ls -la
- exit 1
- fi
- "$UNPACK_BOOTIMG" --boot_img="$PWD/$BOOT_IMG"
- ;;
- esac
- for kernel_image in Image Image.gz Image.lz4; do
- case "$kernel_image" in
- Image) output_image="boot.img" ;;
- Image.gz) output_image="boot-gz.img" ;;
- Image.lz4) output_image="boot-lz4.img" ;;
- esac
- echo "Building $output_image"
- if [ "$ANDROID_VERSION" = "android12" ]; then
- "$MKBOOTIMG" --header_version 4 --kernel "$kernel_image" --output "$output_image" --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level "$OS_PATCH_LEVEL"
- else
- "$MKBOOTIMG" --header_version 4 --kernel "$kernel_image" --output "$output_image"
- fi
- "$AVBTOOL" add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image "$output_image" --algorithm SHA256_RSA2048 --key "$BOOT_SIGN_KEY_PATH"
- cp "$output_image" "$GITHUB_WORKSPACE/boot-artifacts/${FILE_NAME}-${output_image}"
- done
- - name: Upload Boot Images
- uses: actions/upload-artifact@v4
- with:
- name: ${{ steps.extract.outputs.file_name }}-BootImages
- path: ${{ github.workspace }}/boot-artifacts/*.img
- if-no-files-found: error
- compression-level: 0
- - name: Prepare AnyKernel3 Zip
- run: |
- # Copy Image from normal build locations
- if [ -f "$GITHUB_WORKSPACE/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" ]; then
- cp "$GITHUB_WORKSPACE/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" "$GITHUB_WORKSPACE/AnyKernel3/Image"
- elif [ -f "$GITHUB_WORKSPACE/kernel/bazel-bin/common/kernel_aarch64/Image" ]; then
- cp "$GITHUB_WORKSPACE/kernel/bazel-bin/common/kernel_aarch64/Image" "$GITHUB_WORKSPACE/AnyKernel3/Image"
- else
- echo "Error: Image file not found in any expected location"
- exit 1
- fi
- - name: Scan and collect patch rejects
- id: scan
- if: ${{ always() }}
- run: |
- set -e
- CONFIG_DIR="$GITHUB_WORKSPACE/kernel"
- REJECTS_DIR="$GITHUB_WORKSPACE/patch-rejects"
- mkdir -p "$REJECTS_DIR"
- # Find all .rej files under the configuration directory
- mapfile -t REJS < <(find "$CONFIG_DIR" -type f -name '*.rej')
- REJ_COUNT=${#REJS[@]}
- echo "Found $REJ_COUNT .rej files under $CONFIG_DIR"
- echo "REJ_COUNT=$REJ_COUNT" >> $GITHUB_ENV
- echo "rej_count=$REJ_COUNT" >> $GITHUB_OUTPUT
- if [ "$REJ_COUNT" -gt 0 ]; then
- for REJ in "${REJS[@]}"; do
- # Relative path from $CONFIG
- REL="${REJ#"$CONFIG_DIR"/}"
- DEST="$REJECTS_DIR/$REL"
- mkdir -p "$(dirname "$DEST")"
- cp "$REJ" "$DEST"
- # Copy the associated original file alongside the .rej
- ORIG="${REJ%.rej}"
- if [ -f "$ORIG" ]; then
- ORIG_DEST="$REJECTS_DIR/${REL%.rej}"
- mkdir -p "$(dirname "$ORIG_DEST")"
- cp "$ORIG" "$ORIG_DEST"
- fi
- echo "$REL" >> "$REJECTS_DIR/index.txt"
- done
- fi
- - name: Upload Artifacts
- uses: actions/upload-artifact@v4
- with:
- name: ${{ steps.extract.outputs.file_name }}-AnyKernel3
- path: ${{ github.workspace }}/AnyKernel3/**
- if-no-files-found: ignore
- compression-level: 9
- - name: Upload Rejects
- if: ${{ always() }}
- uses: actions/upload-artifact@v4
- with:
- name: ${{ steps.extract.outputs.file_name }}-Rejects
- path: patch-rejects/
- if-no-files-found: ignore
- compression-level: 9
- - name: Build Summary
- if: ${{ always() }}
- run: |
- # Kernel info
- echo "Android Version : $ANDROID_VERSION"
- echo "Kernel Version : $KERNEL_VERSION"
- echo "Sub Level : $SUB_LEVEL"
- echo "Sub level (Makefile): $SUBLEVEL"
- echo "Patch Level : $OS_PATCH_LEVEL"
- # Branch info
- echo "Repo Branch : common-$KERNEL_VERSION-$ANDROID_VERSION-$OS_PATCH_LEVEL || 'normal'"
- echo "Deprecated : $DEPRECATED_BRANCH"
- # Build info
- echo "Build Type : ${{ matrix.variant }}"
- # Features info
- echo "Features : ${{ inputs.feature_set || 'None' }}"
- echo "KSUN Commit : ${{ inputs.ksu_commit || 'canary' }}"
- echo "KSUN Tag : $KSU_GIT_TAG"
- echo "KSUN Version : $KSU_VERSION"
- echo "BBG Commit : $BBG_COMMIT"
- echo "BBG Version : $BBG_VERSION"
- # Variant info
- echo "Variant : ${{ matrix.variant }}"
- echo "Features : ${{ inputs.feature_set || 'None' }}"
- # End of workflow
|