.github/workflows: Revamp kernel building #124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Kernel | |
on: | |
push: | |
branches: | |
- Grass | |
pull_request: | |
branches: | |
- Grass | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
device: [a51, m21, m31, m31s, f41] | |
rom: [aosp, oneui] | |
name: "🚧 Build ${{matrix.device}} ${{matrix.rom}}" | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
bison \ | |
flex \ | |
libssl-dev \ | |
python3 \ | |
python-is-python3 \ | |
libarchive-tools | |
- name: Setup toolchain | |
run: | | |
mkdir -p toolchain | |
cd toolchain | |
echo 'Downloading antman and syncing...' | |
bash <(curl -s "https://raw.githubusercontent.com/Neutron-Toolchains/antman/main/antman") -S=05012024 | |
echo 'Patching for glibc...' | |
bash <(curl -s "https://raw.githubusercontent.com/Neutron-Toolchains/antman/main/antman") --patch=glibc | |
echo 'Toolchain setup completed' | |
- name: Build kernel | |
run: | | |
python build_kernel.py --target=${{matrix.device}} --${{matrix.rom}} | |
- name: Check build artifacts | |
id: check_files | |
run: | | |
if ls Grass*.zip 1> /dev/null 2>&1; then | |
echo "zip_exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "zip_exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Upload to Telegram | |
if: steps.check_files.outputs.zip_exists == 'true' | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_CHAT_ID }} | |
token: ${{ secrets.TELEGRAM_BOT_KEY }} | |
document: ./Grass*.zip | |
message: | | |
🔨 Grass Kernel Build Completed | |
📱 Device: ${{matrix.device}} | |
📦 ROM: ${{matrix.rom}} | |
- name: Upload artifacts to GitHub | |
if: steps.check_files.outputs.zip_exists == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: kernel-${{matrix.device}}-${{matrix.rom}} | |
path: Grass*.zip | |
retention-days: 5 | |
- name: Handle build failure | |
if: failure() | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_CHAT_ID }} | |
token: ${{ secrets.TELEGRAM_BOT_KEY }} | |
message: | | |
❌ Grass Kernel Build Failed | |
📱 Device: ${{matrix.device}} | |
📦 ROM: ${{matrix.rom}} |