Skip to content

Build kernel by proton clang #12

Build kernel by proton clang

Build kernel by proton clang #12

name: Build kernel by proton clang
on:
watch:
types: [ started ]
workflow_dispatch:
jobs:
build:
name: Build Kernel by ${{ github.actor }}
runs-on: ubuntu-22.04
if: github.event.repository.owner.id == github.event.sender.id
env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true"
CCACHE_HARDLINK: "true"
steps:
- uses: actions/checkout@v4
- name: Prepare Configuration
run: |
echo "KERNEL_SOURCE=https://github.com/wcedla/kernel_xiaomi_sm8250_immens1ty_mod.git" >> $GITHUB_ENV
echo "KERNEL_SOURCE_BRANCH=android14-stable-mod" >> $GITHUB_ENV
- name: Set swap to 10G
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- name: Setup build kernel environment
run: |
echo "BUILD_TIME=$(TZ=Asia/Shanghai date "+%Y%m%d%H%M")" >> $GITHUB_ENV
echo "DEVICE=umi" >> $GITHUB_ENV
sudo apt-get update
sudo apt install -y curl python2 libelf-dev llvm lld wget vim git ccache automake flex lzop bison gperf build-essential zip zlib1g-dev g++-multilib libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven libssl-dev pwgen libswitch-perl policycoreutils minicom libxml-sax-base-perl libxml-simple-perl bc libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev xsltproc unzip device-tree-compiler kmod python3 python3-pip cpio
mkdir -p $GITHUB_WORKSPACE/kernel_workspace
- name: Download Proton-Clang
run: |
cd $HOME
mkdir proton-clang
cd proton-clang
wget https://github.com/kdrag0n/proton-clang/archive/refs/tags/20210522.zip
unzip 20210522.zip
- name: Download kernel source
run: |
cd $GITHUB_WORKSPACE/kernel_workspace
git clone ${{ env.KERNEL_SOURCE }} -b ${{ env.KERNEL_SOURCE_BRANCH }} android-kernel --depth=1
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: build-kernel-${{ env.DEVICE }}
max-size: 2G
- name: Build kernel
run: |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel
export KBUILD_BUILD_HOST=Github-Action
export KBUILD_BUILD_USER=$(echo ${{ github.actor }} | tr A-Z a-z)
bash build.sh umi ksu
- name: Check a kernel output files
run: |
cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel
count=1
for file in *.zip; do
if [ -f "$file" ]; then
echo "file$count=$file" >> $GITHUB_ENV
mkdir file$count
cd file$count
unzip ../$file
cd ..
count=$((count + 1))
fi
done
for i in {1..2}; do
file_var="file$i"
if [ -z "${{!env.file_var}}" ]; then
echo "${{env.file_var}} does not exist."
exit 1
else
echo "${{env.file_var}} exists: ${{!env.file_var}}"
echo "CHECK_FILE_IS_OK=true" >> $GITHUB_ENV
fi
done
- name: Upload Artifact1
if: env.CHECK_FILE_IS_OK == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ env.file1 }}
path: kernel_workspace/android-kernel/file1
- name: Upload Artifact2
if: env.CHECK_FILE_IS_OK == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ env.file2 }}
path: kernel_workspace/android-kernel/file2