Repository navigation
Kernel Builder #2
This file contains hidden or 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: Kernel Builder | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| variant: | |
| description: "Build Variant" | |
| required: true | |
| default: "non-ksu" | |
| type: choice | |
| options: | |
| - non-ksu | |
| - ksu | |
| jobs: | |
| build: | |
| name: Kernel Builder | |
| runs-on: ubuntu-latest | |
| env: | |
| CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" | |
| CCACHE_NOHASHDIR: "true" | |
| CCACHE_HARDLINK: "true" | |
| USE_CCACHE: 1 | |
| steps: | |
| # ========================= | |
| # CLONE CORRECT BRANCH | |
| # ========================= | |
| - name: Clone kernel repo | |
| run: | | |
| if [ "${{ github.event.inputs.variant }}" = "ksu" ]; then | |
| git clone https://github.com/Starrykernel/kernel_xiaomi_veux.git -b 16-Q-KSU kernel --depth=1 | |
| else | |
| git clone https://github.com/Starrykernel/kernel_xiaomi_veux.git -b 16-Q kernel --depth=1 | |
| fi | |
| # ========================= | |
| # YOUR ORIGINAL DEPENDENCIES (UNCHANGED) | |
| # ========================= | |
| - name: Setup packages | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get -y install repo bc bison build-essential curl ccache coreutils flex g++-multilib gcc-multilib git gnupg \ | |
| gperf libxml2 lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-gtk3-dev imagemagick lunzip lzop schedtool squashfs-tools xsltproc zip \ | |
| zlib1g-dev perl xmlstarlet virtualenv xz-utils rr jq libncurses5 pngcrush lib32ncurses5-dev git-lfs libxml2 openjdk-11-jdk wget lib32readline-dev \ | |
| libssl-dev libxml2-utils android-sdk-libsparse-utils lld zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \ | |
| lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig ca-certificates bc cpio imagemagick \ | |
| bsdmainutils lz4 aria2 rclone ssh-client libncurses5 libssl-dev rsync schedtool python-is-python3 libarchive-tools python3 zstd | |
| # ========================= | |
| # KEEP SWAP (YOUR REQUEST) | |
| # ========================= | |
| - name: Set swap to 10G | |
| uses: pierotofy/set-swap-space@master | |
| with: | |
| swap-size-gb: 10 | |
| # ========================= | |
| # CCACHE SETUP | |
| # ========================= | |
| - name: Restore ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.ccache | |
| key: ccache-${{ github.ref }} | |
| restore-keys: | | |
| ccache- | |
| - name: Setup ccache | |
| run: | | |
| mkdir -p ~/.ccache | |
| echo "max_size = 20G" > ~/.ccache/ccache.conf | |
| echo "/usr/lib/ccache" >> $GITHUB_PATH | |
| # ========================= | |
| # BUILD | |
| # ========================= | |
| - name: Build kernel | |
| working-directory: kernel | |
| env: | |
| BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
| CHAT_ID: ${{ secrets.CHAT_ID }} | |
| run: | | |
| chmod +x build.sh | |
| echo "Starting build..." | |
| ./build.sh | |
| # ========================= | |
| # SAVE CCACHE | |
| # ========================= | |
| - name: Save ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.ccache | |
| key: ccache-${{ github.ref }} | |
| # ========================= | |
| # GET ZIP | |
| # ========================= | |
| - name: Get ZIP file | |
| id: zip | |
| run: | | |
| FILE=$(ls kernel/*.zip | head -n 1) | |
| echo "zip=$FILE" >> $GITHUB_OUTPUT | |
| # ========================= | |
| # RELEASE | |
| # ========================= | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: ${{ steps.zip.outputs.zip }} | |
| tag: build-${{ github.run_number }} | |
| name: "Kernel Build #${{ github.run_number }} (${{ github.event.inputs.variant }})" | |
| token: ${{ secrets.PAT_TOKEN }} | |
| body: | | |
| Automated kernel build | |
| Variant: ${{ github.event.inputs.variant }} | |
| Commit: ${{ github.sha }} |