main.yml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  1. name: Build Kernels
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. workflow_dispatch:
  7. inputs:
  8. release_type:
  9. description: "Release Type"
  10. type: choice
  11. options:
  12. - Action
  13. - Pre-Release
  14. - Release
  15. default: Action
  16. kernel_build_version:
  17. description: "Kernel Version"
  18. type: choice
  19. options:
  20. - All
  21. - android12-5.10
  22. - android13-5.10
  23. - android13-5.15
  24. - android14-5.15
  25. - android14-6.1
  26. - android15-6.6
  27. - android16-6.12
  28. default: All
  29. brand_name:
  30. description: "Kernel Branding"
  31. type: string
  32. default: Wild
  33. root_flavor:
  34. description: "Root Flavor"
  35. type: choice
  36. options:
  37. - none
  38. - KernelSU-Next
  39. - KernelSU
  40. - ReSukiSU
  41. default: KernelSU-Next
  42. use_susfs:
  43. description: "SUSFS"
  44. type: boolean
  45. default: true
  46. use_nomount:
  47. description: "NoMount"
  48. type: boolean
  49. default: true
  50. use_bbg:
  51. description: "Baseband Guard"
  52. type: boolean
  53. default: true
  54. use_net:
  55. description: "Networking"
  56. type: boolean
  57. default: true
  58. use_ds:
  59. description: "DroidSpaces"
  60. type: boolean
  61. default: true
  62. use_ntsync:
  63. description: "NTSync"
  64. type: boolean
  65. default: true
  66. use_ptrace:
  67. description: "Ptrace Patch"
  68. type: boolean
  69. default: true
  70. use_unicode:
  71. description: "Unicode Fix"
  72. type: boolean
  73. default: true
  74. use_bpf:
  75. description: "BPF Stack (BTF + eBPF + FUSE-BPF)"
  76. type: boolean
  77. default: true
  78. use_perf:
  79. description: "Performance"
  80. type: boolean
  81. default: false
  82. jobs:
  83. prepare-ccache:
  84. name: Prepare ccache binary (download once)
  85. runs-on: ubuntu-latest
  86. steps:
  87. - name: Download custom ccache once
  88. if: false
  89. run: |
  90. set -uo pipefail
  91. echo "::group::Download ccache"
  92. url="https://raw.githubusercontent.com/WildKernels/kernel_patches/refs/heads/main/ccache/ccache-x86-64"
  93. ok=0
  94. for attempt in 1 2 3 4 5 6; do
  95. if curl -LfsS --connect-timeout 30 --max-time 120 -H "User-Agent: Mozilla/5.0" "$url" -o ccache && [ -s ccache ]; then
  96. ok=1; break
  97. fi
  98. echo "attempt $attempt failed (GitHub raw 504/throttle); backing off..."
  99. sleep $(( attempt * 5 + RANDOM % 6 ))
  100. done
  101. if [ "$ok" = 1 ]; then
  102. echo "✅ downloaded ccache once for all matrix jobs"
  103. else
  104. echo "::warning::custom ccache download failed; matrix jobs will fall back to the apt ccache"
  105. rm -f ccache
  106. fi
  107. echo "::endgroup::"
  108. - name: Upload ccache artifact
  109. if: false
  110. uses: actions/upload-artifact@v7
  111. with:
  112. name: ccache-binary
  113. path: ccache
  114. retention-days: 1
  115. if-no-files-found: warn
  116. resolve-sources:
  117. runs-on: ubuntu-latest
  118. outputs:
  119. nomount_commit: ${{ steps.resolve.outputs.nomount_commit }}
  120. kernelsu_commit: ${{ steps.resolve.outputs.kernelsu_commit }}
  121. kernelsu_branch: ${{ steps.resolve.outputs.kernelsu_branch }}
  122. root_flavor: ${{ steps.resolve.outputs.root_flavor }}
  123. root_commit: ${{ steps.resolve.outputs.root_commit }}
  124. susfs_commit_android12_5_10: ${{ steps.resolve.outputs.susfs_commit_android12_5_10 }}
  125. susfs_commit_android13_5_10: ${{ steps.resolve.outputs.susfs_commit_android13_5_10 }}
  126. susfs_commit_android13_5_15: ${{ steps.resolve.outputs.susfs_commit_android13_5_15 }}
  127. susfs_commit_android14_5_15: ${{ steps.resolve.outputs.susfs_commit_android14_5_15 }}
  128. susfs_commit_android14_6_1: ${{ steps.resolve.outputs.susfs_commit_android14_6_1 }}
  129. susfs_commit_android15_6_6: ${{ steps.resolve.outputs.susfs_commit_android15_6_6 }}
  130. susfs_commit_android16_6_12: ${{ steps.resolve.outputs.susfs_commit_android16_6_12 }}
  131. kernel_patches_commit: ${{ steps.resolve.outputs.kernel_patches_commit }}
  132. anykernel3_commit: ${{ steps.resolve.outputs.anykernel3_commit }}
  133. droidspaces_commit: ${{ steps.resolve.outputs.droidspaces_commit }}
  134. feature_set: ${{ steps.features.outputs.feature_set }}
  135. steps:
  136. - name: Resolve latest component commits
  137. id: resolve
  138. shell: bash
  139. run: |
  140. set -euo pipefail
  141. retry() {
  142. local n=0
  143. until [ "$n" -ge 5 ]; do
  144. "$@" && return 0
  145. n=$((n+1))
  146. echo "retry $n/5 failed for: $*" >&2
  147. sleep 5
  148. done
  149. return 1
  150. }
  151. resolve_sha() { # repo ref
  152. retry git ls-remote "$1" "$2" | awk '{print $1; exit}'
  153. }
  154. emit() { # key value
  155. if [ -z "$2" ] || ! [[ "$2" =~ ^[0-9a-f]{40}$ ]]; then
  156. echo "Failed to resolve $1 (got: ${2:-empty})" >&2
  157. exit 1
  158. fi
  159. echo "$1=$2" >> "$GITHUB_OUTPUT"
  160. }
  161. # NoMount (dev tip)
  162. emit nomount_commit "$(resolve_sha https://github.com/maxsteeel/nomount.git refs/heads/dev)"
  163. # KernelSU-Next (pershoot dev-susfs; fall back to official dev for the manager)
  164. KSU_INPUT="dev-susfs"
  165. KSU_REF="refs/heads/$KSU_INPUT"
  166. if ! retry git ls-remote --heads https://github.com/KernelSU-Next/KernelSU-Next.git "$KSU_INPUT" | grep -q .; then
  167. # Treat the input as an official-dev commit SHA when it's not a fork branch
  168. official_sha="$(resolve_sha https://github.com/KernelSU-Next/KernelSU-Next.git refs/heads/dev)"
  169. emit kernelsu_commit "$official_sha"
  170. emit kernelsu_branch "dev"
  171. else
  172. emit kernelsu_commit "$(resolve_sha https://github.com/KernelSU-Next/KernelSU-Next.git "$KSU_REF")"
  173. emit kernelsu_branch "$KSU_INPUT"
  174. fi
  175. # Selected root implementation at its branch tip. Maps the human-facing
  176. # choice (KernelSU-Next / KernelSU / ReSukiSU) to the internal root-setup
  177. # flavor (next / classic / resukisu). 'none' leaves both empty so build.yml
  178. # falls back to its legacy KernelSU-Next path.
  179. case "${{ inputs.root_flavor }}" in
  180. KernelSU)
  181. emit root_flavor "classic"
  182. emit root_commit "$(resolve_sha https://github.com/tiann/KernelSU.git refs/heads/main)"
  183. ;;
  184. KernelSU-Next)
  185. emit root_flavor "next"
  186. if [ "${{ inputs.use_susfs }}" = "true" ]; then
  187. # SUSFS on: kernel source from pershoot's dev-susfs fork
  188. emit root_commit "$(resolve_sha https://github.com/pershoot/KernelSU-Next.git refs/heads/dev-susfs)"
  189. else
  190. # SUSFS off: plain KernelSU-Next official dev
  191. emit root_commit "$(resolve_sha https://github.com/KernelSU-Next/KernelSU-Next.git refs/heads/dev)"
  192. fi
  193. ;;
  194. ReSukiSU)
  195. emit root_flavor "resukisu"
  196. emit root_commit "$(resolve_sha https://github.com/ReSukiSU/ReSukiSU.git refs/heads/main)"
  197. ;;
  198. *)
  199. echo "root_flavor=" >> "$GITHUB_OUTPUT"
  200. echo "root_commit=" >> "$GITHUB_OUTPUT"
  201. ;;
  202. esac
  203. # SUSFS per supported Android/kernel branch (gitlab simonpunk/susfs4ksu)
  204. declare -A SUSFS_BRANCHES=(
  205. [susfs_commit_android12_5_10]="gki-android12-5.10"
  206. [susfs_commit_android13_5_10]="gki-android13-5.10"
  207. [susfs_commit_android13_5_15]="gki-android13-5.15"
  208. [susfs_commit_android14_5_15]="gki-android14-5.15"
  209. [susfs_commit_android14_6_1]="gki-android14-6.1"
  210. [susfs_commit_android15_6_6]="gki-android15-6.6"
  211. [susfs_commit_android16_6_12]="gki-android16-6.12"
  212. )
  213. for key in "${!SUSFS_BRANCHES[@]}"; do
  214. emit "$key" "$(resolve_sha https://gitlab.com/simonpunk/susfs4ksu.git refs/heads/${SUSFS_BRANCHES[$key]})"
  215. done
  216. # Tracked build helpers (resolved automatically, before the run)
  217. emit kernel_patches_commit "$(resolve_sha https://github.com/WildKernels/kernel_patches.git refs/heads/main)"
  218. emit anykernel3_commit "$(resolve_sha https://github.com/WildKernels/AnyKernel3.git refs/heads/gki-2.0)"
  219. emit droidspaces_commit "$(resolve_sha https://github.com/ravindu644/Droidspaces-OSS.git refs/heads/main)"
  220. echo "Resolved:"
  221. env | grep -E '^(nomount_commit|kernelsu_commit|kernelsu_branch|root_commit|susfs_commit_|kernel_patches_commit|anykernel3_commit|droidspaces_commit)' | sort
  222. - name: Compose requested feature set
  223. id: features
  224. shell: bash
  225. run: |
  226. set -euo pipefail
  227. # SUSFS needs a root implementation (KernelSU / KernelSU-Next / ReSukiSU)
  228. # to hook into. Without one the kernel wouldn't actually exercise the
  229. # SUSFS root-hiding patches, so fail fast instead of building a useless kernel.
  230. if [ "${{ inputs.use_susfs }}" = "true" ] && [ "${{ inputs.root_flavor }}" = "none" ]; then
  231. echo "ERROR: SUSFS requires a root implementation, but root_flavor is 'none'." >&2
  232. echo "Pick KernelSU-Next, KernelSU, or ReSukiSU in the Root Implementation box" >&2
  233. echo "(SUSFS patches SUSFS's root-hiding on top of the root solution)." >&2
  234. exit 1
  235. fi
  236. FEATURES=""
  237. [ "${{ inputs.use_susfs }}" = "true" ] && FEATURES="${FEATURES}SUSFS+"
  238. [ "${{ inputs.use_nomount }}" = "true" ] && FEATURES="${FEATURES}NoMount+"
  239. [ "${{ inputs.use_bbg }}" = "true" ] && FEATURES="${FEATURES}BBG+"
  240. [ "${{ inputs.use_net }}" = "true" ] && FEATURES="${FEATURES}NET+"
  241. [ "${{ inputs.use_ds }}" = "true" ] && FEATURES="${FEATURES}DS+"
  242. [ "${{ inputs.use_ntsync }}" = "true" ] && FEATURES="${FEATURES}NTSync+"
  243. [ "${{ inputs.use_ptrace }}" = "true" ] && FEATURES="${FEATURES}Ptrace+"
  244. [ "${{ inputs.use_unicode }}" = "true" ] && FEATURES="${FEATURES}Unicode+"
  245. [ "${{ inputs.use_bpf }}" = "true" ] && FEATURES="${FEATURES}BPF+"
  246. [ "${{ inputs.use_perf }}" = "true" ] && FEATURES="${FEATURES}Perf+"
  247. echo "feature_set=${FEATURES%+}" >> "$GITHUB_OUTPUT"
  248. - name: Clone shared source repos once
  249. if: ${{ inputs.use_nomount }}
  250. shell: bash
  251. run: |
  252. set -euo pipefail
  253. mkdir -p sources
  254. # NoMount kernel sources at the resolved dev tip
  255. git clone --depth=1 --branch dev https://github.com/maxsteeel/nomount.git sources/nomount
  256. [ "$(git -C sources/nomount rev-parse HEAD)" = "${{ steps.resolve.outputs.nomount_commit }}" ] || \
  257. { echo "NoMount clone HEAD mismatch" >&2; exit 1; }
  258. echo "sources_dir=$PWD/sources" >> "$GITHUB_ENV"
  259. - name: Upload sources artifact
  260. if: ${{ inputs.use_nomount }}
  261. uses: actions/upload-artifact@v7
  262. with:
  263. name: sources
  264. path: sources
  265. retention-days: 1
  266. if-no-files-found: error
  267. compression-level: 9
  268. build-nomount-module:
  269. needs: resolve-sources
  270. runs-on: ubuntu-latest
  271. steps:
  272. - uses: actions/checkout@v7
  273. if: ${{ inputs.use_nomount }}
  274. - name: Build NoMount metamodule
  275. id: nomount-metamodule
  276. if: ${{ inputs.use_nomount }}
  277. uses: ./.github/actions/nomount-metamodule
  278. with:
  279. commit: ${{ needs.resolve-sources.outputs.nomount_commit }}
  280. - name: Upload NoMount metamodule
  281. if: ${{ inputs.use_nomount }}
  282. uses: actions/upload-artifact@v7
  283. with:
  284. name: NoMount-Metamodule
  285. path: ${{ steps.nomount-metamodule.outputs.module_path }}
  286. if-no-files-found: error
  287. compression-level: 0
  288. build-fuse-bpf:
  289. needs: resolve-sources
  290. runs-on: ubuntu-latest
  291. steps:
  292. - uses: actions/checkout@v7
  293. if: ${{ inputs.use_bpf }}
  294. - name: Sparse-checkout FUSE-BPF source from kernel/common (android16-6.12-lts)
  295. if: ${{ inputs.use_bpf }}
  296. shell: bash
  297. run: |
  298. set -euo pipefail
  299. # Only the daemon source + the headers it compiles against are needed,
  300. # NOT the full ~16GB kernel tree (which includes ~12GB of prebuilts).
  301. git clone --depth 1 --filter=blob:none --sparse \
  302. --branch android16-6.12-lts \
  303. https://android.googlesource.com/kernel/common \
  304. "${{ github.workspace }}/kernel/common"
  305. cd "${{ github.workspace }}/kernel/common"
  306. git sparse-checkout set \
  307. tools/testing/selftests/filesystems/fuse \
  308. include \
  309. arch/arm64/include \
  310. tools/testing/selftests
  311. - name: Build FUSE-BPF Userspace Daemon (Issue #211)
  312. if: ${{ inputs.use_bpf }}
  313. uses: ./.github/actions/fuse-bpf
  314. with:
  315. version: android16-6.12
  316. kernel_version: 6.12
  317. android_version: android16
  318. build-android12-5-10:
  319. needs:
  320. - prepare-ccache
  321. - resolve-sources
  322. if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android12-5.10') }}
  323. uses: ./.github/workflows/prepare.yml
  324. with:
  325. config_file: .github/config/android12-5.10.json
  326. feature_set: ${{ needs.resolve-sources.outputs.feature_set }}
  327. susfs_commit: ${{ needs.resolve-sources.outputs.susfs_commit_android12_5_10 }}
  328. nomount_commit: ${{ needs.resolve-sources.outputs.nomount_commit }}
  329. kernel_patches_commit: ${{ needs.resolve-sources.outputs.kernel_patches_commit }}
  330. root_flavor: ${{ needs.resolve-sources.outputs.root_flavor }}
  331. root_commit: ${{ needs.resolve-sources.outputs.root_commit }}
  332. anykernel3_commit: ${{ needs.resolve-sources.outputs.anykernel3_commit }}
  333. droidspaces_commit: ${{ needs.resolve-sources.outputs.droidspaces_commit }}
  334. brand_name: ${{ inputs.brand_name }}
  335. secrets: inherit
  336. build-android13-5-10:
  337. needs:
  338. - prepare-ccache
  339. - resolve-sources
  340. if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android13-5.10') }}
  341. uses: ./.github/workflows/prepare.yml
  342. with:
  343. config_file: .github/config/android13-5.10.json
  344. feature_set: ${{ needs.resolve-sources.outputs.feature_set }}
  345. susfs_commit: ${{ needs.resolve-sources.outputs.susfs_commit_android13_5_10 }}
  346. nomount_commit: ${{ needs.resolve-sources.outputs.nomount_commit }}
  347. kernel_patches_commit: ${{ needs.resolve-sources.outputs.kernel_patches_commit }}
  348. root_flavor: ${{ needs.resolve-sources.outputs.root_flavor }}
  349. root_commit: ${{ needs.resolve-sources.outputs.root_commit }}
  350. anykernel3_commit: ${{ needs.resolve-sources.outputs.anykernel3_commit }}
  351. droidspaces_commit: ${{ needs.resolve-sources.outputs.droidspaces_commit }}
  352. brand_name: ${{ inputs.brand_name }}
  353. secrets: inherit
  354. build-android13-5-15:
  355. needs:
  356. - prepare-ccache
  357. - resolve-sources
  358. if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android13-5.15') }}
  359. uses: ./.github/workflows/prepare.yml
  360. with:
  361. config_file: .github/config/android13-5.15.json
  362. feature_set: ${{ needs.resolve-sources.outputs.feature_set }}
  363. susfs_commit: ${{ needs.resolve-sources.outputs.susfs_commit_android13_5_15 }}
  364. nomount_commit: ${{ needs.resolve-sources.outputs.nomount_commit }}
  365. kernel_patches_commit: ${{ needs.resolve-sources.outputs.kernel_patches_commit }}
  366. root_flavor: ${{ needs.resolve-sources.outputs.root_flavor }}
  367. root_commit: ${{ needs.resolve-sources.outputs.root_commit }}
  368. anykernel3_commit: ${{ needs.resolve-sources.outputs.anykernel3_commit }}
  369. droidspaces_commit: ${{ needs.resolve-sources.outputs.droidspaces_commit }}
  370. brand_name: ${{ inputs.brand_name }}
  371. secrets: inherit
  372. build-android14-5-15:
  373. needs:
  374. - prepare-ccache
  375. - resolve-sources
  376. if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android14-5.15') }}
  377. uses: ./.github/workflows/prepare.yml
  378. with:
  379. config_file: .github/config/android14-5.15.json
  380. feature_set: ${{ needs.resolve-sources.outputs.feature_set }}
  381. susfs_commit: ${{ needs.resolve-sources.outputs.susfs_commit_android14_5_15 }}
  382. nomount_commit: ${{ needs.resolve-sources.outputs.nomount_commit }}
  383. kernel_patches_commit: ${{ needs.resolve-sources.outputs.kernel_patches_commit }}
  384. root_flavor: ${{ needs.resolve-sources.outputs.root_flavor }}
  385. root_commit: ${{ needs.resolve-sources.outputs.root_commit }}
  386. anykernel3_commit: ${{ needs.resolve-sources.outputs.anykernel3_commit }}
  387. droidspaces_commit: ${{ needs.resolve-sources.outputs.droidspaces_commit }}
  388. brand_name: ${{ inputs.brand_name }}
  389. secrets: inherit
  390. build-android14-6-1:
  391. needs:
  392. - prepare-ccache
  393. - resolve-sources
  394. if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android14-6.1') }}
  395. uses: ./.github/workflows/prepare.yml
  396. with:
  397. config_file: .github/config/android14-6.1.json
  398. feature_set: ${{ needs.resolve-sources.outputs.feature_set }}
  399. susfs_commit: ${{ needs.resolve-sources.outputs.susfs_commit_android14_6_1 }}
  400. nomount_commit: ${{ needs.resolve-sources.outputs.nomount_commit }}
  401. kernel_patches_commit: ${{ needs.resolve-sources.outputs.kernel_patches_commit }}
  402. root_flavor: ${{ needs.resolve-sources.outputs.root_flavor }}
  403. root_commit: ${{ needs.resolve-sources.outputs.root_commit }}
  404. anykernel3_commit: ${{ needs.resolve-sources.outputs.anykernel3_commit }}
  405. droidspaces_commit: ${{ needs.resolve-sources.outputs.droidspaces_commit }}
  406. brand_name: ${{ inputs.brand_name }}
  407. secrets: inherit
  408. build-android15-6-6:
  409. needs:
  410. - prepare-ccache
  411. - resolve-sources
  412. if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android15-6.6') }}
  413. uses: ./.github/workflows/prepare.yml
  414. with:
  415. config_file: .github/config/android15-6.6.json
  416. feature_set: ${{ needs.resolve-sources.outputs.feature_set }}
  417. susfs_commit: ${{ needs.resolve-sources.outputs.susfs_commit_android15_6_6 }}
  418. nomount_commit: ${{ needs.resolve-sources.outputs.nomount_commit }}
  419. kernel_patches_commit: ${{ needs.resolve-sources.outputs.kernel_patches_commit }}
  420. root_flavor: ${{ needs.resolve-sources.outputs.root_flavor }}
  421. root_commit: ${{ needs.resolve-sources.outputs.root_commit }}
  422. anykernel3_commit: ${{ needs.resolve-sources.outputs.anykernel3_commit }}
  423. droidspaces_commit: ${{ needs.resolve-sources.outputs.droidspaces_commit }}
  424. brand_name: ${{ inputs.brand_name }}
  425. secrets: inherit
  426. build-android16-6-12:
  427. needs:
  428. - prepare-ccache
  429. - resolve-sources
  430. if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android16-6.12') }}
  431. uses: ./.github/workflows/prepare.yml
  432. with:
  433. config_file: .github/config/android16-6.12.json
  434. feature_set: ${{ needs.resolve-sources.outputs.feature_set }}
  435. susfs_commit: ${{ needs.resolve-sources.outputs.susfs_commit_android16_6_12 }}
  436. nomount_commit: ${{ needs.resolve-sources.outputs.nomount_commit }}
  437. kernel_patches_commit: ${{ needs.resolve-sources.outputs.kernel_patches_commit }}
  438. root_flavor: ${{ needs.resolve-sources.outputs.root_flavor }}
  439. root_commit: ${{ needs.resolve-sources.outputs.root_commit }}
  440. anykernel3_commit: ${{ needs.resolve-sources.outputs.anykernel3_commit }}
  441. droidspaces_commit: ${{ needs.resolve-sources.outputs.droidspaces_commit }}
  442. brand_name: ${{ inputs.brand_name }}
  443. secrets: inherit
  444. rej:
  445. if: ${{ !inputs.test_release_notes && always() }}
  446. runs-on: ubuntu-latest
  447. permissions:
  448. actions: read
  449. contents: read
  450. needs:
  451. - build-android12-5-10
  452. - build-android13-5-10
  453. - build-android13-5-15
  454. - build-android14-5-15
  455. - build-android14-6-1
  456. - build-android15-6-6
  457. - build-android16-6-12
  458. steps:
  459. - name: Download Misc Artifacts
  460. uses: actions/download-artifact@v7
  461. with:
  462. path: ./downloaded-artifacts
  463. pattern: '*-Rejects'
  464. merge-multiple: false
  465. - name: Process Reject Artifacts
  466. run: |
  467. mkdir -p aio-rejects
  468. # Iterate over Rejects artifacts in downloaded-artifacts
  469. for dir in ./downloaded-artifacts/*-Rejects; do
  470. [ -d "$dir" ] || continue
  471. dirname=$(basename "$dir")
  472. original_name=${dirname%-Rejects}
  473. source_dir="$dir"
  474. if [ -d "$dir/patch-rejects" ]; then
  475. source_dir="$dir/patch-rejects"
  476. fi
  477. mapfile -t rej_files < <(find "$source_dir" -type f -name '*.rej' | sort)
  478. filtered_rej_files=()
  479. for rej_file in "${rej_files[@]}"; do
  480. rel_rej="${rej_file#${source_dir}/}"
  481. rel_name="$(basename "$rel_rej")"
  482. if [ "$rel_rej" = "common/mm/rmap.c.rej" ] || [ "$rel_name" = "i2c-nomadik.c.rej" ]; then
  483. echo "Skipping $rel_rej because it is an ignored reject file"
  484. continue
  485. fi
  486. filtered_rej_files+=("$rej_file")
  487. done
  488. if [ "${#filtered_rej_files[@]}" -eq 0 ]; then
  489. echo "Skipping $dirname because it only contains ignored reject files"
  490. continue
  491. fi
  492. mkdir -p "aio-rejects/$original_name"
  493. if [ -d "$dir/patch-rejects" ]; then
  494. cp -r "$dir/patch-rejects/." "aio-rejects/$original_name/"
  495. else
  496. cp -r "$dir/." "aio-rejects/$original_name/"
  497. fi
  498. find "aio-rejects/$original_name" -type f -name 'i2c-nomadik.c.rej' -delete
  499. done
  500. if [ "$(ls -A aio-rejects)" ]; then
  501. cd aio-rejects
  502. zip -r -q -9 ../AIO-REJ.zip .
  503. cd ..
  504. else
  505. echo "No rejects found to upload."
  506. fi
  507. - name: Rejects Summary
  508. run: |
  509. echo "Reject artifacts were collected locally only and are not uploaded." >> "$GITHUB_STEP_SUMMARY"
  510. - name: Upload AIO-REJ Artifact
  511. uses: actions/upload-artifact@v7
  512. with:
  513. name: AIO-REJ
  514. path: AIO-REJ.zip
  515. if-no-files-found: ignore
  516. summary:
  517. if: ${{ !inputs.test_release_notes && always() }}
  518. runs-on: ubuntu-latest
  519. permissions:
  520. actions: write
  521. contents: read
  522. needs:
  523. - resolve-sources
  524. - build-android12-5-10
  525. - build-android13-5-10
  526. - build-android13-5-15
  527. - build-android14-5-15
  528. - build-android14-6-1
  529. - build-android15-6-6
  530. - build-android16-6-12
  531. steps:
  532. - name: Download All Build Summaries
  533. uses: actions/download-artifact@v7
  534. with:
  535. path: ./summaries
  536. pattern: '*-Summary'
  537. merge-multiple: true
  538. - name: 📋 Workflow Build Summary
  539. run: |
  540. {
  541. echo "# 📋 Build Summary — $(date -u '+%Y-%m-%d %H:%M UTC')"
  542. echo
  543. echo "**Feature Set:** ${{ needs.resolve-sources.outputs.feature_set }}"
  544. echo "**Root Flavor:** ${{ inputs.root_flavor || 'none' }}"
  545. echo "**Brand:** ${{ inputs.brand_name || 'Wild' }}"
  546. echo
  547. # Count successes and failures
  548. SUCCESS_COUNT=0
  549. FAIL_COUNT=0
  550. # Sort summaries so they appear in a consistent order
  551. for f in ./summaries/*.md; do
  552. [ -f "$f" ] || continue
  553. if grep -q "✅ Success" "$f"; then
  554. SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
  555. else
  556. FAIL_COUNT=$((FAIL_COUNT + 1))
  557. fi
  558. done
  559. TOTAL=$((SUCCESS_COUNT + FAIL_COUNT))
  560. echo "**Results:** ${SUCCESS_COUNT}/${TOTAL} succeeded"
  561. if [ "$FAIL_COUNT" -gt 0 ]; then
  562. echo " - ❌ ${FAIL_COUNT} failed"
  563. fi
  564. echo
  565. echo "---"
  566. echo
  567. # Output each summary
  568. for f in ./summaries/*.md; do
  569. [ -f "$f" ] || continue
  570. cat "$f"
  571. echo
  572. echo "---"
  573. echo
  574. done
  575. echo
  576. echo "> **SUSFS Commits:**"
  577. echo "> - android12-5.10: ${{ needs.resolve-sources.outputs.susfs_commit_android12_5_10 }}"
  578. echo "> - android13-5.10: ${{ needs.resolve-sources.outputs.susfs_commit_android13_5_10 }}"
  579. echo "> - android13-5.15: ${{ needs.resolve-sources.outputs.susfs_commit_android13_5_15 }}"
  580. echo "> - android14-5.15: ${{ needs.resolve-sources.outputs.susfs_commit_android14_5_15 }}"
  581. echo "> - android14-6.1: ${{ needs.resolve-sources.outputs.susfs_commit_android14_6_1 }}"
  582. echo "> - android15-6.6: ${{ needs.resolve-sources.outputs.susfs_commit_android15_6_6 }}"
  583. echo "> - android16-6.12: ${{ needs.resolve-sources.outputs.susfs_commit_android16_6_12 }}"
  584. } >> "$GITHUB_STEP_SUMMARY"
  585. - name: 🧹 Cleanup Summary Files
  586. if: ${{ always() }}
  587. run: rm -rf ./summaries
  588. - name: 🧹 Delete Summary Artifacts
  589. if: ${{ always() }}
  590. env:
  591. GH_TOKEN: ${{ github.token }}
  592. run: |
  593. # Delete all *-Summary artifacts from this run since they're now consolidated
  594. RUN_ID="${{ github.run_id }}"
  595. ARTIFACTS=$(gh api "repos/${{ github.repository }}/actions/runs/${RUN_ID}/artifacts" --jq '.artifacts[] | select(.name | endswith("-Summary")) | .id')
  596. for id in $ARTIFACTS; do
  597. echo "Deleting summary artifact id=$id"
  598. gh api -X DELETE "repos/${{ github.repository }}/actions/artifacts/${id}" || true
  599. done
  600. release:
  601. runs-on: ubuntu-latest
  602. if: ${{ github.event_name == 'workflow_dispatch' && !inputs.test_release_notes && (inputs.release_type == 'Pre-Release' || inputs.release_type == 'Release') }}
  603. permissions:
  604. contents: write
  605. needs:
  606. - build-android12-5-10
  607. - build-android13-5-10
  608. - build-android13-5-15
  609. - build-android14-5-15
  610. - build-android14-6-1
  611. - build-android15-6-6
  612. - build-android16-6-12
  613. - build-nomount-module
  614. env:
  615. GH_TOKEN: ${{ github.token }}
  616. RELEASE_NOTES: .github/config/RELEASE_NOTES.md
  617. outputs:
  618. new_tag: ${{ steps.tag.outputs.new_tag }}
  619. steps:
  620. - name: Validate Selected Builds
  621. run: |
  622. set -euo pipefail
  623. failed=0
  624. current_type="${{ inputs.kernel_build_version }}"
  625. check_selected() {
  626. local target="$1"
  627. local job_name="$2"
  628. local result="$3"
  629. if [[ "$current_type" == "all" || "$current_type" == "$target" ]]; then
  630. if [[ "$result" != "success" ]]; then
  631. echo "Required job $job_name did not succeed (result: $result)"
  632. failed=1
  633. fi
  634. fi
  635. }
  636. check_selected "android12-5.10" "build-android12-5-10" "${{ needs.build-android12-5-10.result }}"
  637. check_selected "android13-5.10" "build-android13-5-10" "${{ needs.build-android13-5-10.result }}"
  638. check_selected "android13-5.15" "build-android13-5-15" "${{ needs.build-android13-5-15.result }}"
  639. check_selected "android14-5.15" "build-android14-5-15" "${{ needs.build-android14-5-15.result }}"
  640. check_selected "android14-6.1" "build-android14-6-1" "${{ needs.build-android14-6-1.result }}"
  641. check_selected "android15-6.6" "build-android15-6-6" "${{ needs.build-android15-6-6.result }}"
  642. check_selected "android16-6.12" "build-android16-6-12" "${{ needs.build-android16-6-12.result }}"
  643. if [[ "$failed" -ne 0 ]]; then
  644. exit 1
  645. fi
  646. - name: Free Disk Space
  647. if: true
  648. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  649. with:
  650. remove_android: true
  651. remove_dotnet: true
  652. remove_haskell: true
  653. remove_tool_cache: true
  654. remove_swap: true
  655. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  656. remove_packages_one_command: true
  657. 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"
  658. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  659. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  660. testing: false
  661. - name: Checkout code
  662. uses: actions/checkout@v7
  663. - name: Generate New Tag
  664. id: tag
  665. if: inputs.release_type != 'Action'
  666. run: |
  667. mapfile -t RELEASE_TAGS < <(gh api --paginate "repos/${{ github.repository }}/tags?per_page=100" --jq '.[].name' 2>/dev/null | grep -E '^r[0-9]+$' || true)
  668. LATEST_REV=0
  669. for TAG in "${RELEASE_TAGS[@]}"; do
  670. REV="${TAG#r}"
  671. if [[ "$REV" =~ ^[0-9]+$ && "$REV" -gt "$LATEST_REV" ]]; then
  672. LATEST_REV="$REV"
  673. fi
  674. done
  675. if [[ "$LATEST_REV" -gt 0 ]]; then
  676. NEW_TAG="r$((LATEST_REV + 1))"
  677. else
  678. NEW_TAG="r1"
  679. fi
  680. if [[ ${#RELEASE_TAGS[@]} -gt 0 ]]; then
  681. echo "Latest r-tag: r${LATEST_REV}"
  682. else
  683. echo "No existing r-tags found; starting at r1"
  684. fi
  685. echo "New tag: $NEW_TAG"
  686. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  687. echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
  688. - name: Set Release Title
  689. id: release_meta
  690. run: |
  691. set -euo pipefail
  692. # Format release title: convert rN -> Release N
  693. if [[ "${NEW_TAG}" =~ ^r([0-9]+)$ ]]; then
  694. REV_NUM="${BASH_REMATCH[1]}"
  695. release_title="Release ${REV_NUM}"
  696. else
  697. release_title="Release ${NEW_TAG}"
  698. fi
  699. echo "release_title=$release_title" >> "$GITHUB_OUTPUT"
  700. - name: Extract KernelSU Version Info
  701. id: ksu_version
  702. run: |
  703. set -euo pipefail
  704. KSU_REPO="https://github.com/pershoot/KernelSU-Next.git"
  705. KSU_INPUT="dev-susfs"
  706. # Try as branch first, fall back to commit
  707. if git ls-remote --heads "$KSU_REPO" "$KSU_INPUT" | grep -q .; then
  708. echo "Cloning KernelSU-Next from branch: $KSU_INPUT"
  709. git clone --branch "$KSU_INPUT" "$KSU_REPO" /tmp/kernelsu-next
  710. cd /tmp/kernelsu-next
  711. KSUN_COMMIT=$(git rev-parse HEAD)
  712. else
  713. echo "Cloning KernelSU-Next from dev-susfs branch, then checking out commit: $KSU_INPUT"
  714. git clone --branch dev-susfs "$KSU_REPO" /tmp/kernelsu-next
  715. cd /tmp/kernelsu-next
  716. git fetch --depth=50 origin "$KSU_INPUT"
  717. git checkout "$KSU_INPUT"
  718. KSUN_COMMIT="$KSU_INPUT"
  719. fi
  720. # The manager is built on the OFFICIAL KernelSU-Next repo
  721. # (pershoot's workflows are all disabled). Find the official dev
  722. # commit this fork's branch is synced with (merge-base of our
  723. # branch vs official dev), then link the manager build run for
  724. # that commit. pershoot's own dev branch is intentionally ignored.
  725. retry() {
  726. local n=0
  727. until [ "$n" -ge 5 ]; do
  728. "$@" && return 0
  729. n=$((n+1))
  730. echo "retry $n/5 failed for: $*" >&2
  731. sleep 5
  732. done
  733. return 1
  734. }
  735. OFFICIAL_KSU_REPO="https://github.com/KernelSU-Next/KernelSU-Next.git"
  736. retry git fetch "$OFFICIAL_KSU_REPO" dev
  737. STOCK_COMMIT=$(git merge-base HEAD FETCH_HEAD)
  738. echo "KSU Stock Commit (official sync point): $STOCK_COMMIT"
  739. # Extract version info — anchored to the official sync point
  740. # (STOCK_COMMIT), i.e. the commit the linked manager is built from.
  741. # Mirrors pershoot c0a2c5fd: count the merge-base with origin, not
  742. # the fork's extra commits, so the version shown in the release
  743. # notes matches what the kernel reports and the manager displays.
  744. COMMITS_COUNT=$(git rev-list --count "$STOCK_COMMIT")
  745. BASE_VERSION=30000
  746. KSU_VERSION=$(expr $COMMITS_COUNT "+" $BASE_VERSION)
  747. # Extract git tag at the sync point
  748. KSU_GIT_TAG=$(git describe --tags --abbrev=0 "$STOCK_COMMIT" 2>/dev/null || echo "no-tag")
  749. MANAGER_RUN_ID=$(curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors "https://api.github.com/repos/KernelSU-Next/KernelSU-Next/actions/workflows/build-manager-ci.yml/runs?head_sha=${STOCK_COMMIT}" | jq -r '.workflow_runs[0].id // empty')
  750. if [[ -n "${MANAGER_RUN_ID:-}" ]]; then
  751. KSU_MANAGER="https://github.com/KernelSU-Next/KernelSU-Next/actions/runs/${MANAGER_RUN_ID}"
  752. else
  753. KSU_MANAGER="https://github.com/KernelSU-Next/KernelSU-Next/actions/workflows/build-manager-ci.yml"
  754. fi
  755. echo "Commits count: $COMMITS_COUNT"
  756. echo "KSU Version: $KSU_VERSION"
  757. echo "KSU Git Tag: $KSU_GIT_TAG"
  758. echo "KSU Manager: $KSU_MANAGER"
  759. # Export as environment for next step
  760. echo "KSUN_BRANCH=$KSU_INPUT" >> $GITHUB_ENV
  761. echo "KSUN_COMMIT=$KSUN_COMMIT" >> $GITHUB_ENV
  762. echo "KSU_COMMITS_COUNT=$COMMITS_COUNT" >> $GITHUB_ENV
  763. echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
  764. echo "KSU_GIT_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
  765. echo "KSU_MANAGER=$KSU_MANAGER" >> $GITHUB_ENV
  766. - name: Set release body
  767. run: |
  768. set -e
  769. RELEASE_NOTES_PATH="$RELEASE_NOTES"
  770. : > release_body.md
  771. python3 .github/scripts/render_release_body.py "$RELEASE_NOTES_PATH" > release_body.md
  772. - name: Publish release notes preview
  773. run: |
  774. {
  775. echo "## Release Notes Preview"
  776. echo
  777. cat release_body.md
  778. } >> "$GITHUB_STEP_SUMMARY"
  779. - name: Download AnyKernel3 Artifacts
  780. uses: actions/download-artifact@v7
  781. with:
  782. path: release-assets
  783. pattern: '*-AnyKernel3'
  784. merge-multiple: false
  785. - name: Download NoMount metamodule
  786. uses: actions/download-artifact@v7
  787. with:
  788. path: release-assets
  789. pattern: '*NoMount-Metamodule'
  790. merge-multiple: false
  791. if-no-files-found: ignore
  792. - name: Zip AnyKernel3 for Release
  793. run: |
  794. set -e
  795. shopt -s nullglob
  796. for dir in release-assets/*-AnyKernel3; do
  797. zip_name="${dir}.zip"
  798. rm -f "$zip_name"
  799. cd "$dir"
  800. zip -r -q -9 "../$(basename "$zip_name")" .
  801. cd - >/dev/null
  802. done
  803. - name: Create Release
  804. uses: softprops/action-gh-release@v1
  805. with:
  806. tag_name: ${{ steps.tag.outputs.new_tag }}
  807. name: ${{ steps.release_meta.outputs.release_title }}
  808. body_path: release_body.md
  809. draft: false
  810. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  811. files: |
  812. release-assets/**/*.zip
  813. release-assets/**/*-boot*.img