[Miscellaneous Android Development] lemniskett:
Android Kernel Actions - Easily Create an Environment and Build Android Kernels With GitHub Action

​

"GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want." - GitHub.

Well basically, GitHub Action gives you some computing power for building and testing your code. The good thing is, this is FREE! So I though It's a good idea to build kernels with it. No need to let your computer using 100% CPU Usage for a long time, no need to rent a VPS or using cloud provider services like AWS, GCP, etc.

How does this script works? Pretty simple. It launches an Ubuntu container in GitHub Action, Installs necessary packages based on your toolchain preferences, sets environment variables, builds your kernel and zips it with AnyKernel3 (If template provided).

Available toolchains :

GCC from Ubuntu repository

Clang from Ubuntu repository (with or without GNU's binutils)

Proton Clang (with or without GNU's binutils)

AOSP's Clang (with or without GNU's binutils)

Feel free to request another source of toolchain. :)

Toolchain strings

NOTE: If you want to compile with Clang and LLVM without any of GNU's binutils, make sure your kernel source already supports LLVM options, otherwise compilation may fails or it will not use LLVM utils. In that case, use clang toolchain with GNU's binutils.

Instructions

​

1) You need to host your kernel source in GitHub and optionally your modified AnyKernel3 template in GitHub

View attachment 5354711​

2) Create a .yml file in .github/workflows:

NOTE: This is a YAML-formatted file, which means indentation matters. I won't explain this example code in detail, refer to GitHub Action documentation.

Example code:

name: "Build Dark Ages kernel on darky." # Description of the workflow.
on:
push:
branches: darky # Branch to build.
workflow_dispatch: # Allow to manually trigger workflow.
jobs:
build:
name: "Build Dark Ages kernel"
runs-on: ubuntu-latest
steps:
- name: "Checkout kernel source" # Clone the kernel source.
uses: actions/checkout@v2
- name: "Checkout zipper" # (OPTIONAL) Clone the AnyKernel3 template.
uses: actions/checkout@v2
with:
repository: lemniskett/AnyKernel3 # Your own AnyKernel3 repository.
path: zipper # Clone to path "zipper", REQUIRED.
- name: "Android kernel build" # Build kernel with lemniskett/android-kernel-actions.
uses: lemniskett/android-kernel-actions@master
with:
arch: arm64 # Specify arch
compiler: gcc/9 # Specify toolchain to use
defconfig: vince_defconfig # Specify defconfig to use
image: Image.gz-dtb # Specify final build file

View attachment 5354739​

3) Then, start committing the file, the build should starts right after you commit the file. if not, check on.push.branches in the yml file.

View attachment 5354757

View attachment 5354759​

Q: Now, how do I get the final build file?

A: You can use other action such as ncipollo/release-action or appleboy/telegram-action to upload the file, Example usage is available in README.md and build-yml

Q: Something is missing in the environment, can you add it?

A: Sure, just open an issue in the repo

Source: https://github.com/lemniskett/android-kernel-actions

Questions, Comments, Feedbacks are welcome.