kernel.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. name: Build Kernel
  2. on:
  3. pull_request:
  4. paths:
  5. - 'include/kernel-*'
  6. - 'package/kernel/**'
  7. jobs:
  8. determine_targets:
  9. name: Set targets
  10. runs-on: ubuntu-latest
  11. outputs:
  12. target: ${{ steps.find_targets.outputs.target }}
  13. steps:
  14. - name: Checkout
  15. uses: actions/checkout@v2
  16. - name: Set targets
  17. id: find_targets
  18. run: |
  19. export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \
  20. | sort -u -t '/' -k1,1 \
  21. | awk '{ print $1 }')"
  22. JSON='['
  23. FIRST=1
  24. for TARGET in $TARGETS; do
  25. [[ $FIRST -ne 1 ]] && JSON="$JSON"','
  26. JSON="$JSON"'"'"${TARGET}"'"'
  27. FIRST=0
  28. done
  29. JSON="$JSON"']'
  30. echo -e "\n---- targets ----\n"
  31. echo "$JSON"
  32. echo -e "\n---- targets ----\n"
  33. echo "::set-output name=target::$JSON"
  34. build:
  35. name: Build Kernel with external toolchain
  36. needs: determine_targets
  37. runs-on: ubuntu-latest
  38. strategy:
  39. fail-fast: False
  40. matrix:
  41. target: ${{fromJson(needs.determine_targets.outputs.target)}}
  42. container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1
  43. steps:
  44. - name: Checkout master directory
  45. uses: actions/checkout@v2
  46. with:
  47. path: openwrt
  48. - name: Fix permission
  49. run: |
  50. chown -R buildbot:buildbot openwrt
  51. - name: Initialization environment
  52. run: |
  53. TARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 1)
  54. SUBTARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 2)
  55. echo "TARGET=$TARGET" >> "$GITHUB_ENV"
  56. echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV"
  57. - name: Update & Install feeds
  58. shell: su buildbot -c "sh -e {0}"
  59. working-directory: openwrt
  60. run: |
  61. ./scripts/feeds update -a
  62. ./scripts/feeds install -a
  63. - name: Parse toolchain file
  64. working-directory: openwrt
  65. run: |
  66. TOOLCHAIN_FILE=$(curl "https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \
  67. | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p')
  68. echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV"
  69. - name: Download external toolchain
  70. shell: su buildbot -c "sh -e {0}"
  71. working-directory: openwrt
  72. run: |
  73. wget -O - https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \
  74. | tar --xz -xf -
  75. - name: Configure external toolchain
  76. shell: su buildbot -c "sh -e {0}"
  77. working-directory: openwrt
  78. run: |
  79. ./scripts/ext-toolchain.sh \
  80. --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \
  81. --config ${{ env.TARGET }}/${{ env.SUBTARGET }}
  82. make defconfig
  83. - name: Build tools
  84. shell: su buildbot -c "sh -e {0}"
  85. working-directory: openwrt
  86. run: make tools/install -j$(nproc) BUILD_LOG=1
  87. - name: Build toolchain
  88. shell: su buildbot -c "sh -e {0}"
  89. working-directory: openwrt
  90. run: make toolchain/install -j$(nproc) BUILD_LOG=1
  91. - name: Build Kernel
  92. shell: su buildbot -c "sh -e {0}"
  93. working-directory: openwrt
  94. run: make target/compile -j$(nproc) BUILD_LOG=1
  95. - name: Upload logs
  96. if: failure()
  97. uses: actions/upload-artifact@v2
  98. with:
  99. name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs
  100. path: "openwrt/logs"