name: 'Setup Build Environment' description: 'Clones dependencies and exports mkbootimg/avbtool paths' inputs: version: description: 'Kernel config version (e.g., android12-5.10)' required: true sublevel: description: 'Kernel sublevel' required: true kernel_patches_commit: description: 'Pinned kernel_patches commit (empty = main tip)' required: false default: '' anykernel3_commit: description: 'Pinned AnyKernel3 commit (empty = gki-2.0 tip)' required: false default: '' runs: using: composite steps: - shell: bash run: | set -euo pipefail git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" mkdir -p "${{ github.workspace }}/kernel" mkdir -p "${{ github.workspace }}/git-repo" # Retry transient network errors (up to 5 attempts, 5s backoff). retry() { local n=0 until [ "$n" -ge 5 ]; do "$@" && return 0 n=$((n+1)) echo "retry $n/5 failed for: $*" sleep 5 done return 1 } retry curl -L https://storage.googleapis.com/git-repo-downloads/repo -o "${{ github.workspace }}/git-repo/repo" chmod +x "${{ github.workspace }}/git-repo/repo" echo "${{ github.workspace }}/git-repo" >> "$GITHUB_PATH" if [ -d "${{ github.workspace }}/kernel_patches" ]; then rm -rf "${{ github.workspace }}/kernel_patches"; fi retry git clone https://github.com/WildKernels/kernel_patches.git "${{ github.workspace }}/kernel_patches" if [ -n "${{ inputs.kernel_patches_commit }}" ]; then git -C "${{ github.workspace }}/kernel_patches" fetch --depth=1 origin "${{ inputs.kernel_patches_commit }}" git -C "${{ github.workspace }}/kernel_patches" checkout "${{ inputs.kernel_patches_commit }}" [ "$(git -C "${{ github.workspace }}/kernel_patches" rev-parse HEAD)" = "${{ inputs.kernel_patches_commit }}" ] || { echo "kernel_patches pin mismatch" >&2; exit 1; } fi if [ -d "${{ github.workspace }}/AnyKernel3" ]; then rm -rf "${{ github.workspace }}/AnyKernel3"; fi retry git clone https://github.com/WildKernels/AnyKernel3.git -b gki-2.0 "${{ github.workspace }}/AnyKernel3" if [ -n "${{ inputs.anykernel3_commit }}" ]; then git -C "${{ github.workspace }}/AnyKernel3" fetch --depth=1 origin "${{ inputs.anykernel3_commit }}" git -C "${{ github.workspace }}/AnyKernel3" checkout "${{ inputs.anykernel3_commit }}" [ "$(git -C "${{ github.workspace }}/AnyKernel3" rev-parse HEAD)" = "${{ inputs.anykernel3_commit }}" ] || { echo "AnyKernel3 pin mismatch" >&2; exit 1; } fi - name: Install build deps for BTF generation (android12-5.10) shell: bash if: inputs.version == 'android12-5.10' run: | set -euo pipefail sudo apt-get update -qq sudo apt-get install -y -qq dwarves libelf-dev