Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.

Commit a0aaaa2

Browse files
committed
kernel_auto_builder: laurel_sprout: introduce auto building for laurel_sprout
Signed-off-by: Onelots <onelots@onelots.fr>
1 parent 4730dcf commit a0aaaa2

3 files changed

Lines changed: 192 additions & 0 deletions

File tree

.github/webhook.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import os
2+
import requests
3+
import datetime
4+
5+
DISCORD_WEBHOOK = os.environ["WEBHOOK"]
6+
release_url = "https://github.com/Oneloutre/kernel_auto_builder/releases/tag/latest"
7+
codename = os.environ["DEVICE_CODENAME"]
8+
kernel_version = os.environ["KERNEL_VERSION"]
9+
zip_name = os.environ["NAME"]
10+
embed_color = 0x2ecc71
11+
12+
embed = {
13+
"type": "rich",
14+
"username": "Kramel Slave",
15+
"embeds": [
16+
{
17+
"title": f"🚀 Build succeeded !",
18+
"url": release_url,
19+
"description": f"The KernelSU-Next build for **{codename}** is done !\n🎯 **Version :** `{kernel_version}`\n💡 **Name :** `{zip_name}`",
20+
"color": f"{embed_color}",
21+
"fields": [
22+
{
23+
"name": "📥 Download",
24+
"value": f"[Click here to go to the download page]({release_url})",
25+
"inline": False
26+
},
27+
{
28+
"name": "📅 Date",
29+
"value": f"{datetime.datetime.now().strftime('%d/%m/%Y %H:%M:%S')}",
30+
"inline": True
31+
}
32+
],
33+
"footer": {
34+
"text": "Automated build • GitHub Actions",
35+
"icon_url": "https://cdn-icons-png.flaticon.com/512/733/733609.png"
36+
}
37+
}
38+
]
39+
}
40+
41+
response = requests.post(DISCORD_WEBHOOK, json=embed)
42+
if response.status_code == 204:
43+
print("✅ Notification sent on Discord !")
44+
else:
45+
print(f"❌ Error ({response.status_code}) : {response.text}")
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Build Android Kernel then ship it in an AnyKernel3 flashable zip
2+
3+
on:
4+
push:
5+
branches:
6+
- laurel_sprout
7+
pull_request:
8+
branches:
9+
- laurel_sprout
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-22.04
15+
16+
steps:
17+
- name: ⚡ Checkout kernel's sourcecode and clone submodules
18+
uses: actions/checkout@v4
19+
20+
- name: 📅 Export date of build
21+
run: |
22+
echo "DATE=$(date +%d%m%Y)" >> $GITHUB_ENV
23+
24+
- name: 🔄 Update KernelSU-Next
25+
run: |
26+
rm -rf KernelSU-Next
27+
git clone https://github.com/KernelSU-Next/KernelSU-Next
28+
29+
- name: 📥 Clone AnyKernel3
30+
run: |
31+
git clone -b laurel_sprout https://github.com/Oneloutre/AnyKernel3.git anykernel
32+
rm -rf anykernel/.git
33+
34+
- name: 📦 Install dépendencies
35+
run: |
36+
sudo apt-get update -y -qq
37+
sudo apt-get install -y --no-install-recommends \
38+
python3-pip \
39+
git \
40+
zip \
41+
unzip \
42+
gcc \
43+
g++ \
44+
make \
45+
ninja-build \
46+
file \
47+
bc \
48+
bison \
49+
flex \
50+
libfl-dev \
51+
libssl-dev \
52+
libelf-dev \
53+
wget \
54+
build-essential \
55+
python3-dev \
56+
python3-setuptools \
57+
rsync \
58+
ccache \
59+
llvm-dev
60+
sudo apt install flex libncurses6 libncurses5 binutils-aarch64-linux-gnu device-tree-compiler \
61+
android-sdk-libsparse-utils
62+
sudo apt install -y gcc-arm-linux-gnueabi
63+
echo "CROSS_COMPILE_ARM32=arm-linux-gnueabi-" >> $GITHUB_ENV
64+
65+
- name: 🔧 Install Clang from a Github action
66+
uses: KyleMayes/install-llvm-action@v2
67+
with:
68+
version: "18.1.8"
69+
directory: ${{ runner.temp }}/llvm
70+
71+
- name: 🔧 Add Clang to the PATH
72+
run: |
73+
echo "${{ runner.temp }}/llvm/bin" >> $GITHUB_PATH
74+
75+
- name: 🔍 Device's codename and kernel's version
76+
run: |
77+
DEVICE_CODENAME=laurel_sprout
78+
KERNEL_VERSION=$(make kernelversion)
79+
80+
echo "Device Codename: $DEVICE_CODENAME"
81+
echo "Kernel Version: $KERNEL_VERSION"
82+
83+
echo "DEVICE_CODENAME=$DEVICE_CODENAME" >> $GITHUB_ENV
84+
echo "KERNEL_VERSION=$KERNEL_VERSION" >> $GITHUB_ENV
85+
86+
- name: 🚀 Enable ccache to speed the build up
87+
uses: hendrikmuhs/ccache-action@v1.2
88+
with:
89+
max-size: 7G
90+
91+
- name: 🛠️ Build the kramel
92+
run: |
93+
export ARCH=arm64
94+
export SUBARCH=arm64
95+
export KBUILD_COMPILER_STRING=$(clang --version | head -n 1)
96+
export CCACHE_EXEC=$(which ccache)
97+
export KBUILD_BUILD_HOST="Github-actions-Onelots"
98+
99+
make O=out ARCH=arm64 vendor/laurel_sprout-perf_defconfig V=1
100+
make O=out ARCH=arm64 olddefconfig
101+
./scripts/config --file out/.config -e CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE
102+
103+
make -j$(nproc --all) O=out \
104+
ARCH=arm64 \
105+
CC="ccache clang" \
106+
LLVM=1 \
107+
LLVM_IAS=1 \
108+
CLANG_TRIPLE=aarch64-linux-gnu- \
109+
CROSS_COMPILE=aarch64-linux-android- \
110+
CROSS_COMPILE_ARM32=arm-linux-androideabi-
111+
112+
- name: 🚀 Copy the compiled kernel to AnyKernel3 then create the zip
113+
run: |
114+
ZIP_NAME="Kernel-${DEVICE_CODENAME}-${KERNEL_VERSION}-$(date +%d%m%Y).zip"
115+
116+
cp out/arch/arm64/boot/Image.gz-dtb anykernel/
117+
118+
cd anykernel && zip -r9 $ZIP_NAME ./*
119+
mv $ZIP_NAME ../
120+
121+
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV
122+
123+
- name: 📤 Publish github release
124+
uses: softprops/action-gh-release@v2
125+
with:
126+
files: ${{ env.ZIP_NAME }}
127+
tag_name: "latest"
128+
draft: false
129+
prerelease: false
130+
131+
- name: 📤 Publish with tag associated to the kernel
132+
uses: softprops/action-gh-release@v2
133+
with:
134+
files: ${{ env.ZIP_NAME }}
135+
tag_name: Kernel-${{ env.DEVICE_CODENAME }}-${{ env.KERNEL_VERSION }}-${{ env.DATE }}
136+
draft: false
137+
prerelease: false
138+
139+
- name: 🚀 Notify people on Discord
140+
env:
141+
DEVICE_CODENAME: ${{ env.DEVICE_CODENAME }}
142+
KERNEL_VERSION: ${{ env.KERNEL_VERSION }}
143+
WEBHOOK: ${{ secrets.WEBHOOK }}
144+
NAME: ${{ env.ZIP_NAME }}
145+
run: |
146+
python3 .github/webhook.py

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ modules.builtin
7575
!.gitignore
7676
!.mailmap
7777
!.cocciconfig
78+
!.github
7879

7980
#
8081
# Generated include files

0 commit comments

Comments
 (0)