Skip to content

Kernel Builder

Kernel Builder #305

Workflow file for this run

name: Kernel Builder
permissions:
contents: write
actions: write
on:
workflow_call:
inputs:
BUILD_TARGET:
type: string
required: true
KSU:
type: boolean
required: true
SUSFS:
type: boolean
required: true
LXC:
type: boolean
required: true
STOCK_CONFIG:
type: string
required: true
TG_NOTIFY:
type: boolean
required: true
workflow_dispatch:
inputs:
BUILD_TARGET:
description: "Build target"
default: xaga
type: choice
options:
- xaga
- generic
BRANCH_OVERRIDE:
description: "Kernel branch overriding"
type: string
KSU:
description: "Include KernelSU?"
default: false
type: boolean
SUSFS:
description: "Include SUSFS?"
default: false
type: boolean
LXC:
description: "Apply LXC patch?"
default: false
type: boolean
STOCK_CONFIG:
description: "Spoof stock config?"
default: auto
type: choice
options:
- auto
- true
- false
TG_NOTIFY:
description: "Telegram Notify"
default: true
type: boolean
env:
DEBIAN_FRONTEND: noninteractive
MAN_DISABLE: true
TERM: xterm-256color
CCACHE_DIR: ${{ github.workspace }}/.ccache
jobs:
build:
runs-on: ubuntu-latest
env:
TG_CHAT_ID: ${{ secrets.TG_CHAT_ID }}
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v6.0.1
with:
fetch-depth: 1
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq \
bc bison ccache curl flex git tar wget aria2 jq zip zstd upx build-essential libfaketime lz4 just
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Install Python 3.14
run: uv python install 3.14
- name: Compute ccache key
run: |
echo "clang_hash=$(clang --version | sha256sum | cut -c1-10 || echo none)" >> "$GITHUB_ENV"
- name: Restore ccache
id: restore-ccache
uses: actions/cache/restore@v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ env.clang_hash }}-${{ inputs.BUILD_TARGET }}-${{ inputs.LXC }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
ccache-${{ env.clang_hash }}-${{ inputs.BUILD_TARGET }}-${{ inputs.LXC }}-${{ github.ref_name }}-
ccache-${{ env.clang_hash }}-${{ inputs.BUILD_TARGET }}-${{ inputs.LXC }}-
ccache-${{ env.clang_hash }}-${{ inputs.BUILD_TARGET }}-
ccache-${{ env.clang_hash }}-
- name: Build
id: build
env:
BUILD_TARGET: ${{ inputs.BUILD_TARGET }}
BRANCH_OVERRIDE: ${{ inputs.BRANCH_OVERRIDE }}
KSU: ${{ inputs.KSU }}
SUSFS: ${{ inputs.SUSFS }}
LXC: ${{ inputs.LXC }}
STOCK_CONFIG: ${{ inputs.STOCK_CONFIG }}
TG_NOTIFY: ${{ inputs.TG_NOTIFY }}
run: |
just build
file="$GITHUB_WORKSPACE/github.json"
[[ -f "$file" ]] || { echo "::error::github.json missing"; exit 1; }
python3 - "$file" "$GITHUB_OUTPUT" <<'PY'
import json
import sys
with open(sys.argv[1]) as f:
data = json.load(f)
keys = ["name", "variant", "out_dir", "package_name"]
with open(sys.argv[2], "a") as out:
for key in keys:
out.write(f"{key}={data[key]}\n")
PY
- name: Save ccache
if: ${{ always() && steps.restore-ccache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ env.clang_hash }}-${{ inputs.BUILD_TARGET }}-${{ inputs.LXC }}-${{ github.ref_name }}-${{ github.sha }}
- name: Upload GitHub metadata artifact
uses: actions/upload-artifact@v6
with:
name: github-metadata-${{ steps.build.outputs.variant }}
path: ${{ github.workspace }}/github.json
compression-level: 0
- name: Upload AnyKernel3 artifact
uses: actions/upload-artifact@v6
with:
name: ${{ steps.build.outputs.name }}-${{ steps.build.outputs.variant }}-AnyKernel3
path: ${{ steps.build.outputs.out_dir }}/${{ steps.build.outputs.package_name }}-AnyKernel3.zip
compression-level: 0
- name: Upload boot image artifact
uses: actions/upload-artifact@v6
if: inputs.BUILD_TARGET == 'generic'
with:
name: ${{ steps.build.outputs.name }}-${{ steps.build.outputs.variant }}-boot
path: ${{ steps.build.outputs.out_dir }}/${{ steps.build.outputs.package_name }}-boot*.img