action.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. name: 'Build Kernel'
  2. description: 'Builds kernel using legacy build.sh or Bazel (kleaf)'
  3. runs:
  4. using: composite
  5. steps:
  6. - shell: bash
  7. working-directory: ${{ github.workspace }}/kernel
  8. run: |
  9. set -euo pipefail
  10. # Install ccache with ECS by cctv18
  11. echo "Install ccache with ECS"
  12. curl -LfsS --retry 5 --retry-delay 5 --retry-all-errors --connect-timeout 30 --tcp-fastopen -H "User-Agent: Mozilla/5.0" "https://github.com/WildKernels/kernel_patches/raw/refs/heads/main/ccache/ccache-x86-64" -o ccache
  13. sudo cp -f ./ccache /usr/bin/ccache
  14. sudo chmod +x /usr/bin/ccache
  15. rm -f ./ccache
  16. echo "/usr/lib/ccache" >> $GITHUB_PATH
  17. export CCACHE_DIR="$GITHUB_WORKSPACE/.ccache"
  18. export LDCACHE_DIR="${{ github.workspace }}/.ld_cache"
  19. export CC="ccache clang"
  20. export CXX="ccache clang++"
  21. export HOSTCC="ccache clang"
  22. export HOSTCXX="ccache clang++"
  23. export CCACHE_MAXSIZE=10G
  24. export CCACHE_COMPILERCHECK=content
  25. export CCACHE_BASEDIR="$GITHUB_WORKSPACE"
  26. export CCACHE_NOHASHDIR=true
  27. export CCACHE_COMPRESSION=true
  28. export CCACHE_COMPRESSION_LEVEL=3
  29. export CCACHE_DIRECT=true
  30. export CCACHE_FILE_CLONE=true
  31. export CCACHE_INODE_CACHE=true
  32. CCACHE_IS_KERNEL_COMPILING=true
  33. export CCACHE_UMASK=002
  34. export CCACHE_SLOPPINESS="file_macro,time_macros,include_file_mtime,include_file_ctime,pch_defines,system_headers,locale"
  35. if ccache --help 2>&1 | grep -q 'depend_mode'; then
  36. export CCACHE_DEPEND=true
  37. fi
  38. echo "✅ ccache environment variables set"
  39. ccache -p
  40. if [ -f "build/build.sh" ]; then
  41. SKIP_MRPROPER=1 LTO=thin SKIP_EXT_MODULES=1 SKIP_CP_KERNEL_HDR=1 GKI_DEFCONFIG_FRAGMENT="$GITHUB_WORKSPACE/wild_gki.fragment" BUILD_CONFIG=common/build.config.gki.aarch64 CC="$CC" CXX="$CXX" build/build.sh
  42. else
  43. cp "$GITHUB_WORKSPACE/wild_gki.fragment" common/arch/arm64/configs/wild_gki.fragment
  44. tools/bazel build --config=release --notrim --defconfig_fragment=//common:arch/arm64/configs/wild_gki.fragment --cache_dir=$GITHUB_WORKSPACE/kernel/.cache/bazel //common:kernel_aarch64
  45. fi
  46. echo "Clear Temporary cache files..."
  47. ccache -c
  48. echo "Perform cache eviction!"
  49. # 3h = 10800s using seconds to support older ccache
  50. ccache --evict-older-than 10800s