action.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: 'Setup Build Environment'
  2. description: 'Clones dependencies and exports mkbootimg/avbtool paths'
  3. inputs:
  4. version:
  5. description: 'Kernel config version (e.g., android12-5.10)'
  6. required: true
  7. sublevel:
  8. description: 'Kernel sublevel'
  9. required: true
  10. kernel_patches_commit:
  11. description: 'Pinned kernel_patches commit (empty = main tip)'
  12. required: false
  13. default: ''
  14. anykernel3_commit:
  15. description: 'Pinned AnyKernel3 commit (empty = gki-2.0 tip)'
  16. required: false
  17. default: ''
  18. runs:
  19. using: composite
  20. steps:
  21. - shell: bash
  22. run: |
  23. set -euo pipefail
  24. git config --global user.name "github-actions[bot]"
  25. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  26. mkdir -p "${{ github.workspace }}/kernel"
  27. mkdir -p "${{ github.workspace }}/git-repo"
  28. # Retry transient network errors (up to 5 attempts, 5s backoff).
  29. retry() {
  30. local n=0
  31. until [ "$n" -ge 5 ]; do
  32. "$@" && return 0
  33. n=$((n+1))
  34. echo "retry $n/5 failed for: $*"
  35. sleep 5
  36. done
  37. return 1
  38. }
  39. retry curl -L https://storage.googleapis.com/git-repo-downloads/repo -o "${{ github.workspace }}/git-repo/repo"
  40. chmod +x "${{ github.workspace }}/git-repo/repo"
  41. echo "${{ github.workspace }}/git-repo" >> "$GITHUB_PATH"
  42. if [ -d "${{ github.workspace }}/kernel_patches" ]; then rm -rf "${{ github.workspace }}/kernel_patches"; fi
  43. retry git clone https://github.com/WildKernels/kernel_patches.git "${{ github.workspace }}/kernel_patches"
  44. if [ -n "${{ inputs.kernel_patches_commit }}" ]; then
  45. git -C "${{ github.workspace }}/kernel_patches" fetch --depth=1 origin "${{ inputs.kernel_patches_commit }}"
  46. git -C "${{ github.workspace }}/kernel_patches" checkout "${{ inputs.kernel_patches_commit }}"
  47. [ "$(git -C "${{ github.workspace }}/kernel_patches" rev-parse HEAD)" = "${{ inputs.kernel_patches_commit }}" ] || { echo "kernel_patches pin mismatch" >&2; exit 1; }
  48. fi
  49. if [ -d "${{ github.workspace }}/AnyKernel3" ]; then rm -rf "${{ github.workspace }}/AnyKernel3"; fi
  50. retry git clone https://github.com/WildKernels/AnyKernel3.git -b gki-2.0 "${{ github.workspace }}/AnyKernel3"
  51. if [ -n "${{ inputs.anykernel3_commit }}" ]; then
  52. git -C "${{ github.workspace }}/AnyKernel3" fetch --depth=1 origin "${{ inputs.anykernel3_commit }}"
  53. git -C "${{ github.workspace }}/AnyKernel3" checkout "${{ inputs.anykernel3_commit }}"
  54. [ "$(git -C "${{ github.workspace }}/AnyKernel3" rev-parse HEAD)" = "${{ inputs.anykernel3_commit }}" ] || { echo "AnyKernel3 pin mismatch" >&2; exit 1; }
  55. fi
  56. - name: Install build deps for BTF generation (android12-5.10)
  57. shell: bash
  58. if: inputs.version == 'android12-5.10'
  59. run: |
  60. set -euo pipefail
  61. sudo apt-get update -qq
  62. sudo apt-get install -y -qq dwarves libelf-dev