Skip to content

Build Kernel

Build Kernel #25

Workflow file for this run

name: Build Kernel
on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *"
env:
TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
jobs:
build_kernel:
name: Build Kernel
runs-on: ubuntu-latest
env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true"
CCACHE_HARDLINK: "true"
strategy:
matrix:
build_type: ['KSU', 'KSU_DYNAMIC', "NO-KSU", "NOKSU_DYNAMIC"]
steps:
- name: Clone Repo Android Kernel
uses: MoeKernel/[email protected]
with:
depth: 1
branch: ${{ matrix.build_type == 'KSU' && 'fourteen' || matrix.build_type == 'KSU_DYNAMIC' && 'fourteen_dynamic' || matrix.build_type == 'NO-KSU' && 'without-ksu' || matrix.build_type == 'NOKSU_DYNAMIC' && 'fourteen_dynamic_noksu' }}
owner: 'MoeKernel'
repository: 'android_kernel_xiaomi_ginkgo'
- name: Clone Repo Build
uses: MoeKernel/[email protected]
with:
depth: 1
branch: 'main'
owner: 'MoeKernel'
repository: 'build'
- name: Prepare Configuration
working-directory: ./build
run: |
CONFIG_ENV=$(cat config.env | grep -w "CONFIG_ENV" | head -n 1 | cut -d "=" -f 2)
echo "ENABLE_CCACHE=$(cat $CONFIG_ENV | grep -w "ENABLE_CCACHE" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
pwd
- name: Set swap to 24G
uses: MoeKernel/swap@moe
with:
swap-size-gb: 24
- name: Clone Repo Scripts
uses: MoeKernel/[email protected]
id: clone_scripts
with:
branch: ${{ matrix.build_type == 'KSU' && 'ksu' || matrix.build_type == 'KSU_DYNAMIC' && 'ksu_dynamic' || matrix.build_type == 'NO-KSU' && 'without-ksu' || matrix.build_type == 'NOKSU_DYNAMIC' && 'noksu_dynamic' }}
owner: 'MoeKernel'
repository: 'scripts'
- name: List Branches in Scripts Repository
working-directory: ./scripts
run: |
git fetch --all
git branch -a
- name: Move Scripts
working-directory: ./scripts
run: |
chmod +x moe.sh bot.sh ksu_update.sh
cp build_count.txt moe.sh bot.sh ksu_update.sh ../android_kernel_xiaomi_ginkgo
- name: Restore Cache
uses: MoeKernel/cache@v3
with:
path: /home/runner/tc
key: ${{ runner.os }}-tc
id: tc-cache
- name: Github Configs
working-directory: ./android_kernel_xiaomi_ginkgo
run: |
git config --global user.email "[email protected]"
git config --global user.name "ginkgo"
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ccache python3 python3-pip git make bc ca-certificates git xz-utils
- name: Pip Install Packages
working-directory: ./android_kernel_xiaomi_ginkgo
run: |
pip install Pyrogram TgCrypto load_dotenv
- name: Export Variables
working-directory: ./android_kernel_xiaomi_ginkgo
run: |
echo "CHAT_ID=${{ secrets.CHAT_ID }}" >> .env
echo "API_ID=${{ secrets.API_ID }}" >> .env
echo "API_HASH=${{ secrets.API_HASH }}" >> .env
echo "BOT_TOKEN=${{ secrets.BOT_TOKEN }}" >> .env
- name: Setup ccache
if: env.ENABLE_CCACHE == 'true'
uses: MoeKernel/ccache@moe
with:
key: build-kernel
max-size: 12G
- name: Compile Kernel CI
working-directory: ./android_kernel_xiaomi_ginkgo
run: |
./bot.sh
- name: Move CI Build Count
working-directory: ./android_kernel_xiaomi_ginkgo
run: |
cp build_count.txt ../scripts
- name: Commit Update
working-directory: ./scripts
run: |
git config --global user.email "[email protected]"
git config --global user.name "Akari"
git remote set-url origin https://${{ secrets.TOKEN_GITHUB }}@github.com/MoeKernel/scripts.git
git add build_count.txt
git commit -m "update build count"
git push origin ${{ matrix.build_type == 'KSU' && 'ksu' || matrix.build_type == 'KSU_DYNAMIC' && 'ksu_dynamic' || matrix.build_type == 'NO-KSU' && 'without-ksu' || matrix.build_type == 'NOKSU_DYNAMIC' && 'noksu_dynamic' }} --force