Kernel Builder #13
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 | |
| permissions: | |
| contents: write | |
| actions: write | |
| on: | |
| workflow_dispatch: | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| MAN_DISABLE: true | |
| TERM: xterm-256color | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code & init submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: true | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y \ | |
| bc bison ccache curl flex git tar wget aria2 build-essential \ | |
| jq xz-utils lz4 zip | |
| - name: Prepare ccache | |
| run: | | |
| echo "CCACHE_DIR=$HOME/.ccache" >> "$GITHUB_ENV" | |
| echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE" >> "$GITHUB_ENV" | |
| mkdir -p "$HOME/.ccache" | |
| ccache --set-config=compiler_check=content | |
| ccache --set-config=hash_dir=false | |
| ccache --set-config=sloppiness=file_macro,include_file_ctime,include_file_mtime,time_macros | |
| ccache --set-config=direct_mode=true | |
| ccache --set-config=max_size=7G | |
| ccache --zero-stats | |
| { clang --version 2>/dev/null | sha256sum | cut -c1-10 || echo "aosp"; } | \ | |
| awk '{print "clang_hash="$1}' >> "$GITHUB_ENV" | |
| - name: Restore ccache | |
| id: restore-ccache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ccache-${{ runner.os }}-${{ env.clang_hash }}-${{ github.ref_name }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-${{ runner.os }}-${{ env.clang_hash }}-${{ github.ref_name }}- | |
| ccache-${{ runner.os }}-${{ env.clang_hash }}- | |
| - name: Build | |
| env: | |
| TG_CHAT_ID: ${{ secrets.TG_CHAT_ID }} | |
| TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| run: | | |
| bash ./build.sh | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: AnyKernel3 | |
| path: | | |
| AnyKernel3.zip | |
| if-no-files-found: error | |
| - name: Save ccache | |
| if: ${{ always() && steps.restore-ccache.outputs.cache-hit != 'true' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ccache-${{ runner.os }}-${{ env.clang_hash }}-${{ github.ref_name }}-${{ github.sha }} | |
| - name: ccache stats | |
| if: ${{ always() }} | |
| run: ccache -s || true |