build.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. name: Kernel Build Process
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. workflow_call:
  7. inputs:
  8. kernel_version:
  9. required: true
  10. type: string
  11. variant:
  12. required: false
  13. type: string
  14. ksu_commit:
  15. required: false
  16. type: string
  17. anykernel_commit:
  18. required: false
  19. type: string
  20. patches_commit:
  21. required: false
  22. type: string
  23. susfs_commit:
  24. required: false
  25. type: string
  26. feature_set:
  27. required: true
  28. type: string
  29. jobs:
  30. build-gki:
  31. name: "${{ inputs.kernel_version }}${{ inputs.variant && format('-{0}', inputs.variant) || '' }}"
  32. runs-on: ubuntu-latest
  33. timeout-minutes: 60
  34. steps:
  35. - name: Checkout Repository
  36. uses: actions/checkout@v4
  37. - name: Parse kernel version
  38. id: parse
  39. run: |
  40. # Parse version string.
  41. # Format: [KERNEL_VERSION].[SUBLEVEL]-[ANDROID_VERSION]-[PATCH_LEVEL]
  42. # Example 1: 5.10.198-android12-2024-01 -> K=5.10, S=198, A=android12, P=2024-01
  43. # Example 2: 5.10.X-android12-lts -> K=5.10, S=X, A=android12, P=lts
  44. INPUT_VERSION="${{ inputs.kernel_version }}"
  45. # Split by hyphens
  46. IFS='-' read -r KERNEL_PART ANDROID_PART REST <<< "$INPUT_VERSION"
  47. # Extract Kernel Version and Sublevel
  48. KERNEL_VERSION="${KERNEL_PART%.*}"
  49. SUB_LEVEL="${KERNEL_PART##*.}"
  50. # Extract Android Version
  51. ANDROID_VERSION="$ANDROID_PART"
  52. # Everything after the android version is the patch level
  53. OS_PATCH_LEVEL="$REST"
  54. # Special handling for "X" sublevel (LTS builds)
  55. if [[ "$SUB_LEVEL" == "X" ]]; then
  56. echo "Detected LTS build with wildcard sublevel"
  57. fi
  58. echo "Parsed: KERNEL=$KERNEL_VERSION, SUB=$SUB_LEVEL, ANDROID=$ANDROID_VERSION, PATCH=$OS_PATCH_LEVEL"
  59. # Set environment variables for subsequent steps and shell scripts
  60. echo "ANDROID_VERSION=$ANDROID_VERSION" >> "$GITHUB_ENV"
  61. echo "KERNEL_VERSION=$KERNEL_VERSION" >> "$GITHUB_ENV"
  62. echo "SUB_LEVEL=$SUB_LEVEL" >> "$GITHUB_ENV"
  63. echo "OS_PATCH_LEVEL=$OS_PATCH_LEVEL" >> "$GITHUB_ENV"
  64. # Set step outputs for immediate YAML context access (avoids validation warnings)
  65. echo "android_version=$ANDROID_VERSION" >> $GITHUB_OUTPUT
  66. echo "kernel_version=$KERNEL_VERSION" >> $GITHUB_OUTPUT
  67. echo "sub_level=$SUB_LEVEL" >> $GITHUB_OUTPUT
  68. echo "os_patch_level=$OS_PATCH_LEVEL" >> $GITHUB_OUTPUT
  69. - name: Install linker tools
  70. if: steps.parse.outputs.kernel_version == '5.10'
  71. run: |
  72. sudo apt-get update
  73. sudo apt-get install -y binutils lld
  74. echo "ld.lld --version" # Log verification
  75. export PATH="/usr/bin:$PATH"
  76. which ld # Should show /usr/bin/ld
  77. ld --version # Verify GNU ld works
  78. echo "PATH=$PATH" >> $GITHUB_ENV # Persist for step
  79. - name: Free Disk Space
  80. if: true
  81. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  82. with:
  83. remove_android: true
  84. remove_dotnet: true
  85. remove_haskell: true
  86. remove_tool_cache: true
  87. remove_swap: true
  88. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  89. remove_packages_one_command: true
  90. 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"
  91. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  92. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  93. testing: false
  94. - name: Setup Build Environment
  95. run: |
  96. mkdir -p "$GITHUB_WORKSPACE/kernel"
  97. mkdir -p "$GITHUB_WORKSPACE/git-repo"
  98. curl -L https://storage.googleapis.com/git-repo-downloads/repo -o "$GITHUB_WORKSPACE/git-repo/repo"
  99. chmod +x "$GITHUB_WORKSPACE/git-repo/repo"
  100. echo "$GITHUB_WORKSPACE/git-repo" >> "$GITHUB_PATH"
  101. # Clone patches if commit is provided
  102. if [ -n "${{ inputs.patches_commit }}" ]; then
  103. echo "Cloning Kernel Patches at commit ${{ inputs.patches_commit }}"
  104. if [ -d "$GITHUB_WORKSPACE/kernel_patches" ]; then rm -rf "$GITHUB_WORKSPACE/kernel_patches"; fi
  105. git clone https://github.com/WildKernels/kernel_patches.git "$GITHUB_WORKSPACE/kernel_patches"
  106. cd "$GITHUB_WORKSPACE/kernel_patches"
  107. git checkout "${{ inputs.patches_commit }}"
  108. cd "$GITHUB_WORKSPACE"
  109. else
  110. git clone https://github.com/WildKernels/kernel_patches.git "$GITHUB_WORKSPACE/kernel_patches"
  111. fi
  112. # Use specific commit if provided
  113. if [ -n "${{ inputs.anykernel_commit }}" ]; then
  114. echo "Cloning AnyKernel3 at commit ${{ inputs.anykernel_commit }}"
  115. if [ -d "$GITHUB_WORKSPACE/AnyKernel3" ]; then rm -rf "$GITHUB_WORKSPACE/AnyKernel3"; fi
  116. git clone https://github.com/WildKernels/AnyKernel3.git "$GITHUB_WORKSPACE/AnyKernel3"
  117. cd "$GITHUB_WORKSPACE/AnyKernel3"
  118. git checkout "${{ inputs.anykernel_commit }}"
  119. cd "$GITHUB_WORKSPACE"
  120. elif [ ! -d "$GITHUB_WORKSPACE/AnyKernel3" ]; then
  121. # Fallback if not downloaded
  122. git clone https://github.com/WildKernels/AnyKernel3.git -b gki-2.0 "$GITHUB_WORKSPACE/AnyKernel3"
  123. fi
  124. - name: Download Kernel Repository
  125. uses: ./.github/actions/download-kernel
  126. with:
  127. android_version: ${{ steps.parse.outputs.android_version }}
  128. kernel_version: ${{ steps.parse.outputs.kernel_version }}
  129. os_patch_level: ${{ steps.parse.outputs.os_patch_level }}
  130. - name: Extract Sublevel and Set File Name
  131. id: extract
  132. run: |
  133. SUBLEVEL="$SUB_LEVEL"
  134. if [[ -f "$GITHUB_WORKSPACE/kernel/common/Makefile" ]]; then
  135. EXTRACTED=$(grep '^SUBLEVEL = ' "$GITHUB_WORKSPACE/kernel/common/Makefile" | awk '{print $3}')
  136. [[ -n "$EXTRACTED" ]] && SUBLEVEL="$EXTRACTED"
  137. fi
  138. FILE_NAME="$KERNEL_VERSION.$SUBLEVEL-$ANDROID_VERSION-$OS_PATCH_LEVEL${{ inputs.variant && format('-{0}', inputs.variant) || '' }}"
  139. echo "SUBLEVEL=$SUBLEVEL" >> $GITHUB_ENV
  140. echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
  141. # Set step outputs for parse-time YAML context access
  142. echo "file_name=$FILE_NAME" >> $GITHUB_OUTPUT
  143. echo "sublevel=$SUBLEVEL" >> $GITHUB_OUTPUT
  144. - name: Apply glibc 2.38 Compatibility Fix
  145. if: false
  146. run: |
  147. # Use SUBLEVEL for LTS builds, otherwise use the input sub_level
  148. if [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.10" && $SUBLEVEL -le 186 ]] ||
  149. [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.15" && $SUBLEVEL -le 119 ]] ||
  150. [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "5.15" && $SUBLEVEL -le 110 ]] ||
  151. [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "6.1" && $SUBLEVEL -le 43 ]]; then
  152. GLIBC_VERSION=$(ldd --version 2>/dev/null | head -n 1 | awk '{print $NF}')
  153. if [ "$(printf '%s\n' "2.38" "$GLIBC_VERSION" | sort -V | head -n1)" = "2.38" ]; then
  154. cd "$GITHUB_WORKSPACE/kernel/common"
  155. 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
  156. if [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.10" && $SUBLEVEL -le 186 ]] ||
  157. [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.15" && $SUBLEVEL -le 119 ]] ||
  158. [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "5.15" && $SUBLEVEL -le 110 ]]; then
  159. sed -i '/char \*buf = NULL;/a int i;' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  160. 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
  161. sed -i '/if (subcommands) {/a int i;' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  162. 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
  163. fi
  164. fi
  165. fi
  166. - name: Fix Less Than 6.6.50 Builds
  167. if: ${{ steps.parse.outputs.android_version == 'android15' && steps.parse.outputs.kernel_version == '6.6' }} && false
  168. working-directory: ${{ github.workspace }}/kernel/common
  169. run: |
  170. if ! grep -qxF '#include <trace/hooks/fs.h>' ./fs/namespace.c; then
  171. sed -i '/#include <trace\/hooks\/blk.h>/a #include <trace\/hooks\/fs.h>' ./fs/namespace.c
  172. fi
  173. - name: Setup Wild KSU
  174. if: contains(inputs.feature_set, 'WKSU')
  175. uses: ./.github/actions/wksu
  176. with:
  177. ksu_commit: ${{ inputs.ksu_commit }}
  178. - name: Setup SUSFS
  179. if: contains(inputs.feature_set, 'SUSFS')
  180. uses: ./.github/actions/susfs
  181. with:
  182. android_version: ${{ steps.parse.outputs.android_version }}
  183. kernel_version: ${{ steps.parse.outputs.kernel_version }}
  184. os_patch_level: ${{ steps.parse.outputs.os_patch_level }}
  185. sublevel: ${{ steps.extract.outputs.sublevel }}
  186. susfs_commit: ${{ inputs.susfs_commit }}
  187. - name: Setup Baseband Guard
  188. if: contains(inputs.feature_set, 'BBG')
  189. uses: ./.github/actions/bbg
  190. - name: Apply Module Check Bypass
  191. if: ${{ inputs.variant == 'Bypass' || inputs.variant == 'Hakan' }}
  192. run: |
  193. if [[ "$KERNEL_VERSION" == "6.1" || "$KERNEL_VERSION" == "6.6" || "$KERNEL_VERSION" == "6.12" ]]; then
  194. TARGET_FILE="$GITHUB_WORKSPACE/kernel/common/kernel/module/version.c"
  195. else
  196. TARGET_FILE="$GITHUB_WORKSPACE/kernel/common/kernel/module.c"
  197. fi
  198. # Apply bypass patch to the target file
  199. sed -i '/bad_version:/{:a;n;/return 0;/{s/return 0;/return 1;/;b};ba}' "$TARGET_FILE"
  200. # Verify the bypass
  201. if grep -A 5 "bad_version:" "$TARGET_FILE" | grep -q "return 1;"; then
  202. echo "SUCCESS: Module check bypass verified in $TARGET_FILE"
  203. else
  204. echo "FAILED: Module check bypass not found in $TARGET_FILE"
  205. grep -A 5 "bad_version:" "$TARGET_FILE" || true
  206. exit 1
  207. fi
  208. - name: Apply Device-Specific Patches
  209. uses: ./.github/actions/apply-device-patches
  210. with:
  211. kernel_version: ${{ steps.parse.outputs.kernel_version }}
  212. - name: Configure Kernel Options
  213. uses: ./.github/actions/configure-kernel
  214. - name: Setup Hakan
  215. if: ${{ inputs.variant == 'Hakan' }}
  216. uses: ./.github/actions/hakan
  217. - name: Setup vTomsonek
  218. if: ${{ inputs.variant == 'vTomsonek' }}
  219. uses: ./.github/actions/vtomsonek
  220. with:
  221. android_version: ${{ steps.parse.outputs.android_version }}
  222. kernel_version: ${{ steps.parse.outputs.kernel_version }}
  223. sublevel: ${{ steps.parse.outputs.sub_level }}
  224. os_patch_level: ${{ steps.parse.outputs.os_patch_level }}
  225. - name: Apply ABI Compare Bypass
  226. if: false
  227. working-directory: ${{ github.workspace }}/kernel
  228. run: |
  229. # ABI compare bypass per kernel/android version
  230. # Edit each block as needed per version
  231. if [[ "$ANDROID_VERSION" == "android12" && "$KERNEL_VERSION" == "5.10" ]]; then
  232. sed -i 's/^\s*exit 1$/ echo "Who Cares? Bypassing Now!"/' build/abi/compare_to_symbol_list
  233. elif [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.10" ]]; then
  234. sed -i 's/^\s*exit 1$/ echo "Who Cares? Bypassing Now!"/' build/kernel/abi/compare_to_symbol_list
  235. elif [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.15" ]]; then
  236. sed -i 's/^\s*exit 1$/ echo "Who Cares? Bypassing Now!"/' build/kernel/abi/compare_to_symbol_list
  237. elif [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "5.15" ]]; then
  238. 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
  239. elif [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "6.1" ]]; then
  240. 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
  241. elif [[ "$ANDROID_VERSION" == "android15" && "$KERNEL_VERSION" == "6.6" ]]; then
  242. 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
  243. fi
  244. - name: Append ashmem exports if missing
  245. if: ${{ steps.parse.outputs.android_version == 'android16' && steps.parse.outputs.kernel_version == '6.12' && false }}
  246. working-directory: ${{ github.workspace }}/kernel
  247. run: |
  248. FILE=common/drivers/staging/android/ashmem.c
  249. if [[ -f "$FILE" ]] && ! grep -q 'is_ashmem_file' "$FILE"; then
  250. cat >>"$FILE" <<'EOF'
  251. bool is_ashmem_file(struct file *file) { return false; }
  252. int ashmem_area_name(struct file *file, char *name) { return 0; }
  253. long ashmem_area_size(struct file *file) { return 0; }
  254. struct file *ashmem_area_vmfile(struct file *file) { return NULL; }
  255. EXPORT_SYMBOL_GPL(is_ashmem_file);
  256. EXPORT_SYMBOL_GPL(ashmem_area_name);
  257. EXPORT_SYMBOL_GPL(ashmem_area_size);
  258. EXPORT_SYMBOL_GPL(ashmem_area_vmfile);
  259. EOF
  260. fi
  261. if [ -f common/drivers/android/binder/Makefile ]; then
  262. perl -i -0777 -pe 's/\$\(\s*CONFIG_ANDROID_BINDER_IPC_RUST\s*\)/m/' common/drivers/android/binder/Makefile
  263. #perl -i -ne 'print unless /CONFIG_ANDROID_BINDER_IPC_RUST_DUMMY/' common/drivers/android/binder/Makefile
  264. perl -i -pe 's/^rust_binder-\$\([^)]+\)\s*:=/rust_binder-y :=/' common/drivers/android/binder/Makefile
  265. cat common/drivers/android/Makefile
  266. cat common/drivers/android/binder/Makefile
  267. #perl -ni -e 'print unless /rust_toolchain\s*=\s*"\/\/build\/rust:linux_kernel_toolchain",/' common/BUILD.bazel
  268. #cat common/BUILD.bazel
  269. rustup set profile minimal
  270. rustup update nightly
  271. rustup default nightly
  272. rustup target add aarch64-unknown-none
  273. else
  274. perl -i -0777 -pe 's/\$\(\s*CONFIG_ANDROID_BINDER_IPC_RUST\s*\)/m/' common/drivers/android/Makefile
  275. cat common/drivers/android/Makefile
  276. fi
  277. - name: Apply Kernel Branding
  278. uses: ./.github/actions/apply-kernel-branding
  279. with:
  280. build_type: ${{ inputs.variant || 'Normal' }}
  281. kernel_version: ${{ steps.parse.outputs.kernel_version }}
  282. - name: Clean Kernel Flags
  283. uses: ./.github/actions/clean-kernel-flags
  284. - name: Build Kernel
  285. working-directory: ${{ github.workspace }}/kernel
  286. run: |
  287. set -ex
  288. #make -C common mrproper
  289. if [ -f "build/build.sh" ]; then
  290. GKI_DEFCONFIG_FRAGMENT="$GITHUB_WORKSPACE/wild_gki.fragment" LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh || exit 1
  291. else
  292. # Copy fragment to kernel tree for bazel
  293. cp "$GITHUB_WORKSPACE/wild_gki.fragment" common/arch/arm64/configs/wild_gki.fragment
  294. if [[ "$ANDROID_VERSION" == "android14" ]]; then
  295. tools/bazel build --config=fast --lto=thin --defconfig_fragment=//common:arch/arm64/configs/wild_gki.fragment //common:kernel_aarch64_dist || exit 1
  296. else
  297. tools/bazel build --config=fast --lto=none --defconfig_fragment=//common:arch/arm64/configs/wild_gki.fragment //common:kernel_aarch64_dist || exit 1
  298. fi
  299. fi
  300. - name: Prepare AnyKernel3 Zip
  301. run: |
  302. # Copy Image from normal build locations
  303. if [ -f "$GITHUB_WORKSPACE/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" ]; then
  304. cp "$GITHUB_WORKSPACE/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" "$GITHUB_WORKSPACE/AnyKernel3/Image"
  305. elif [ -f "$GITHUB_WORKSPACE/kernel/bazel-bin/common/kernel_aarch64/Image" ]; then
  306. cp "$GITHUB_WORKSPACE/kernel/bazel-bin/common/kernel_aarch64/Image" "$GITHUB_WORKSPACE/AnyKernel3/Image"
  307. else
  308. echo "Error: Image file not found in any expected location"
  309. exit 1
  310. fi
  311. - name: Copy snd-aloop module
  312. if: ${{ inputs.variant == 'vTomsonek' }}
  313. run: |
  314. if [ "${{ inputs.variant }}" = "vTomsonek" ]; then
  315. sed -i 's|^do\.modules=.*|do.modules=1|' "$GITHUB_WORKSPACE/AnyKernel3/anykernel.sh"
  316. fi
  317. mkdir -p "$GITHUB_WORKSPACE/AnyKernel3/modules/data/adb/lkm"
  318. if [[ "$ANDROID_VERSION" == "android12" || "$ANDROID_VERSION" == "android13" ]]; then
  319. SRC_DIR="$GITHUB_WORKSPACE/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist"
  320. else
  321. SRC_DIR="$GITHUB_WORKSPACE/kernel/bazel-bin/common/kernel_aarch64"
  322. fi
  323. cp "$SRC_DIR/snd-aloop.ko" "$GITHUB_WORKSPACE/AnyKernel3/modules/data/adb/lkm/"
  324. cp "$SRC_DIR/g_audio.ko" "$GITHUB_WORKSPACE/AnyKernel3/modules/data/adb/lkm/"
  325. - name: Scan and collect patch rejects
  326. id: scan
  327. if: ${{ always() }}
  328. run: |
  329. set -e
  330. CONFIG_DIR="$GITHUB_WORKSPACE/kernel"
  331. REJECTS_DIR="$GITHUB_WORKSPACE/patch-rejects"
  332. mkdir -p "$REJECTS_DIR"
  333. # Find all .rej files under the configuration directory
  334. mapfile -t REJS < <(find "$CONFIG_DIR" -type f -name '*.rej')
  335. REJ_COUNT=${#REJS[@]}
  336. echo "Found $REJ_COUNT .rej files under $CONFIG_DIR"
  337. echo "REJ_COUNT=$REJ_COUNT" >> $GITHUB_ENV
  338. echo "rej_count=$REJ_COUNT" >> $GITHUB_OUTPUT
  339. if [ "$REJ_COUNT" -gt 0 ]; then
  340. for REJ in "${REJS[@]}"; do
  341. # Relative path from $CONFIG
  342. REL="${REJ#"$CONFIG_DIR"/}"
  343. DEST="$REJECTS_DIR/$REL"
  344. mkdir -p "$(dirname "$DEST")"
  345. cp "$REJ" "$DEST"
  346. # Copy the associated original file alongside the .rej
  347. ORIG="${REJ%.rej}"
  348. if [ -f "$ORIG" ]; then
  349. ORIG_DEST="$REJECTS_DIR/${REL%.rej}"
  350. mkdir -p "$(dirname "$ORIG_DEST")"
  351. cp "$ORIG" "$ORIG_DEST"
  352. fi
  353. echo "$REL" >> "$REJECTS_DIR/index.txt"
  354. done
  355. fi
  356. - name: Upload Artifacts
  357. uses: actions/upload-artifact@v4
  358. with:
  359. name: ${{ steps.extract.outputs.file_name }}-AnyKernel3
  360. path: ${{ github.workspace }}/AnyKernel3/**
  361. if-no-files-found: ignore
  362. compression-level: 9
  363. - name: Upload Rejects
  364. if: ${{ always() && inputs.variant != 'Bypass' && steps.scan.outputs.rej_count > 0 }}
  365. uses: actions/upload-artifact@v4
  366. with:
  367. name: ${{ steps.extract.outputs.file_name }}-Rejects
  368. path: patch-rejects/
  369. if-no-files-found: ignore
  370. compression-level: 9
  371. - name: Build Summary
  372. if: ${{ always() }}
  373. run: |
  374. # Kernel info
  375. echo "Android Version : $ANDROID_VERSION"
  376. echo "Kernel Version : $KERNEL_VERSION"
  377. echo "Sub Level : $SUB_LEVEL"
  378. echo "Sub level (Makefile): $SUBLEVEL"
  379. echo "Patch Level : $OS_PATCH_LEVEL"
  380. # Branch info
  381. echo "Repo Branch : common-$KERNEL_VERSION-$ANDROID_VERSION-$OS_PATCH_LEVEL || 'normal'"
  382. echo "Deprecated : $DEPRECATED_BRANCH"
  383. # Build info
  384. echo "Build Type : ${{ inputs.variant || 'Normal' }}"
  385. # Features info
  386. echo "Features : ${{ inputs.feature_set || 'None' }}"
  387. echo "WKSU Commit : ${{ inputs.ksu_commit || 'canary' }}"
  388. echo "WKSU Tag : $KSU_GIT_TAG"
  389. echo "WKSU Version : $KSU_VERSION"
  390. echo "BBG Commit : $BBG_COMMIT"
  391. echo "BBG Version : $BBG_VERSION"
  392. # Variant info
  393. echo "Variant : ${{ inputs.variant || 'Standard' }}"
  394. echo "Features : ${{ inputs.feature_set || 'None' }}"
  395. # End of workflow