action.yml 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: 'Setup ccache'
  2. description: 'Install and configure ccache for older kernels (android12/13)'
  3. inputs:
  4. version:
  5. description: 'Kernel config version (e.g., android14-6.1)'
  6. required: true
  7. runs:
  8. using: 'composite'
  9. steps:
  10. - name: Setup ccache
  11. shell: bash
  12. if: |
  13. inputs.version == 'android12-5.10' ||
  14. inputs.version == 'android13-5.10' ||
  15. inputs.version == 'android13-5.15'
  16. working-directory: ${{ github.workspace }}
  17. run: |
  18. set -euo pipefail
  19. echo "Installing ccache..."
  20. if [ -s "${{ github.workspace }}/ccache-dl/ccache" ]; then
  21. sudo cp -f "${{ github.workspace }}/ccache-dl/ccache" /usr/bin/ccache
  22. sudo chmod +x /usr/bin/ccache
  23. rm -rf "${{ github.workspace }}/ccache-dl"
  24. echo "✅ installed from shared artifact"
  25. else
  26. curl -LfsS --retry 5 --retry-delay 5 --retry-all-errors --connect-timeout 30 \
  27. -H "User-Agent: Mozilla/5.0" \
  28. "https://github.com/WildKernels/kernel_patches/raw/refs/heads/main/ccache/ccache-x86-64" -o ccache
  29. sudo cp -f ./ccache /usr/bin/ccache
  30. sudo chmod +x /usr/bin/ccache
  31. rm -f ./ccache
  32. echo "✅ installed from download"
  33. fi
  34. if ! /usr/bin/ccache --version > /dev/null 2>&1; then
  35. echo "❌ ccache installation failed"
  36. exit 1
  37. fi
  38. echo "✅ ccache verified: $(/usr/bin/ccache --version | head -1)"
  39. export CCACHE_DIR="/home/runner/.ccache"
  40. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  41. mkdir -p "$CCACHE_DIR"
  42. export CCACHE_MAXSIZE="12G"
  43. echo CCACHE_MAXSIZE="$CCACHE_MAXSIZE" >> $GITHUB_ENV
  44. export CCACHE_COMPILERCHECK="content"
  45. echo CCACHE_COMPILERCHECK="$CCACHE_COMPILERCHECK" >> $GITHUB_ENV
  46. export CCACHE_BASEDIR="${{ github.workspace }}"
  47. echo CCACHE_BASEDIR="${{ github.workspace }}" >> $GITHUB_ENV
  48. export CCACHE_NOHASHDIR="true"
  49. echo CCACHE_NOHASHDIR="true" >> $GITHUB_ENV
  50. export CCACHE_IGNOREOPTIONS="--sysroot*"
  51. echo CCACHE_IGNOREOPTIONS="--sysroot*" >> $GITHUB_ENV
  52. export CCACHE_COMPRESSION="true"
  53. echo CCACHE_COMPRESSION="true" >> $GITHUB_ENV
  54. export CCACHE_COMPRESSLEVEL="3"
  55. echo CCACHE_COMPRESSION_LEVEL="3" >> $GITHUB_ENV
  56. export CCACHE_DIRECT="true"
  57. echo CCACHE_DIRECT="true" >> "$GITHUB_ENV"
  58. export CCACHE_FILE_CLONE="true"
  59. echo CCACHE_FILE_CLONE="true" >> "$GITHUB_ENV"
  60. export CCACHE_INODE_CACHE="true"
  61. echo CCACHE_INODE_CACHE="true" >> "$GITHUB_ENV"
  62. export CCACHE_IS_KERNEL_COMPILING="true"
  63. echo CCACHE_IS_KERNEL_COMPILING="true" >> $GITHUB_ENV
  64. export CCACHE_UMASK="002"
  65. echo CCACHE_UMASK="002" >> $GITHUB_ENV
  66. export CCACHE_SLOPPINESS="file_macro,time_macros,include_file_mtime,include_file_ctime,pch_defines,system_headers,locale"
  67. echo CCACHE_SLOPPINESS="file_macro,time_macros,include_file_mtime,include_file_ctime,pch_defines,system_headers,locale" >> $GITHUB_ENV
  68. if ccache --help 2>&1 | grep -q 'depend_mode'; then
  69. export CCACHE_DEPEND=true
  70. echo "CCACHE_DEPEND=true" >> "$GITHUB_ENV"
  71. fi
  72. echo "=== ccache config ==="
  73. ccache -p
  74. echo "====================="
  75. echo "✅ ccache ready"